Q100150: How to set Read node default decoder to mov32 via Python



You can use python callbacks in Nuke to change the decode setting on the Read node to
default to mov32 setting.  Otherwise mov64 is the default for Nuke10



The following code will select the "mov32" decoder both when a
new mov Read node is created and when the "file" setting on an existing node is changed to
point to a .mov file path.

import nuke
def setMov32_onCreate(): 
    node = nuke.thisNode()
    if node['file'].value().endswith('.mov'):
nuke.addOnCreate(setMov32_onCreate, nodeClass="Read")

def setMov32_onChange():
    node = nuke.thisNode()
    knob = nuke.thisKnob()
    if knob.name() == 'file' or node['file'].value().endswith('.mov'):
nuke.addKnobChanged( setMov32_onChange, nodeClass="Read")

You can test this code by executing it in the ScriptEditor within Nuke. In order for Nuke
to always run the code you need to add it to the init.py file in the .nuke directory
beneath your home area. If you do not already have an init.py file there then you can
create one now.

Please see the Python dev guide for more info about python callbacks in Nuke

You can share python customisation files (and other Nuke customisation files) among other
users at your facility by saving them to a central location and then setting an
environment variable called NUKE_PATH to point to that location. More information about
this is available in the Nuke python dev guide at the following link:

Was this article helpful?
0 out of 0 found this helpful