See also Category:DATs for a full list of articles related to DATs.
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. You can edit the contents of the DAT directly in the DAT Viewer.
Sweet Sixteen DATs
The following 16 DATs are commonly used, we recommend familiarizing yourself with them.
|Text||A place to edit and hold any text data.|
|Table||Edit tables of text in rows and columns of "cells".||Convert|
|Merge||Merges tables or text DATs into one.||Switch|
|Select||Select specific columns or rows from a DAT.||Substitute|
|Reorder||Re-orders and repeats rows or columns in a DAT.||Transpose|
|Insert||Adds one row or column to a table filling with text in the new cells.|
|Evaluate||Evaluates expressions in DATs.||Script|
|CHOP to||Converts CHOP channels to DATs.||SOP to|
|CHOP Execute||Runs the DAT as a script when a CHOP changes.|
|Panel Execute||Runs the DAT as a script when a Panel changes.|
|DAT Execute||Runs the DAT as a script when another DAT changes.||Execute|
|OSC In/UDP In||Receive data from other applications via Open Sound Control.||OSC Out/UDP Out|
|Web||Fetch a page on the internet based on a URL.||XML|
|Render Pick||Use mouse to pick 3D objects and surfaces.||Info|
|Multi Touch In||Receive input from Windows 7+ multi-touch devices.|
|MIDI In||Get MIDI controller and button data.||Serial|
All DATs are documented in the Category:DATs.
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 Panel Execute DAT (Tab -> DAT -> Panel Execute) and make its Viewer Active. Then click in its viewer and and change the
offToOn()function to be:
def offToOn(panelValue): op('audioplay1').par.trigger.pulse() return
Click outside the node to end text entry. Go back up (u), make the button a Momentary button via its Button page and Button Type parameter. Then make the button 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.
You can use table DATs to export to parameters. See DAT Export.
DAT tables can be modified with the
Table cells are read with a
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
- 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
text2and its viewer should say "jane".
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
- In the TOPs' expressions, you can replace
DATs for manipulating Web and XML Data
DATs for Raw Text
DATs can also be use to hold raw text which can then used by the Text TOP and Text SOP for use in compositing and 3D. They can also be used to leave comments your networks or for pop-up help messages for panel gadgets.
DATs can be edited directly in their viewers by turning on the Viewer Active Flag.
You can also edit DATs in the Textport by right-clicking on a DAT and selecting Edit Contents in Textport.
Some DAT generators and most DAT filters can not be edited because their data is fed to them from their input. This is indicated in the viewer by a more muted text color compared to those DATs which can be edited. If you need to temporarily edit the contents of one of these DATs you can lock the DAT using the Lock Flag and then edit it. However, these changes will be lost when the DAT is unlocked and locking it keeps it from cooking, so this is generally only useful for troublshooting and debugging.
By default, text-type DATs display line numbers in the left margin area and table-type DATs display row and column numbers. The display of these numbers can be controlled in Preferences.
Editing DAT Text in an External Editor
In any DAT (or any parameter), if you right-click the DAT node and select Edit Contents... you will be editing the text in an external editor. Notepad is Windows default text editor.
To change the text editor to something else, like Notepad++, Vim, Sublime, etc. you need to change the Text Editor and Table Editor preference values. These preferences can be found in the Preferences dialog under the DATs page. Set their values to the path of the installed application executable (.exe) of the editor you want to use. For example,
C:/Program Files ...
Everyone has a favorite, have a look at Sublime Text 2.
To see how you set an environment variable, see Variables.
- text data, text and table formats (tab delimited)
- use for scripts, commands, storage of values and arrays
- can be edited in the viewer, textport, or any external text editor
- Import: Text DAT, Table DAT, Web DAT
- Export: (right-click to save)
|• • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •|
An Operator Family that creates, composites and modifies images, and reads/writes images and movies to/from files and the network. TOPs run on the graphics card's GPU.
A dialog box in which commands and scripts can entered manually. Script errors and python
print() messages are also output to the textport.
Exporting is the connection of CHOP channels to parameters of operators. The output of each exporting CHOP is one or more channels, active only while the CHOP Viewer is on. The current value of a channel can be exported to a parameter of any operator, overriding that parameter's value. See Parameter.