This code example creates an on knobChanged callback on a node that toggles a group of knobs open or closed based on a checkbox on the same node. In this case the group is a collection of user knobs on the properties pane of the node, not to be confused with a group of nodes.
This is based on knowledge that I learned from Ben McEwan that I took and tweaked a little to make it work with the group knob.
I have created a NoOp node called ‘NoOp1’ and in that node I have a group called ‘controls’ and a checkbox called ‘hide’. I’d include a copy of the node but I’m using Nuke Non-commercial so I can’t export nodes.
You can run this code from the script editor in Nuke to assign it to a node called ‘NoOp1’.
#code to collapse/open a group of knobs called 'controls' based on a check box called 'hide' on the same node
nuke.toNode('NoOp1').knob('knobChanged').setValue('''
check = nuke.thisNode().knob("hide").value()
controls = nuke.thisNode().knob('controls')
if check:
controls.setValue(False)
else:
controls.setValue(True)
''')
Latest Comments