Callback for GroupIf it’s just a knobChanged, you can do 
myNode[‘knobChanged’].setValue(“print ‘knobChanged fired...’”).

Otherwise, a fairly generic way to do this is to again have generic callback 
functions that call commands that are actually attached to the node. So you 
could stick your callback code in a hidden PyScript knob and then have the 
generic callbacks look for appropriately-named knobs, and if it finds them, 
exec their .command() return string. This means you only have to set up one 
additional callback structure that will work for as many extra nodes/classes as 
you want to add, but will allow you to attach the actual callback code to the 
node itself.

Hope this makes sense.

-Nathan



From: Ken Boreham 
Sent: Tuesday, June 07, 2011 10:05 AM
To: Nuke Python discussion 
Subject: RE: [Nuke-python] Callback for Group

Ah, so with Gizmo I would filter with nodeClass=’NameOfGizmo’? The groups 
solution works nicely-thanks.

In either case is there any way to embed the callback into the group/gizmo?

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of Nathan Rusch
Sent: Tuesday, June 07, 2011 12:28 PM
To: Nuke Python discussion
Subject: Re: [Nuke-python] Callback for Group

 

This is one of the most popular arguments for using Gizmos over Groups, since 
Gizmos are handled as their own classes. However, being more a fan of Groups 
myself, I’ve previously worked around this by adding a hidden “class” knob to 
any group I want to run callbacks on, and then adding a generic Group callback 
function that uses the value of that class knob to get and call an appropriate 
callback function from a “group callbacks” module.

 

-Nathan

 

From: Ken Boreham 

Sent: Tuesday, June 07, 2011 8:50 AM

To: [email protected] 

Subject: [Nuke-python] Callback for Group

 

I’d like to make a knob changed callback for a group/gizmo that I’m working on. 

-      I can make a global callback and filter it to the nodeClass=’Group’ but 
then it runs on any Group. How do you safely handle this?

-      Creating a global callback requires extra code. How would I distribute 
this? Would it require an extra python script file to be loaded with the group?

Thanks


--------------------------------------------------------------------------------

_______________________________________________
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

Reply via email to