DAT - Data Operators (Text)
DATs are used for tables, scripts, XML, JSON, and plain text.
Text vs. Tables
DATs generally fall into two categories:
- Tables: Data organized in rows and columns. Accessed via scripts using row/column indices or names (e.g.,
op('table1')[0, 'name']). - Text: Free-form text strings. Typically used for Python scripts, GLSL shader code, or raw JSON payloads.
Key DATs
- Table: Store data in rows and columns.
- Text: Write Python scripts or GLSL code.
- Select: Isolate rows/columns from a table.
- Execute / CHOP Execute: Run scripts based on events (Frame start, Project start, or CHOP value changes).
- Web Client: Make HTTP requests to REST APIs.
- JSON: Parse JSON strings into usable dictionaries/tables.
How to Use DATs
DATs manage anything text or script-related in TouchDesigner.
- Adding a DAT: Open the OP Create Dialog (Tab) and select the DAT family (pink/magenta color).
- Working with Text:
- Drop a
Text DATto write notes, Python scripts, or custom GLSL shaders. - Click the node and type directly into the viewer if ‘Viewer Active’ is on, or right-click and choose “Edit Contents” to open it in your external text editor (like VS Code).
- Drop a
- Working with Tables:
- Drop a
Table DAT. You can add rows and columns via its parameters, and type in values in ‘Viewer Active’ mode. - Process tables using nodes like
Select DATto extract specific rows/columns orMerge DATto combine multiple tables.
- Drop a
- Running Scripts:
- Attach your data/text to an Execute node (
CHOP Execute,DAT Execute,Panel Execute) to trigger Python scripts when specific network events occur. - For example, you can write Python inside a
CHOP ExecuteDAT’sonValueChangefunction to print a message whenever a button is clicked.
- Attach your data/text to an Execute node (
- Conversion:
- DATs easily convert to other families.
DAT to CHOPis incredibly useful for turning numerical table data into CHOP channels, whileCHOP to DATturns signals into a historical table of values.
- DATs easily convert to other families.
(y) Return to DATs | (y) Return to The Operators | (y) Return to TouchDesigner | (y) Return to Home