Ivan,

Yeah, it was simplified (and not very accurate…). Here's basically the kind of 
thing I ended up with...

def knobChanged(self, knob):
                if  nuke.thisKnob().name() == 'prefix':
                        self.do_part_filtering()
                        self.viewname_filter_mashup()
                elif  nuke.thisKnob().name() == 'contains':
                        self.do_part_filtering()
                        self.viewname_filter_mashup()
                elif nuke.thisKnob().name() == 'clear_filters':
                        self.clear_views_filters()
                        self.viewname_filter_mashup()
                elif nuke.thisKnob().name() == 'config_images':
                        self.use_part_selection_as_filter()
                        self.viewname_filter_mashup()
                elif nuke.thisKnob().name() == 'exterior_colors':
                        self.viewname_filter_mashup()
                elif nuke.thisKnob().name() == 'interior_colors':
                        self.viewname_filter_mashup()
                elif nuke.thisKnob().name() == 'finishes_colors':
                        self.viewname_filter_mashup()
                elif nuke.thisKnob().name() == 'pick_a_view':
                        
self.active_viewer.setView(self.view_selector_knob.value())


Rich


On May 7, 2013, at 12:32 PM, Ivan Busquets <ivanbusqu...@gmail.com> wrote:

> Unless your code example above is just a simplification of your actual code, 
> you're only testing for existence of the knob in each "if" statement.
> 
> Instead, you want to test if the knob is the same that triggered the 
> knobchanged event:
> 
> if a_knob == knob:
> 
> ...
> 
> if b_knob == knob:
> 
> ...
> 
> if c_knob == knob:
> 
> ...
> 
> 
> 
> 
> On Tue, May 7, 2013 at 9:26 AM, Rich Bobo <rich.b...@armstrong-white.com> 
> wrote:
> 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:  richb...@mac.com
> 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
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
> 
> 
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to