Extensions and cooking

So i run into this issue and can’t wrap my head around it. Is probably not a bug but logic i don’t really understand.

See attached example project to demonstrate the behaviour.

There is a ScriptChop that should only cooks when the input changes. In this cook it should run a Extention function from the parent called Test Function

def onCook(scriptOp):
	scriptOp.copy(scriptOp.inputs[0])
	parent().TestFunction()
	return

This function is simple. Print the value of parent parameter called Float:

	def TestFunction(self):
		print(parent().par.Float)

This all works fine and as expected.

But when i change the value
Ext_Cook.toe (4.9 KB)
of the Float parameter my ScriptChop starts to Cook. Why?

Found a solutions by using:

run('parent().TestFunction()',endFrame=True)

instead of

parent().TestFunction()

But i’m still wondering why it happends.

Read up on cooking and what results in cooking:

The gist is, what inherits a dependable becomes a dependable.
The change of the parameter is pushing a cook-command up the cookChain. It is like this physics toy.
Par-Change → TestFunction → Callback → ScriptDat
By using the endOfFrame dohicky you decouple the dependency-chain and break it.

1 Like