Custom operator doesn't cook when changing settings through Python


I have some custom C++ operators that only need to cook when they’re activated, which can be toggled using a custom parameter called Active.

Basically this is implemented by the following logic in the getGeneralInfo method:

void MyCustomOp::getGeneralInfo(DAT_GeneralInfo* ginfo, const OP_Inputs* inputs, void* reserved)
	ginfo->cookEveryFrame = static_cast<bool>(inputs->getParInt("Active"));

Normally this works great. When the Active parameter is activated, the OP cooks, cookEveryFrame is set to true and it will keep cooking.

However, when the custom operator is in a different part of the network and the Active parameter is changed through Python, the OP never cooks to react on the parameter change. It will only start and keep cooking when navigating to the part of the network where the operator is.

Hello @navFooh and thanks for the report.

I have logged an issue for a developer to look into it.


1 Like

TouchDesigner is a pull base system, which means the nodes only cook when their data is requested. In this case when you are in the same network you are looking at the viewer, which causes the node to cook. More info about why a node cooks here:

So setting a parameter does not cause a node to cook if nothing is using the node’s data, and your cookEveryFrame flag is turned on when a cook happens. The easiest fix for this is to request a node cook after you change your Active Parameter. Hope that helps.

Hi @selina ,

Thanks for the information, we should be able to find a way to work around this.

Kind regards,