Reacting to change in allowCooking within a component

Hi there,

I have a show coming up and I’m using a switch TOP to move between different components. Each of them is pretty costly so I want to deactivate cooking for the components that aren’t being shown directly to the screen at one time.

I know how to manage the allowCooking flag programmatically but I haven’t figured out how to give the component a sense that it has just “changed it’s state” using only the allowCooking flag. I’d rather not have to add a custom init pulse to each component because it seems like there should be some way to listen for an event like “just started cooking again”. The closest I got was the DAT op execute operator that can listen for a flag change, but that wasn’t able to work from inside a component that has just had cooking reset.

Does anyone know of a way to accomplish this kind of thing?

Hey @humbletang , you really should not disable components using the allowCooking flag. It will cause stutters when you reenable cooking, and is considered bad practice.

Instead look at the sceneChanger in Palette for an example how you can change scenes. It has a pretty extensive tutorial. It uses TD’s built-in method where it only cooks nodes if their data is requested (TD is a pull-based system).
Recommended reading: Cook - Derivative (one of the most important pages in the wiki IMHO)

In your case once you set the Switch TOP to index 0, and your turn of the viewer panel for the other scenes, you’ll probably see the wires from the other scenes stop animating, which means they don’t cook anymore. You can use that same principle to stop cooking in all parts of a network you don’t use.


Thanks so much for helping me out with this! Yup I had no idea that this comp existed, and reading the description it sounds like it could have saved me making up my own way to crossfade between effects too. Shoot! good practice I guess?

I’m also really glad that the sceneChanger also resolves the issue with stuttering. I found that weird behavior from feedback TOPs were sometimes the result of doing disable/enable of cooking and I’ll write back if this continues.

I guess it’s also time to truly try to understand the cook documentation. Thanks for posting that too!

I notice that the “length” scene parameter isn’t used by the sceneChanger and this would be very helpful for specifying when a scene should transition. Would you suggest that I create a timer at the level of the sceneChanger that is responsible for triggering sceneChanger “next scene” pulses if I wanted to step through the scenes? This thing is almost everything I had made on my own which is great!