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:
1 |
nuke.selectedNode().knob('knobChanged').setValue('n=nuke.thisNode() \nk=nuke.thisKnob() \nif k.name() == "knob": \n print k.value()') |
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.