Ean might have already answered this, but what about when the knobChanged code is baked into a node? For example, I have a gizmo with a couple of actions that run when specific knobs are changed, but all the code show up in the script editor every time I select the node.
n = nuke.thisNode() k = nuke.thisKnob() if k.name() == "size": print "Changing blur size." I only like the script editor to show me the actual result of the code, so if the "size" knob is changed, it should print "Changing blur size", otherwise nothing should happen. I guess I could add Eans suggestion to my meny.py somehow, but it would be nice to have the code baked to the node. Thanks! 2012/6/10 Ean Carr <[email protected]> > Hey, > > Not sure if it's the smartest way, but I'm in the habit of doing > exactly this in the fist few lines of most of my callback functions: > > tn = nuke.thisNode() > # Filter out unwanted knobs > if tn.name() in ['xpos', 'ypos', 'selected']: > return > > I always make sure to put it at the very beginning of my function and > it helps limit the slowdowns you're talking about. I'm not aware of a > way to filter out knobs outside of the callback function itself, or > even if that would result in much speed boost. > > If I want to limit the number of times a callback is triggered, I make > a hidden boolean knob and check whether to return or not depending on > its value at the very start of the function. > > Pretty sure both these practices are fairly standard among the > pipeline TDs out there. > > Hope that helped. > > Cheers, > -Ean > > On Jun 10, 2012, at 12:28 PM, "jrab" <[email protected]> > wrote: > > > Hey there - > > > > Just wondering if there is a smart way to easily limit the number of > times the knobChangeds callbacks are pinged - for instance, I really don't > want the callback to even think about being run if the knobChanged is a > select or xpos or ypos. It seems like if there are more than a few > knobChangeds callbacks, these can add up in wasted cycles and bog the UI a > bit, even if each function specifies which knob to use. > > > > Specifically, I have one callback that needs to generate the list of > knobs used each time after it's called, since there are a bunch of > dynamically created knobs that change with each node. If I could turn off > the call to the callback for all the default knobs, it seems like it could > help speed up things a little bit. Maybe as a starter, is there a simple > way to get the default gizmo knobs and exclude them? > > > > thanks > > JRAB > > _______________________________________________ > > 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 >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
