Products Applications Downloads Features Wiki forum Store

DAT

From Wiki077
Jump to: navigation, search

Data OPerators (or DATs) are used to hold text data like strings, scripts, and XML. DATs either contain multiple lines of text as in a script, or a table of rows and columns of cells, each containing one string.

Contents

DATs for Scripting

DATs can be linked together to select, re-arrange and evaluate data and expressions, making DATs a powerful procedural scripting tool.

DATs that contain scripts can be triggered by events like mouse clicks and any operation of gadgets in TouchDesigner control panels. DAT scripts can also be triggered by channel changes in CHOPs.

Script Example: This will create a button that plays a sound when you click it: Create a Button component (Tab -> COMP -> Button). Go inside it (Enter) and create an Audio Play CHOP (Tab -> CHOP -> Audio Play).
Then create a Text DAT (Tab -> DAT -> Text) and make its Viewer Active. Then click in its viewer and type in the text "audioplay audioplay1 0". Click outside the node to end text entry. Change the DAT's "Execute" menu parameter to "On Panel Change". Go back up (u), make the button's Viewer Active. click on the viewer of the button. It should make a Notify sound.

You can also run a script in a Text DAT by using the "run" command from the textport or another DAT.

DATs for Tables

DAT tables are rows and columns of cells containing text strings.

OP DAT.jpg

The DAT whose name is Table DAT is used to define new tables. To manually add, delete rows and columns of tables, press RMB over the table when Viewer Active is on and select from the menu.

The tables are then manipulated by the Select DAT, Evaluate DAT, Merge DAT, Switch DAT, Sort DAT and others.

You can use table DATs to export to parameters. See DAT Export.

DAT tables can be modified with the tabcell command.

Table cells are read with a tab(), tabr(), tabc() or tabrc() expression. See Help -> Commands and Expressions.

Table Example: This will create two TOP images with names in it: Create a Table DAT (Tab -> DAT -> Table). Make its Viewer Active. Right-click on the viewer and select Add Column, and then Add Row, and again Add Row, which should give you 3 rows and 2 columns of empty cells (or put 2 and 3 in the parameters.)
Click in the top left cell and type name, top right type age, and fill in the remaining cells with joe, 9, jane, 21.
Now create a Text TOP (Tab -> TOP -> Text) and in its parameter called Text, type this expression to retrieve a cell from the table: `tabc("table1", $OD, "name")`. You should see "joe" in the Text TOP viewer. Copy/paste the Text TOP (Ctrl-C, Ctrl-V). The new TOP should be called text2 and its viewer should say "jane".
That tabc() expression gets from the table, table1, the node you edited. It gets from the column called name. And the row is $OD, which is a variable you can use in any node that means "operator digits", the digits at the end of the operator name, which in this case is 1 and 2 for text1 and text2.
In the TOPs' expressions, you can replace "name" with "age".

DATs for manipulating Web and XML Data

The Web DAT gets HTML or other data by passing a URL to the internet and receiving a response. The result and any XML data can be filtered with an XML DAT, then further processed with the other DATs.

DATs for Raw Text

DATs can also be use to hold raw text, such as pop-up help messages for panel gadgets.



Personal tools