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
10 Mar 2011
407
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   

 
# Howard Jones 2010-08-29 05:45
Brilliant - Been on my Nuke wish list for years
 
 
# Hugh Macdonald 2010-10-02 08:35
Hi Jesse,

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.
 
 
# Jesse Spielman 2010-10-25 14:54
Thanks Hugh! I've learned a lot from reading your scripts over the years, so it's nice to get some advice on one of my own. In my testing, I see you're absolutely right. But I'm not sure why setting the single value fixes that problem? Can you explain what that command is doing there? Why would setting the single value fix the problem for an array knob?

Thanks!
 
 
# Hugh Macdonald 2010-10-25 15:10
Thanks Jesse! Always (well, generally!) happy to help out...

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.
 
 
# Jesse Spielman 2010-10-25 15:24
I see...so singleValue() returns True or False based on whether it _IS_ a single value, and not a single value representation. ...that was my guess based on the function name. That makes sense. Version 1.1 is uploaded, crediting you! Thanks!
 
 
# Michael Habenicht 2011-02-07 10:48
Hi Jesse, thank you very much, very helpfull script.

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!
 
 
# Jesse Spielman 2011-03-10 10:40
Thanks Michael. Fixed.
 
 
# Hugh Macdonald 2011-11-14 02:02
Gotta love web interfaces trying to avoid being hacked....

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...
 
 
# Hugh Macdonald 2011-11-14 02:13
Also, I've had to update the exclusion list at my end:

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)
 
 
# K T 2017-02-13 05:03
Another update to the exclusion list -

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.
 
 
# chris menz 2012-03-30 05:25
added inpanel=False to the new = nuke.createNode (original.Class (), inpanel=False ) line to avoid having the panel popup

full code with Hughs suggestions added in:
http://pastebin.com/JFaVgyX8
 

You have no rights to post comments

We have 3153 guests and 72 members online