It can be done fairly easily using a Python onKnobChanged callback..
As a really basic (untested) example:
def gang_sliders():
node = nuke.thisNode()
knob = nuke.thisKnob()
# Get value of gang checkbox (True or False)
gang_enabled = node['gang'].value()
if not gang_enabled:
return # do nothing
new_value = knob.value()
# set all the other values
if knob.name() != "grade_red":
node['grade_red'].setValue(new_value)
if knob.name() != "grade_green":
node['grade_green'].setValue(new_value)
if knob.name() != "grade_blue":
node['grade_blue'].setValue(new_value)
nuke.addKnobChanged(gang_sliders, nodeClass = "MyGradeNode")
That should give you the general idea - to make it actually function
like the gang (keep the relative values), you need to know the old and
new value..
To do that, the simplest way I can think of is to have a dictionary
storing the the previous values, e.g:
PREV_VALUES = {}
def gang_sliders():
global PREV_VALUES
node = nuke.thisNode()
knob = nuke.thisKnob()
# Get the previous values for the channel
prev_red = PREV_VALUES[node.name()]['red']
delta_red = prev - node['grade_red']
if knob.name() == "grade_red":
# red channel changed, move blue/green
node['grade_green'].setValue(
node['grade_green'].value() + delta_red)
node['grade_blue'].setValue(
node['grade_blue'].value() + delta_red)
elif knob.name() == "grade_green":
# same thing, but for red/blue
elif knob.name() == "grade_blue":
# and again
# Then at the end, update the previous values
PREV_VALUES[node.name()] = {
'red': node['grade_red'].value(),
'green': node['grade_green'].value(),
[...]
}
Also, you'll need to keep have a callback for when the node is deleted,
which removes the previous values
..okay so maybe "fairly easy" was maybe the wrong way to describe it!
I'm sure there must be an easier or more elegant way to do this... I
guess you could store the previous values in a hidden knob on the node?
ella boliver wrote:
No, I am looking for something that works exactly like the 'gang' button
in the exposure node.
:-)
On Thu, Jun 30, 2011 at 10:51 AM, Julien Chandelle
<[email protected] <mailto:[email protected]>> wrote:
something like that ?
set cut_paste_input [stack 0]
version 6.2 v4
push $cut_paste_input
NoOp {
name NoOp1
selected true
xpos 532
ypos -66
addUserKnob {20 User}
addUserKnob {7 master}
master 0.22
addUserKnob {7 red}
red 0.585
addUserKnob {7 green}
green 0.285
addUserKnob {7 blue}
blue 0.545
addUserKnob {18 color}
color {{master+red i} {master+green i} {master+blue i}}
}
On Thu, Jun 30, 2011 at 4:43 PM, ella boliver <[email protected]
<mailto:[email protected]>> wrote:
Hello,
I am hoping someone can tell me the python to make parameters
move as a gang. For example- we have a custom baselight node
but the red, green, and blue all move independently in the
contrast. We want them to move together and then be able to
break them apart for final tweaks later on. Ideas?
Thanks so much!
Ella
--
digital compositor
www.ellaboliver.net <http://www.ellaboliver.net>
+1 917 657 7070 <tel:%2B1%20917%20657%207070>
_______________________________________________
Nuke-users mailing list
[email protected]
<mailto:[email protected]>,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
--
Julien Chandelle
GSM : +32 (0) 494 277 542 <tel:%2B32%20%280%29%20494%20277%20542>
julienchandelle.be <http://www.julienchandelle.be>
|| Nuke , AE & Fusion Compositor ||
_______________________________________________
Nuke-users mailing list
[email protected]
<mailto:[email protected]>,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
--
digital compositor
www.ellaboliver.net <http://www.ellaboliver.net>
+1 917 657 7070
------------------------------------------------------------------------
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
--
ben dickson
2D TD | [email protected]
rising sun pictures | www.rsp.com.au
_______________________________________________
Nuke-users mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users