for all selected Tracker nodes multiply their track values by a factor of 4

for a in nuke.selectedNodes():
if a.Class()=="Tracker3":
def scaleMe(track):
if track.isAnimated():
for j inrange(0,2):
anim = track.animation(j)
keys = anim.keys()
scaleFactor =4while keys:
keys.pop().y *= scaleFactor
#i am sure there is a much nicer way of iterating over all the knobs but this worked for what i quickly needed
t1 = a['track1']
t2 = a['track2']
t3 = a['track3']
t4 = a['track4']
scaleMe(t1)
scaleMe(t2)
scaleMe(t3)
scaleMe(t4)

for a in nuke.selectedNodes():
if a.Class()=="Tracker3":
def scaleMe(track):
if track.isAnimated():
for j in range (0,2):
anim = track.animation(j)
keys = anim.keys()
scaleFactor = 4
while keys:
keys.pop().y *= scaleFactor
#i am sure there is a much nicer way of iterating over all the knobs but this worked for what i quickly needed
t1 = a['track1']
t2 = a['track2']
t3 = a['track3']
t4 = a['track4']
scaleMe(t1)
scaleMe(t2)
scaleMe(t3)
scaleMe(t4)

set bbox to “B” for nodes inside all Group nodes

import nuke
def bboxGroup():
for b in nuke.allNodes():
if b.Class()=="Group":
for a in nuke.toNode(b.name()).nodes():
classTypes =['Merge','Keymix','Copy',]print a.name()for n in classTypes:
if n in a.Class():
try:
for p in a['bbox'].values():
if'B'in p:
a['bbox'].setValue(a['bbox'].values().index(p))except:
pass

import nuke
def bboxGroup():
for b in nuke.allNodes():
if b.Class() == "Group":
for a in nuke.toNode(b.name()).nodes():
classTypes = ['Merge' , 'Keymix', 'Copy', ]
print a.name()
for n in classTypes:
if n in a.Class():
try:
for p in a['bbox'].values():
if 'B' in p:
a['bbox'].setValue(a['bbox'].values().index(p))
except:
pass

“Autowrite” node
Copy the following line into the python “beforeRender” field in a write node.
The write node’s “file” field will be filled based on the script’s name/path.
Obviously this all depends on your pipeline etc.

For my current situation each vfx shot has it’s own directory, which is then populated with “renders” & “scripts” subdirectories.
So for me I can do this:

find all the TimeOffset nodes in a Group called “Group2”, and change the value of each offset based on it’s position in the array of found time offsets

tos =[]for a in nuke.toNode('Group2').nodes():
if a.Class()=='TimeOffset':
tos.append(a)for b in tos:
b['time_offset'].setValue(tos.index(b))

tos = []
for a in nuke.toNode('Group2').nodes():
if a.Class()=='TimeOffset':
tos.append(a)
for b in tos:
b['time_offset'].setValue(tos.index(b))

set the ‘bbox’ for any selected Merge, Keymix & Copy nodes to “B”

for a in nuke.selectedNodes():
classTypes =['Merge','Keymix','Copy',]for n in classTypes:
if n in a.Class():
for p in a['bbox'].values():
if'B'in p:
a['bbox'].setValue(a['bbox'].values().index(p))

for a in nuke.selectedNodes():
classTypes = ['Merge' , 'Keymix', 'Copy', ]
for n in classTypes:
if n in a.Class():
for p in a['bbox'].values():
if 'B' in p:
a['bbox'].setValue(a['bbox'].values().index(p))

remove all animation from a selected nodes

for a in nuke.selectedNode().knobs():
nuke.selectedNode()[a].clearAnimated()

for a in nuke.selectedNode().knobs():
nuke.selectedNode()[a].clearAnimated()

add keyframes – animate a mix

for a in nuke.selectedNodes():
a['mix'].setAnimated()
a['mix'].setValueAt(1,nuke.frame())
a['mix'].setValueAt(0,(nuke.frame() - 1))

for a in nuke.selectedNodes():
a['mix'].setAnimated()
a['mix'].setValueAt(1,nuke.frame())
a['mix'].setValueAt(0,(nuke.frame() - 1))

Great work Adam,
being late for the party, found out your nuke forum now only.
I have a query:
How to get the paths in Read nodes and if anyone updated, how to reload that again in the scene, without reloading the whole scene

I´ve read some of your really nice python scripts and i´m actually trying to make some scripting by my self too -i confess i´ve just started-. Well i´m trying to write some script (it has to be really easy) to set all my Roto´s output to “none”. I have something like this, but i don´t know how to keep on.. Could you give me a hand?
thnx in advance!

hi Adam thx alot ,i had an issue . i need to random color for rotopaint node,.inside it i had root layer under had name of object,character so i need to set value for each shapes increase or decrease order.,

How to apply DIFFERENT Feather Falloff amounts at EACH Control Point?
Hello Adam and Forum members,
sorry for the topic diversion but i hoped for any and all help or suggestions toward an answer very useful to a large number of Nuke users.

By using Ctrl + L.drag on a Roto Control Point a feathered edge is created with Greyscale falloff from the Roto control point to the Feather control point.
1) Using Nuke-Python script or coding, plugins, any method or different software: How to apply DIFFERENT Feather Falloff amounts at EACH Control Point instead of one falloff value for the entire shape?, ie: PER CONTROL POINT, Variable Transparency or Falloff.

I bring another silly python question that you probably may kindly want to answer..well, pretty simple i think:

I have a NoOp node with a custom floating attribute which controls a switch node. Then i created a python script buttom in a Write node so that if my NoOp1.switcher(the name of the attribute) == 1, then my Write1.file_type = ‘jpeg’, else = ‘dpx’..

Actually what i need is in need to change roto whote color random Increase or decrease Look like u did like constant Script. i am digging with It. i need to use that for more than 200 Shapes under one root roto layer.

Hi Adam, great post.
i wanted to ask, a question, how to detect, selected shape or curve from roto or rotopaint node from root layer. thanks for hint.
i m here…
n = nuke.selectedNode()
nodec = n[‘curves’]
nlayer = nodec.rootLayer
elements = []
getElements(nlayer)
for each in elements:
print each.isSelected() # this line not working, any idea.?

hey mate, does the “getElements” function have anything to do with the issue?
When you say that the last line isn’t working what is happening?
I imagine that the last line is actually indented of course.
Cheers!

i am sure, last line >> ‘isSelected() was my guess based on maya or max… may be they have exposed that property. but it didn’t
good thing is found this
for selShape in selNode[‘curves’].getSelected():
and it works.