nShakeClone v1.3
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Jesse Spielman
Automates the creation of a (Shake style) unidirectional clone
Requirements:
6.0, 6.1 or later
Linux, Mac, Windows
6.0, 6.1 or later
Linux, Mac, Windows


Take all selected nodes and create duplicates that are linked via expressions to the original for all knobs except those in an exclusionList...there may be value in defining different exclusionLists per node class...
Please login in order to download these files.
Comments
I've been meaning to write something like this for Nuke for a while now...
One small bug fix for it, though:
After:
new.knob(i).set[removed]original.name()+"."+original.knob(i).name())
You should probably have:
if isinstance(new. knob(i), nuke.Array_Knob):
new.knob(i).setSingleValue(original.knob(i).singleValue())
Otherwise, if you clone something like a Grade node, it won't properly link the colours together.
Thanks!
In something like a Grade node, most of the knobs are RGBA knobs, so they take 4 values, but fault to being a single value across all 4. If you don't call setSingleValue( False), then where your original node might have separate values, the new one will just have a single value across the board.
Only all the String Knobs are not linked as setExpression has no effect on them.
so I did this change to make it working:
Replace this line:
new.knob(i).set[removed]original.name()+"."+original.knob(i).name())
with this:
if isinstance(new. knob(i), nuke.String_Knob):
new.knob(i).setValue("[value %s.%s]" % (original.name( ), original.knob(i).name()))
else:
new.knob(i).set[removed]original.name()+"."+original.knob(i).name())
So this way all the knobs that are an instance of the String_Knob get the tcl expression as value and are therefore also linked properly.
Best regards!
new.knob(i).set[removed]original.name()+"."+original.knob(i).name())
I'm guessing that "Expression" followed by "(" is classed as a potential hack then...
exclusionList = ["xpos", "ypos", "help", "hide_input", "note_font_colo r", "onCreate",
"updateUI", "knobChanged", "note_font", "tile_color", "selected",
"autolabel", "process_mask", "label", "onDestroy", "inject",
"indicators", "maskFrom", "maskChannelMas k", "maskChannelInp ut",
"Mask", "postage_stamp" , "disable", "maskChannelMas k", "panel",
"maskFromFlag", "name", "cached", "fringe", "maskChannelInp ut" ,
"note_font_size ", "filter", "gl_color", "transform", "dope_sheet",
"postage_stamp_frame"]
Previously, if you shake-style clone a node, and then copy the clone, you would get:
Blur1_clone1.postage_stamp_frame: Nothing is named "Blur1"
I think that this is a new knob that was introduced in Nuke 6.3. I also added in dope_sheet, as the node doesn't think that this should be animated.
The other bit of code that I've added into my local one is, after this line:
new['selected'].setValue(False)
To have this, which changes the name to imply that it's a clone:
newNameFormat = "%s_clone%%d" % original.name()
i = 1
while nuke.exists(new NameFormat % i): i += 1
new.setName(newNameFormat % i)
lifetimeStart
lifetimeEnd
useLifetime
So the full exclusion list would now be -
EXCLUSION_LIST = ["xpos","ypos", "help","hide_in put","note_font _color","onCrea te","updateUI", "knobChanged"," note_font","til e_color", "selected","aut olabel","proces s_mask","label" ,"onDestroy","i nject","indicat ors","maskFrom" ,"maskChannelMa sk","maskChanne lInput","Mask", "postage_stamp" ,"disable","mas kChannelMask", "panel", "maskFromFlag", "name","cached" ,"fringe", "maskChannelInp ut" , "note_font_size " , "filter", "gl_color","tra nsform", "postage_stamp_frame","dope_sheet","lifetimeStart","lifetimeEnd","useLifetime"]
I haven't fully tested it, but I had to open open my .nk file and delete the lines with those strings to recover it.
full code with Hughs suggestions added in:
http://pastebin.com/JFaVgyX8
one thing i came across that might be helpful for you as well:
in stead of listing all the hidden knobs, find them programatically . could be done like this:
#find all hidden knobs
hiddenKnobs = []
for i in nuke.toNode(nod e).knobs():
if nuke.toNode(nod e).getFlag(0x00 000400):
hiddenKnobs.append(i)
''node' is the name i'm grabbing from a list of the selected nodes. (indents dont seem to work here, but im sure its obvious)
RSS feed for comments to this post