Script CHOP

From TouchDesigner 099 Wiki

Summary

The Script CHOP runs a script each time the Script CHOP cooks. By default, the Script CHOP is created with a docked DAT that contains three Python methods: cook, onPulse, and setupParameters. The cook method is run each time the Script CHOP cooks. The setupParameters method is run whenever the Setup Parameter button on the Script page is pressed. The onPulse method is run whenever a custom pulse parameter is pushed.

Refer to Help -> Python Examples, and Help -> Operator Snippets.

Note: Every time that a Script OP runs it will make a list of operators, parameters, nodes etc that it depends upon, and when they change, the Script OP will re-cook.

See also: Script DAT, Script SOP

PythonIcon.png scriptCHOP__Class

Parameters - Script Page

Callbacks DAT /callbacks - Specifies the DAT which holds the callbacks.

Setup Parameters /setuppars - Clicking the button runs the setupParameters() callback function.

Parameters - Custom1

This is the page where the example parameters in the default script are created. You can create your own Custom Parameters and assign them to different pages.

Default Functions

These functions are included in the default script located in the docked node script1_script.

 # me - this DAT
 # scriptOp - the OP which is cooking
 
 # press 'Setup Parameters' in the OP to call this function to re-create the parameters.
 def setupParameters(scriptOp):
 	page = scriptOp.appendCustomPage('Custom')
 	p = page.appendFloat('Valuea', label='Value A')
 	p = page.appendFloat('Valueb', label='Value B')
 	return
 
 # called whenever custom pulse parameter is pushed
 def onPulse(par):
 	return
 
 def cook(scriptOp):
 	scriptOp.clear()
 	return