Hi Jesse,

thanks for the answer.
Sorry my mail was a bit messy.
I do call a python function in the write nodes file knob, with [python writeFunction.call()].

This gets called many times, a bit like the knobChanged callback... so I thought this is a bad thing.
And we are having freezes with it too.

Now, I changed it into a callback.
the callback code looks like this:

def writeNodeUpdates()
    try:
        write = nuke.toNode('Special Write')
    except:
        nuke.tprint('no special write found')
    else:
        output = nameGenerator()
        write['file'].setValue(output)

I was interested which callback I should use.
1.onScriptSave
2.autolabel
3.updateUI
4.knobChanged (suggested by you)

I could tie it to knobChange too, but that puts me a bit where I started.
It gets evaluated on every change...
For the moment I put it on onScriptSave.
As this is also quite logical, as one cannot render without saving first.
And having ctrl+s as the "setter" is also nice....

Good to know you used the knobChanged callback for this.
Thanks for the input

Johannes










Am 1/24/14 19:19 PM, schrieb Jesse Kretschmer:
If I understand correctly, you added a knob changed callback and it slows nuke down.

The knobChanged callbacks will get called very frequently in the UI. It's important that you filter the incoming knob changes and exit the function as soon as possible. Every time a node is move, the callback will get called. I just sketched up an example to prove this (http://pastebin.com/zpa2tXtA). Just by selecting a node and moving it a small bit, you can see my callback is run nine times in less than half a second.

10:10:11.499000: Constant1.selected

10:10:11.499000: Viewer1.selected

10:10:11.578000: Constant1.xpos

10:10:11.586000: Constant1.xpos

10:10:11.597000: Constant1.xpos

10:10:11.613000: Constant1.xpos

10:10:11.630000: Constant1.xpos

10:10:11.646000: Constant1.ypos

10:10:11.663000: Constant1.xpos


The docs shot some good examples of testing the name() of the knob, and you should probably test the node.Class() to make sure you only run on "Write" nodes.

http://docs.thefoundry.co.uk/nuke/70/pythondevguide/callbacks.html#knobchanged


All that said, I've created write file knob filters in production and not had performance issues. Look back at your code and see if it could be more efficient. It would also be nice to see an example of your callback code if you want some help making it more efficient.


Cheers,

jesse



_______________________________________________
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



____ ESET 8964 (20131025) ____
The message was checked by ESET Mail Security.


-- 
STUDIO RAKETE GmbH
Johannes Hezer, Compositing TD & Stereoscopic SV
Schomburgstr. 120
D - 22767 Hamburg

j.he...@studiorakete.de
Tel:+49 (0)40 - 380 375 69 - 0
Fax:+49 (0)40 - 380 375 69 - 99

------------------------------------------------------
Pflichtangaben laut Handelsgesetzbuch und GmbH-Gesetz:

STUDIO RAKETE GmbH
Schomburgstr. 120 D - 22767 Hamburg

www.studiorakete.de / i...@studiorakete.de

Geschaeftsfuehrer: Jana Bohl

Die Gesellschaft ist eingetragen im Handelregister des
Amtsgerichts Hamburg unter der Nummer HR B 95660
USt.-ID Nr.: DE 245787817


____ ESET 8964 (20131025) ____
The message was checked by ESET Mail Security.
_______________________________________________
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