Execute DAT

From Derivative
Jump to navigation Jump to search


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.


Parameters - Execute Page

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 fromop - This component is also the path that the script will be executed from if the Execute From parameter is set to Specified Operator.

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.. 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')

To safely to this and restore standard output:

prev = sys.stdout
sys.stdout = op('text1')
sys.stdout = prev

Parameters - Common Page

Language language - - Select how the DAT decides which script language to operate on.

  • Input input - The DAT uses the inputs script language.
  • Node node - The DAT uses it's own script language.

Edit/View Extension extension - - Select the file extension this DAT should expose to external editors.

  • dat dat - various common file extensions.
  • From Language language - pick extension from DATs script language.
  • Custom Extension custom - Specify a custom extension.

Custom Extension customext - Specifiy the custom extension.

Word Wrap wordwrap - - Enable Word Wrap for Node Display.

  • Input input - The DAT uses the inputs setting.
  • On on - Turn on Word Wrap.
  • Off off - Turn off Word Wrap.

Operator Inputs

  • Input 0 -

TouchDesigner Build:

Art-Net • CHOP Execute • CHOP to • Clip • Convert • CPlusPlus • DAT •  Execute • DAT Export • Error • EtherDream • Evaluate • Examine • Execute • FIFO • File In • File Out • Folder • In • Indices • Info • Insert • JSON • Keyboard In • Lookup • Merge • MIDI Event • MIDI In • Monitors • MQTT Client • Multi Touch In • NDI • Null • OP Execute • OP Find • OSC In • OSC Out • Out • Panel Execute • Parameter • Parameter Execute • Perform • Render Pick • Reorder • Script • Select • Serial • SocketIO • SOP to • Sort • Substitute • Switch • Table • TCP/IP • Text • Touch In • Touch Out • Transpose • TUIO In • UDP In • UDP Out • UDT In • UDT Out • Web Client • Web • Web Server • WebSocket • XML