RESOLVED: Script CHOP not updating parameters in def onSetupParameters(scriptOp):

It appears you can’t set parameter values within the onSetupParameters function.
As you can see in the img below, the print statement works but it’s skipping over the code that sets the parameter values.

def onSetupParameters(scriptOp):
	page = scriptOp.appendCustomPage('Parameters')
	p = page.appendFloat('Valuea', label='Value A')

	scriptOp.par.Valuea = 5
	op('script1').par.Valuea = 5
	print('hi')
	return

Hi.

The behavior of this callback was changed a while back to preserve the current values of the parameters. Often users would press ‘setup’ and lose expressions etc.
One thing you might consider, is setting the default value of the parameter, then you can always right click on it and ‘Reset Parameter’ to get to a known state.

Ideally preservation of the values should be ignored when the callback is intentionally settting values, such as in your case. We’ll make a note to improve that behavior in our database.

[EDIT: This will be fixed in a future build of TouchDesigner]

Cheers

1 Like