Ben, how do I expression-link Pulldown Knobs?

Categories Gizmos, Quick Tip

There are two common ways you can expression-link knobs in Nuke.

  1. CTRL+Dragging one knob to another
  2. Right-clicking, choosing “add expression”, then typing your expression.

The TCL syntax for expression-linking knobs is simple: {node_name}.{knob_name}.

However, there are some knobs that are a little more difficult to expression-link. For example, a channels knob can only be linked to other channels knobs, by CTRL+dragging+dropping the = button between them. Additionally, there is no visible option to expression-link Pulldown Knobs, such as a node’s filter knob. However, we can solve these problems with a little bit of Python.

In the following example, we’re going to be expression-linking Transform2‘s filter knob to Transform1‘s filter knob. Let’s write one line of Python to help us do this in the Script Editor.


This syntax can be read as {child node}.{knob} — link to {parent node}.{knob}. Using CTRL+Enter to run the code, you can see the expression link arrow appears between the two nodes. Now when we change Transform1‘s filter, Transform2 follows! When we copy/paste the child node, the expression link will stay intact.

This is just the tip of the iceberg. We can run some more complex operations too. For example, we could set up a Transform node so that, if the Transform node’s scale knob has a value greater than 1, it will use a sharpening filter…

nuke.toNode('Transform3').knob('filter').setExpression('scale > 1 ? 3 : 1')

In English, this reads: Add an expression to the filter knob on the node named Transform3. If the scale knob on this node has a value greater than 1, set the filter knob’s value to the 3rd item in the list. In this case, that value is “Simon”, as index numbers start at zero in Python… If the scale knob’s value is 1 or less, use the value that relates to index number 1 — “Cubic”.

Lastly, to remove any of the expressions we just added via Python, we can simply run this function:


…or we can right-click the expression-linked-knob, and choose “no animation”.

If you’re needing to expression link one knob to another, and you can’t find an easy way to do it within Nuke’s GUI, writing a short line of Python will always help you out.