On Feb 7, 2012, at 9:38 AM, Dave Russell wrote: > It seems that the only place to implement the functionality is in the > _validate() function, where the file is read, and data controlling both > camera internal and transform parameters is written to the camera knobs with > set_values(), and also directly to the CameraOp itself.
I would avoid that in _validate() as you can cause infinite loops depending on the knob_changed() behavior, and often the updating of the knobs is not reliable when executing the script as opposed to gui mode. I've found the most reliable place to do this is in the knobs() method - usually at the end of the method. You need to test whether knobs() is being called in initialization mode (makeKnobs()) because the knobs don't actually exist when makeKnobs() is true. When makeKnobs() is false then the knobs() call is basically used to store knob values (overwriting the Op's local vars) and this is exactly when you should be modifying your local values. I usually use either Knob::from_script() or Knob::store() for this purpose - Knob::store is particularly useful if you need a specific context out of the knob. Sometimes I need to test whether Nuke is in gui mode and switch between using from_script() and store(). Pay particular attention to string knobs as they allocate their own storage, so you may need to delete the const char* var first before having the knob store. -jonathan > If you don't write directly to the CameraOp as well, then the observed > parameters lag behind the frame number. I assume this is due to Nuke's > calling order. > > But since version 6.3v1, the node causes Nuke to hang whilst gobbling up all > available system memory. > > Moving the knob-setting calls to updateUI() makes everything work fine, but > ONLY if the node control panel has been opened. The knob values are > potentially used by expressions on other nodes. > > So the question remains: > Is it legal/advisable/verboten to call knob->set_values() from within > _validate(), and if not, how else could the required functionality be > achieved? > > It would be good if The Foundry could give a definitive response on this > point. > > Any feedback would be much appreciated. > Many thanks > Dave. > _______________________________________________ > Nuke-dev mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev _______________________________________________ Nuke-dev mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
