Setting Default Values for Controls

You can set default values for node controls by adding a simple line of Python to your init.py file. Once a default value is set, all controls with matching names default to this value. For example, you can set default values for file format specific controls in the Read, Write or other file format-dependent nodes. To set a default value, use the following statement:

nuke.knobDefault()

Tip:   If you want to know the name of a particular knob, hover over the knob to display its tooltip. The knob name is in bold type.
You can also copy/paste a node into a text editor, but knobs with default values are not displayed. Changing the default value in the node's Properties panel adds it to the pasted text.

To specify file format specific defaults, use the class name, followed by the file format extension and the control name, all separated by periods. For example:

nuke.knobDefault("Read.exr.compression", "2")

Maybe you want the last frame value of the frame range controls in the Project Settings to default to frame 200. To do this, use the following statement:

nuke.knobDefault("Root.last_frame", "200")

Or you might want to set a different default font style in the Text node:

nuke.knobDefault("Text2.font", "{ Arial : Regular : arial.ttf : 0 }")