Python Snippets

reload all read Nodes

reads = [n for n in nuke.allNodes("Read",recurseGroups=True)]
if reads:
for node in reads:
node["reload"].execute()

 

clear animation

for node in nuke.selectedNodes():
for knob in node.knobs():
if nuke.Knob.isAnimated(node[knob]):
nuke.Knob.clearAnimated(node[knob])

 

turn off postage stamps

for i in nuke.allNodes(recurseGroups=True):
if 'postage_stamp' in i.knobs():
i['postage_stamp'].setValue(False)

 

delete all viewer inside the script

for i in nuke.allNodes(recurseGroups=True):
if i.Class() == 'Viewer':
nuke.delete(i)

 

move animation keyframe in time and value

def offset_animation(nodename, knobname, axis, value):
nuke.animation("{}.{}".format(nodename, knobname), "move", (axis, "{}+{}".format(axis, value)))