Hi,
I'm pretty new to Nuke, so forgive me if the following question is a non-sense in a "nuke" way of thinking...

I'm facing an incomprehension of the way Nuke is computing/updating all its stuffs.
When executing a Python script on a Nuke script, python does not seem to update/evaluate knobs values as often as I would have liked it to.

Following script and output will hopefully give you a simple idea of what I mean :

print 'start current :', nuke.frame()
node = nuke.toNode('AnyNodeName')
knob = node.knobs()['AFloatSliderKnobWithExpression']                                # this knob's value "expressed" either with  tcl 'frame' or python 'nuke.frame()' leads to the same result
for aframe in xrange(101, 105):
   nuke.frame(aframe)
   print 'set nuke.frame to :', aframe, '/ then nuke.frame() gives', nuke.frame(), '/ but knob.value() says', knob.getValue()

# Result: start current frame : 101
set nuke.frame to : 101 / then nuke.frame() gives 101 / but knob.value() says 101.0
set nuke.frame to : 102 / then nuke.frame() gives 102 / but knob.value() says 101.0
set nuke.frame to : 103 / then nuke.frame() gives 103 / but knob.value() says 101.0
set nuke.frame to : 104 / then nuke.frame() gives 104 / but knob.value() says 101.0

Once the script is executed and a new "knob.value()" is launched, the result is finally coherent with a value of 104.0
This leads to ask questions about the update mechanisms :
I already understand that GUI elements such as Viewers and Properties panel can help to launch an update, but first this GUI update is a sort of "asap-on idle" one, not immediatly reliable, and last but not least, my script runs in batch mode...
I also understand that we don't want 'engine' methods to be launched when not needed, but would there be a special command, a flag, a magic trick to force refresh when querying knobs values.
In fact all queries such as knob.value(), node.metadata() (containing nuke's time dependent key 'nuke/node_hash', as well as user generated ones) not involving an 'engine' execution may be (re)evaluated at the actual frame...
Seeing the knob updating in its Properties panel, without any viewer opened and without any compute lag, I just can't imagine not being able to have the same through a python command ;)

Thanks in advance for your advices !
L.



_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to