Panel Execute DAT

From TouchDesigner 088 Wiki

Summary

The Panel Execute DAT will run its script when the values of a specified panel component changes. You can specify which Panel Values to monitor, and trigger scripts based on their values changing in various ways.

Panel 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.

In the template Python script, panelValue is passed to each method, and you can query each call by printing panelValue.name and panelValue.val. See PanelValue Class.

PythonIcon.png panelexecuteDAT_Class

Parameters

Active /active - While on, the DAT will respond to the Panel that is referenced.

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 the pc Command 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 - The path that the script will be executed from if the Execute From parameter is set to Specified Operator.

Panel Value /panelvalue - The Panel Value(s) that is monitored to trigger the execution of the script.

Scripts will execute based on a combination of the five trigger events listed below. The script is executed once per trigger (except for While On/While Off cases). Each event will only cause one trigger to go off (i.e. if both Off to On and On Value Change are checked, one event will be fired with Off to On as the trigger). Logic for the 'on' state is greater than zero.

  • Off to On /offtoon - The offToOn() method executes when the panel value specified switches from off to on, called at the first "on" frame.
  • While On /on - The whileOn() method executes when the panel value specified is on. It is called once each frame.
  • On to Off /ontooff - The onToOff() method executes when the panel value specified switches from on to off, called at the first "off" frame.
  • While Off /off - The whileOff() method executes when the panel value specified is off. It is called once each frame.
  • On Value Change /change - The valueChange() method executes when the panel value specified changes value in any way. It is called once each frame.

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

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. These arguments are:

  • arg0 path of the Panel Execute DAT
  • arg1 type of trigger (offtoon, change...)
  • arg2 path of the panel component
  • arg3 current value
  • arg4 panel value type (select, state ...)
  • arg5

The sample index is compatible with the chopi() expression (it may not necessarily start with 0, but the CHOP's index range).