This is one of the reasons it’s good to keep references to your panel’s knobs
on the panel instance.
def knobChanged(self, knob):
if knob is self.a_knob:
something = self.a_knob.value()
elif knob is self.b_knob:
print 'that was the b knob'
-Nathan
From: Rich Bobo
Sent: Tuesday, May 07, 2013 9:26 AM
To: Nuke-Users Mailing List List Postings ; Nuke Python discussion
Subject: [Nuke-python] knobChanged question...
Hi,
This is probably a very elementary question, but I can't quite wrap my head
around it…
I have a Python_Panel with four knobs on it: three Enumeration_Pulldown knobs
and a PyScript_Knob. I have added them all to a knobChanged method. I am using
something like this for my checking:
def knobChanged(self, knob):
if a_knob:
set_something = a_knob.value()
if b_knob:
set_something_else = b_knob.value()
if c_knob:
set_another_thing = c_knob.value()
if d_knob:
run_a_method()
You will probably notice that each time a knob is changed, all of the
statements are executed, including the run_a_function(). I'm sure this is from
"Programming 101", but how do I isolate the knob changed events, so that *only*
the one that has been changed is executed…?
Thanks for any help!
Rich
Rich Bobo
Senior VFX Compositor
Armstrong-White
http://armstrong-white.com/
Email: [email protected]
Mobile: (248) 840-2665
Web: http://richbobo.com/
"Destiny is not a matter of chance, it is a matter of choice; it is not a thing
to be waited for, it is a thing to be achieved."
- William Jennings Bryan
--------------------------------------------------------------------------------
_______________________________________________
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