Execute DAT

From TouchDesigner 099 Wiki


The Execute DAT lets you edit scripts and run them based on conditions. It can be executed at the start or end of every frame, or at the start or end of the TouchDesigner process. Text can be created in the DAT via the Node Viewer or an external text editor. Text can also can be passed into the Text DAT through the node's input, however this text will not be editable.

Execute DATs are created with default python method placeholders. For each monitored condition in the parameters, there is a matching python method in the DAT. When a condition is turned on in the parameters, each time that condition is satisfied the corresponding python method will be executed.

PythonIcon.png executeDAT_Class


Active /active - While on, the DAT will respond to the events selected below.

Execute From /executeloc - (Tscript only) Determines the location the script is run from.

  • Current Node /current - (Tscript only) The script is executed from the current node location.
  • This Node /here - The script is executed from the parent of the DAT. The DAT executes from the parent to make siblings of the DAT easy to access: DAT scripts used to execute from inside the DAT.
  • Specified Operator /op - The script is executed from the operator specified in the From Operator parameter below.

From Operator /from - This component is also the path that the script will be executed from if the Execute From parameter is set to Specified Operator.

Execute Conditions - The conditions monitored

  • Start /start - The onStart() method is executed when TouchDesigner starts.
  • Create /create - The create() method is executed when the node is created. This can be triggered on start, by loading a component from disk, by copying & pasting, or any other way a node can be created.
  • Exit /exit - The onExit() method is executed when the TouchDesigner process quits.
  • Frame Start /framestart - The onFrameStart() method is executed at the start of every frame.
  • Frame End /frameend - The onFrameEnd() method is executed at the end of every frame.
  • Play State Change /playstatechange - The onPlayStateChange() method is executed each time the play state changes, ie. pause or play is used on the timeline.
  • Device Change /devicechange - The onDeviceChange() method is executed each time devices are connected or disconnected from the computer. For example, plugging in MIDI devices, cameras, joysticks, etc.

NOTE: When using multiple Execute DATs with Start and Create functions, they are triggered in numbered-alphanumeric order of the DAT's names.

Edit... button /edit - Clicking this opens a text editor to edit text in the DAT.

TIP: To direct all "standard output" of python to a Text DAT, put this in the start() method: sys.stdout = op('text1')

Using Tscript Mode

Arguments are passed to the script to describe what type of change was detected. In Tscript you can view the arguments by including the command echo $args in the script.