Skip to the content.

< Wiki Index

Nuke

#### Read every nth frame In a read (or write etc.) node’s expression manipulate the frame value like this

Eg. This example will read every 10th frame, 1001, 1011 etc. (without the -1 would be 1000, 1010 etc.)

 frame - ((frame%10)-1)

Python

#### Run a python file with Nuke’s python interpreter

/c/Program\ Files/Nuke12.1v1/python.exe ~/my_nuke_scripto.py

Open a nuke script file

nuke.scriptOpen('my_nuke_shot.nk')

Loop through nodes with a type filter eg. Write Read

# loop through all write nodes
    for node in nuke.allNodes('Write'):
     print('Node name: {}.format(node.name())

Get value of a node’s knob

node['file'].getValue())

Version-up a node using Nuke’s built in script

# version up
nukescripts.version_up()

Get nuke script’s full file path

nuke.root().name()

Save script - with warning if it didn’t save! (need to provide filename while not IN nuke GUI I think)

if not nuke.scriptSave(script_file):
    print('Script did not save for some reason')

Get nuke script’s frame start/end

nuke.root()['first_frame'].value()
nuke.root()['last_frame'].value()