Nuke Knowledge Base

Nuke stuff I need the interwebs to remember for me.


Hide unconnected inputs on selected nodes

Just a few lines to hide all not connected inputs. In this example the script touches all Beziers.

Convert rgb to hex colour in python

For some things, like the tile colour of a node, you can’t work with rgb but need to use hex values instead. You can use the following code to convert rgb to hex:

So, to set a random tile colour for the selected node, type:

Random colour values in python

To create random values in python, type:

(randint returns an integer between (x, y). float invokes a floating-point number.)

knobChanged callback for custom gizmos

If you, for example, want to change the appearance of a gizmo’s UI based on user input, you’ll need to incorporate callbacks, most probably the knobChanged callback. This is way easier than I would have expected after googling for hours and not getting it to work.

Select the node you are working on and want to apply the callback to. Head over to the script editor and enter this:

What this does: addresses the pseudo knob knobChanged and sets its value to a line of python code. It will output the value of knob, whenever knob is changed.

Next posts