(Re)Introducing Node Wrangler!

01

Just one of the new features, Viewer node for Cycles materials

Version 1.0 was, lets face it, not particularly useful. In fact the only thing I still use from it occasionally is that auto-arrangement feature. However, since the Zoom-Fit function inspired Henrik Aarnio to include it in trunk with the Alt+Home key, it wasn’t completely useless at all.

In fact, I’ve secretly been working on a whole bucket-full of new features!

Get the Node Wrangler!

I’ve made a page specifically for this addon, and I’ll continue to update it as I add more features. Here’s a summary of the features as they stand right now (but check the page for the very latest):

  • Viewer node for Cycles materials (Ctrl+Shift+Click)
  • Delete unused nodes (Alt+X)
  • UV Layer nodes – add an attribute node from a list of available UV maps with the name field already filled in (Shift+A > Input > UV Maps > [map name])
  • Switch the type of one or more nodes to a related type, like a different shader (Alt+S), keeping inputs and outputs connected
  • Swap the output connections of two nodes (Alt+Shift+S)
  • Reset the compositor backdrop image zoom and position (Z)
  • Frame the selected nodes (Shift+P)
  • Reload the images of all the image nodes in the current tree (Alt+R)
  • Quickly jump to the Image Editor and view the image of the selected node. Works for textures, movie clips, environment images, render layers, viewer nodes and masks.
  • Automatically arrange the selected nodes (or all of them) in a non-overlapping linear layout (Q)

The todo list is public on GitHub, as is the changelog which is updated automatically as I commit changes and new features.

That page I mentioned earlier has a lot more info on each feature, including a gif showing their usage.

Node Wrangler!

Let your nodes arrange themselves!

(Download)

I challenged myself to some coding this past long-weekend. I have a nice big list of all the features I wish Blender had, and despite my recent addiction to python, are all way too hardcore for me to code myself… that is until now.

At work we use Maya mostly, so I often find a neat little feature that I wish Blender had and add it to my list. This time it was little button that arranged all your nodes for you, all nice and neat and linear. Surely something like this can’t be that hard to code, right? Well the more I thought about it, the more problems I found.

I checked out some weird and wonderful methods that other software uses, like Spring Force Directed Layouts where you basically simulate the nodes as if each connection was a spring to attract two nodes together, and all nodes that don’t connect, repel each other. After some simulation you get a pretty perfect node tree. Magic right?

The problem is that this technique is more for multi-directional graphs.

Graphs!

At least that was my excuse. Implementing physics algorithms is mostly beyond me for the time being.

So instead I did the logical approach. Fetch all the nodes that have no inputs (start nodes), and look at the nodes that connect to these. Put them to the right of the start nodes, then repeat for all nodes.

Node Wrangler UI

This ends up with one big long overlapping stream of nodes. So to separate them, I did another loop in all the nodes, if one overlaps another, move it down (by the dimensions of the node it collides with – thanks to lukas_t for adding this to the python API by my request!)

And after a couple more loops to make sure everything runs from left to right, it’s basically done.

Apart from this, I also added a button to delete all unused nodes and a tool to display the Backdrop image nicely fit in the window, but those were pretty tedious after the arranging thing.

So I suppose this means I should start tackling some more epic coding projects.

I work with nodes a heck of a lot, so if you’ve got an idea or request for an addon, let me know :) If you convince me that it’d be useful, I’ll do it for ya!