Send out a op('xyz').cook(force = True) from Custom OP (C++ Chop)

what would be the best way to send out some op(‘xyz’).cook(force = True) python commands - based on the operators custom_paramater changes - to cook some named operators in the network ?

as example
if (par_x != 0) { send out op(‘xyz’).cook(force = True) }

callback?

You’d need to do this within a callback. However, in general nodes shouldn’t be forcing other nodes to cook. We don’t do this anywhere in our nodes.
If you need to do that then something else is likely the issue. The cook engine should manage this for you already.

hi. thx for reply.

in that case i send out some “sample” values from my node. they go into the length parameter of pattern or s_curves and the values of that curves comes back in. so i have an dependency loop. i first had the auto.cook() in the pyGetSets set to true. worked fine. but i do not need the auto.cook on true. so i set it to false.

BUT - if set to false the getValue goes out but does not force the target to cook.

so i need to force the node to cook by myself, - i do that now with an parexec and an opexec. that works great.

and i thought, why not send out the op.cook direct from my custom op so that i do not always have to setup the execute dats. cause - the target should only cook one time at parameter change and at numSamples change.

but maybe there is something wrong with the auto.cook = false. maybe that also should cook the target node by sending the getValue out. i don’t know :slight_smile:

in my case, i like to have the option to choose by myself if cook or not :slight_smile:

Things will be really unstable any time you try to work with a dependency loop. To do this you’ll need to use a Feedback CHOP. The value comes out of your C++ CHOP and is used by the Pattern CHOP, that should go into a Feedback CHOP, and that should go into the input of the C++ CHOP or into a parameter.

the feedback chop i had - and i had to put a null switched to selective mode after, cause the only use of feedbackchop caused the nodes to cook all the time.

thats why i switched auto.cook in the custom operators python section to false. i was a little bit surprised, that there was absoluteley no cooking after sending the data. so i installed paraexec and a opexec DAT to monitor and force. that works without any dependency-loop-issues. so i planed to implement that force of cook into the python callback.

what i’m not shure is: is it really correct, that the auto.cook = false does not force the target node to cook? - never? so - how will the node that should get the python values update? - when there is no force to cook? only in auto.cook = true mode.

You’ll want to read this article I think:

The key is, data is not pushed to nodes. Cooks are a pull operation, not a push operation. Changing the value that is written to/exported onto a parameter does not cause the node to cook. It’ll cause it to be ‘dirty’, and if someone else asks for it’s data, then it’ll cook, but not if nobody needs the data.

1 Like

ok :slight_smile: that article ive “forgotten”. i read it some time ago …

so - here i have the case, that the node that pulls the data to another node is also the node that gets the data back. there are no other nodes involved. so i think, a force to cook is in that case the way to go. via tha python callback. so i do not need the paraexec and the opexec on the outside.

thank you a lot for making that clear to me.