Tag Archives: insert

Nov 12 2014

Insert DAT tutorial.

The Insert DAT. TouchDesigner 088. 2014.
The Insert DAT is a handy and flexible Operator. Manipulating and re-formatting tables is a common practice; the Insert DAT can help you make targeted changes to DAT networks.

1
00:00:00,800 –> 00:00:04,200
Let’s examine the insert DAT.

2
00:00:04,200 –> 00:00:06,933
We start with a table DAT.

3
00:00:06,933 –> 00:00:20,367
It’s important to remember that
by clicking the “viewer active”
tab on the bottom right we can
edit the contents of our table
DAT directly in the node.

4
00:00:20,367 –> 00:00:30,733
We can also press the “edit”
button in the table DAT
parameters to launch our default
text editor.

5
00:00:30,733 –> 00:00:39,233
Changes we make in the text
editor will be saved in the
table DAT.

6
00:00:39,233 –> 00:00:42,533

7
00:00:42,533 –> 00:00:48,367
We wire the table DAT to an
insert DAT.

8
00:00:48,367 –> 00:00:50,533

9
00:00:50,533 –> 00:00:56,367
We choose to insert a column
before the first column.

10
00:00:56,367 –> 00:00:58,700

11
00:00:58,700 –> 00:01:08,133
In the contents field we type in
the text strings we would like
to add to the new table.

12
00:01:08,133 –> 00:01:14,333
We’ve separated each addition of
new text with a space.

13
00:01:14,333 –> 00:01:22,600
This automatically separates the
new text content into a new row.

14
00:01:22,600 –> 00:01:28,233
Each character grouping
separated by a space will be-
come a new row.

15
00:01:28,233 –> 00:01:37,300
The insert DAT will
automatically adjust for
leftover rows by creating blank
cells.

16
00:01:37,300 –> 00:01:45,667
We can use any text strings we
like to create new row content.

17
00:01:45,667 –> 00:01:51,200

18
00:01:51,200 –> 00:02:06,500
For this example, instead of
manually entering our character
groupings, we will use Python to
create an automatic row
insertion.

19
00:02:06,500 –> 00:02:09,133
Let’s examine this Python
expression.

20
00:02:09,133 –> 00:02:14,000
We’ll use the “string join”
Python method.

21
00:02:14,000 –> 00:02:22,633
In a “for loop”, we will iterate
over the incoming number of
table rows.

22
00:02:22,633 –> 00:02:32,967
For each table row, we will
create a string consisting of a
header and the number of that
row.

23
00:02:32,967 –> 00:02:42,433
The table DAT named “table3” is
referenced as me.inputs[0].

24
00:02:42,433 –> 00:02:48,700
It contains 8 rows numbered from
0 to 7.

25
00:02:48,700 –> 00:02:53,500

26
00:02:53,500 –> 00:03:03,633
The header is the first part of
our string, which we can change
to any character sequence we
like.

27
00:03:03,633 –> 00:03:07,733

28
00:03:07,733 –> 00:03:15,000
And the numerical value of the
row count is the second part of
our string.

29
00:03:15,000 –> 00:03:16,233

30
00:03:16,233 –> 00:03:23,167
Again, we count through the
number of rows from 0 to 7.

31
00:03:23,167 –> 00:03:34,500
I’ve included two links to help
you learn more about the Python
“join” method, and Python list
comprehensions.

32
00:03:34,500 –> 00:03:36,500