Execute DAT

From TouchDesigner 088 Wiki

Summary

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

Parameters

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

Execute From /executeloc - Determines the location the script is run from.

  • Current Node /current - The script is executed from the current node location (for example, where 'cc' points to).
  • 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 start() 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 exit() method is executed when the TouchDesigner process quits.
  • Frame Start /framestart - The frameStart() method is executed at the start of every frame.
  • Frame End /frameend - The frameEnd() method is executed at the end of every frame.
  • Play State /playstate - The playstate() method is executed each time the play state changes, ie. pause or play is used on the timeline.

NOTE: Start and Create are triggered in numbered-alphanumeric order of the nodes' names.

Edit... button /edit - Clicking this opens a text editor to add/edit/delete text from the DAT.

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