Dec 4, 2014

Radio buttons in nuke

Hi, I always wanted to have the option of creating radiobuttons in the nuke gui, for gizmos. Its easier to use than dropdown menus, because they  need only on click to select the value. Today I checked the documentation, and I found an option. The radiobuttons are a different widget version of the enumeration knob. You can't add this knob like others via the "manage user knobs" panel, but you can with the help of a little python. For example like this:

n = nuke.toNode('Group1')
r = nuke.Radio_Knob('options', 'Option channels', ('red', 'green', 'blue', 'alpha'))
n.addKnob(r)

First argument is the name of the knob, second is the label, and the third is a tuple, with the radiobuttons' name in it.
Hope this was useful, cheers.