Are there any speed improvements in defining the knobChanged upon launch
compared to adding the code directly to the knob?


2013/5/17 Jacob Harris <jacob.har...@methodstudios.com>

>  We often define a global knobChanged callback on launch -- 
> nuke.addKnobChanged(outsideModule.function,
> nodeClass="Group"). This of course causes every Group node to trigger a
> callback BUT we'll hide a knob in the one we're actually targeting and
> filter it outside of Nuke.
>
> def nodeUpdate():
>     n = nuke.thisNode()
>     k = nuke.thisKnob()
>     if "SecretKnob" in n.knobs():
>         if k.name() == "myButton":
>             myFunction()
>
> Doing this allows us to use Python buttons with no code inside. It's great
> for keeping certain node classes consistent across shows.
>
>
>
> On 05/16/2013 09:05 AM, Nathan Rusch wrote:
>
>  If you have a gizmo, I would go one step further and use the callback
> registration mechanism instead of the 'knobChanged' knob. Also, if you’re
> reading a file when the panel is shown, I would cache your results and some
> indicator that the file has been read already. You can provide a 'refresh'
> button if need be to manually re-read the file and re-cache the data.
>
> -Nathan
>
>
>  *From:* Hugo Léveillé <hu...@fastmail.net>
> *Sent:* Thursday, May 16, 2013 6:14 AM
> *To:* Nuke Python discussion <nuke-python@support.thefoundry.co.uk>
> *Subject:* Re: [Nuke-python] Two questions about callbacks and writing
> python
>
>    I find it easier to edit the code in a dedicated editor. And the gizmo
> will update live when you save your code while developing. Much faster then
> copy/pasting the code everytime in the Nuke script editor to set the value
> again and again...
>
> On Thu, May 16, 2013, at 3:18, Howard Jones wrote:
>
> Is that the best way then? I always write into the knobChanged direct in
> the node. Though via
> s=''' script stuff '''
> ...['knobChanged'].setValue(s)
>
> What's the advantage of keeping it external?
>
> Howard
>
> On 16 May 2013, at 02:03, Frank Rueter <fr...@beingfrank.info> wrote:
>
>
> You probably want to run the code every time the gizmo's panel is opened,
> so look into the knobChanged knob.
> I'd write the python code in an external file and import then execute it
> inside the knobChanged knob.
>
> This might get you started:
> http://pastebin.com/Ca9eMNUQ
>
>
> On 11/05/13 06:36, thinkinmonkey wrote:
>
> Hello everyone,
> I wrote a very simple gizmo in Nuke and I'd love to refine it with your
> help.
> The gizmo simply reads an xml file where I stored some data, the user can
> select a scene/shot from a pulldown choice and he will have the images
> sequence of that scene/shot.
> Everything works, but I'd want to know:
>
> a) When the user create the gizmo from menu, he's forced to click a button
> on gizmo in order to load the xml file, otherwise the gizmo is not able to
> load the image sequence. I want the gizmo load the xml file automatically,
> I tried the callbacks, the "on Create" function, but with no success. Could
> you tell me how to do that?
>
> b) Just to be sure, I put all python code in a python script button knob:
> is that right to program? I mean, if I want to write python functions or
> callbacks that control the entire gizmo, the only solution I have is to
> write then in a button, but they are executed only when user clicks on it,
> isn't? There's another way to create a new node/plugin?
>
> Thanks in advance.
>
>
> _______________________________________________
> Nuke-python mailing listnuke-pyt...@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
>
>
>  --
> Hugo Léveillé
> TD Compositing, Vision Globale
> hu...@fastmail.net
>
>  ------------------------------
> _______________________________________________
> 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 listnuke-pyt...@support.thefoundry.co.uk, 
> http://forums.thefoundry.co.uk/http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
>
>
> This e-mail and any attachments are intended only for use by the
> addressee(s) named herein and may contain confidential information. If you
> are not the intended recipient of this e-mail, you are hereby notified any
> dissemination, distribution or copying of this email and any attachments is
> strictly prohibited. If you receive this email in error, please immediately
> notify the sender by return email and permanently delete the original, any
> copy and any printout thereof. The integrity and security of e-mail cannot
> be guaranteed.
>
> _______________________________________________
> 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