Hi all, I've recently come across the following problem.
Let's say I've got something that I want to run during the first knobs() pass after the makeKnobs() pass. So, in knobs(), I have something like this: if (!f.makeKnobs() && m_firstTime) { m_firstTime = false; // m_firstTime is a member variable that's initialized to "true" in the constructor call_my_function_here(); // the function sets some knob values, btw } This used to work fine for me in 6.2. In 6.3, myfunction gets called multiple times for each node, particularly when the node has animated knobs. I "suppose" this comes from the node spawning multiple Ops, but I'm confused because this didn't seem to happen in 6.2? I've seen that 6.3 seems to split Ops more often (when they're upstream of a Transform with motionblur turned on, for example), but I'm not sure whether that's an intended change or a misbehaviour... In any case, the function I call in there is expensive, so it is a big deal if it's called multiple times. Is there a better way to approach this? Basically what I want is to call something, only once, as early as possible (or in the earliest stage where I can set knob values). As a workaround, I am now resorting to storing m_firstTime in a hidden knob with both the EARLY_STORE flag (so that if my Node spawns multiple ops they'll get the right value for m_firstTime), and the DO_NOT_SAVE flag (to force m_firstTime back to "true" when the node is created, reopened, or copy pasted). So, I now have something like this: void knobs(Knob_Callback f) { [....] Bool_knob(f, &m_firstTime, "first"); SetFlags(f, Knob::EARLY_STORE | Knob::INVISIBLE | Knob::DO_NOT_WRITE); if (!f.makeKnobs() && m_firstTime) { knob("first"->set_value(false); call_my_function_here(); } } This seems to work (as in, that portion of knobs() seems to be called just once now), but I'd like to know if there's a more elegant way to do this, or a better strategy altogether. Thanks, Ivan
_______________________________________________ Nuke-dev mailing list Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev