A one-liner example
[s['which'].setValue(1) for s in nuke.allNodes('Switch', nuke.root()) if
s.name().startswith('switchEngFre')]
-Nathan
From: kylesim
Sent: Tuesday, November 01, 2011 10:15 PM
To: [email protected]
Subject: [Nuke-python] nuke.toNode question
Apologies is this is an overly basic question, but I searched the forums and
couldn't find anything directly related to what i'm trying to figure out.
To keep it short, is there a way to use nuke.toNode to set the values of a knob
to multiple nodes that contain a certain name, and not just the whole class
itself? To clarify - Lets say I have 3 switches, 2 of which both have english
and french versions of text nodes. These 2 switches I have named
"switchEngFre1" and "switchEngFre2". The third switch I don't want to affect so
I kept it's name the default of "Switch".
I would like to have an "english" Write node, and a then a "french" Write node
with python controlling the two "switchEngFre1" and "switchEngFre2" switches at
render time. I've got this working for the value of one of the switches by
calling it by name directly using
nuke.toNode('SwitchEngFre1').knob('which').setValue(1) in the write nodes
python tab.
But is there a way to do a filter or similar to affect ALL of the nodes
containing the name SwitchEngFre? (something like SwitchEngFre*)?
My example above is pretty trivial, but more realistically I'm talking about
having 20 or more switches at once so to call or edit each one manually is
going to be... tedious.
I'll probably just parent all the child engFre switches to one master
controller switch, but I was sort of curious if this could be done using the
method above.
thanks
-k
--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python