nuke.knob

nuke.knob(name, value, getType, getClass) → None

@brief Returns or sets the entire state of a knob.

Each individual control on a control panel is called a ‘knob’. A knob’s name is a dot-separated list. An example of a fully-expanded name of a knob is ‘root.Group1.Blur1.size.w’. ‘root’ is the node name of the outermost group, ‘Group1’ is a group inside that containing the blur operator, ‘Blur1’ is the name of a blur operator, ‘size’ is the name of the actual knob, and ‘w’ is the name of the ‘field’ (there are two fields in a blur size, ‘w’ and ‘h’).

You can omit a lot of this because all knob names are figured out relative to a ‘current knob’ and ‘current node’. These are set depending on the context of where the scripting is invoked. For menu items the current node is the group that contained the menu, and there is no current knob. For expressions typed into knob fields the current knob is that knob and the current node is the node the knob belongs to.

If a name does not start with ‘root’ then a search upwards is done for the first word in the name, first against the fields in the current knob, then against the knobs in the current node, then against the nodes in the group containing the current node (or in it if it is a group), on up to the root.

The word ‘this’ means the current knob or the current node.

The word ‘input’ means the first (0 or B) input of a node. Ie ‘Blur1.input’ returns the node connected to the input of Blur1, while ‘Blur1.input.input’ returns the input of that node.

If you are getting the value for reporting to the user, you probably want to use the value or expression commands.

If the getType argument is specified and is True, it will print out the type of the knob rather than getting or setting the value. The type is an integer, using the same list as addUserKnob.

If the getClass argument is specified and is True, it will print out the type of the knob as a string, e.g. ‘Int_Knob’, ‘Enumeration_Knob’, ‘XY_Knob’.

If both the getType and getClass arguments are present and are True, getType takes precedence. :param name: The name of the knob. :param value: Optional argument. If this is present, the value will be stored into the knob. :param getType: Optional boolean argument. If True, return the class ID for the knob instead of the knob itself. The class ID is an int. :param getClass: Optional boolean argument. If True, return the class name for the knob instead of the knob itself. The class name is a string.