Script SOP

From TouchDesigner Documentation
Jump to: navigation, search


The Script SOP runs a python script each time the Script SOP cooks. It can create, delete and modify points, primitives and their vertices. It can create custom attributes or built-in attributes like uv and N (normals). It can add polygons, bezier curves and meshes among others. It can combine multiple inputs. By default, the Script SOP is created with a docked DAT that contains three Python methods: cook(), onPulse(), and setupParameters(). The cook() method is run each time the Script SOP 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: Because the Script SOP can get data from anywhere, it's difficult to determine what it procedurally depends on. So 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: Geometry Detail, Point, Point List, Point Class, Primitive, Prims Class, Polygon, Vertex, SOP, SOP Class, SOP to DAT, Point Groups, Primitive Groups, Attributes.

See also: Script CHOP, Script DAT, Script TOP.


Parameters - Script Page

Callbacks DAT callbacks - Specifies the DAT which holds the callbacks. See scriptSOP_Class for usage.  

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

Default Functions

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

# me is this DAT.
# scriptOP is the OP which is cooking.

# press 'Setup Parameters' in the OP to call this function to re-create the parameters.
def setupParameters(scriptOP):
	scriptOP.appendParFloat('ValueA', page='Custom')
	scriptOP.appendParFloat('ValueB', page='Custom')

#called whenever custom pulse parameter is pushed
def onPulse(par):

def cook(scriptOP):

Operator Inputs

  • Input 0 -

TouchDesigner Build:

Add • Alembic • Align • Arm • Attribute Create • Attribute • Basis • Blend • Bone Group • Boolean • Box • Bridge • Cache • Cap • Capture Region • Capture • Carve • CHOP to • Circle • Clay • Clip • Convert • Copy • CPlusPlus • Creep • Curveclay • Curvesect • DAT to • Deform • Delete • Divide • Extrude • Facet • File In • Fillet • Fit • Font • Force • Fractal • Grid • Group • Hole • Import Select • In • Introduction To SOPs id • Inverse Curve • Iso Surface • Join • Joint • Kinect • Lattice • Limit • Line • Line Thick • LOD • LSystem • Magnet • Material • Merge • Metaball • Model • Noise • Null • Object Merge • Oculus Rift • OpenVR • Out • Particle • Point • Polyloft • Polypatch • Polyreduce • Polyspline • Polystitch • Primitive • Profile • Project • Rails • Raster • Ray • Rectangle • Refine • Resample • Revolve • Script • Select • Sequence Blend • Skin • Sort • Sphere • Spring • Experimental:Sprinkle • Sprite • Stitch • Subdivide • Superquad • Surfsect • Sweep • Switch • Text • Texture • Torus • Trace • Trail • Transform • Trim • Tristrip • Tube • Twist • Vertex • Wireframe • ZED

A set of commands located in a Text DAT that are triggered to run under certain conditions. There are two scripting languages in TouchDesigner: Python and the original Tscript. Scripts and single-line commands can also be run in the Textport.

An Operator Family that reads, creates and modifies 3D polygons, curves, NURBS surfaces, spheres, meatballs and other 3D surface data.

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.