Category Archives: DATs

Nov 13 2014

EXECUTE DATs tutorial.

The EXECUTE DATs. TouchDesigner 088. 2014.
The EXECUTE DATs are a family of Operators that can run scripts on TouchDesigner events. These are the most powerful group of DATs, and are used extensively in building interactive networks. This is a special tutorial covering 6 DATs.

1
00:00:00,333 –> 00:00:06,267
This tutorial will focus on the
family of execute DATs.

2
00:00:06,267 –> 00:00:13,267
6 DATs that run scripts when
specific events happen in Touch
Designer.

3
00:00:13,267 –> 00:00:20,300
I built 6 example networks,
let’s start with the execute
DAT.

4
00:00:20,300 –> 00:00:27,267
The execute DAT can respond to 6
possible events, or processes.

5
00:00:27,267 –> 00:00:42,900
In order to work, the execute
DAT must have a Python script,
or snippet, within the targeted
Python method, as well as its
corresponding toggle enabled in
the parameters panel.

6
00:00:42,900 –> 00:00:55,100
This example creates 3 actions,
1 on frame start, 1 on frame
end, and 1 when the play state
changes.

7
00:00:55,100 –> 00:00:59,300
I’ve inserted a line into the
“frameStart” method.

8
00:00:59,300 –> 00:01:06,400
It fills the cell in row index
1, and column index 1, with the
frame number.

9
00:01:06,400 –> 00:01:11,133
We fill the next cell with the
frame number on frame end.

10
00:01:11,133 –> 00:01:18,333
The “playState” method has some
simple logic that alerts us to
the play head state.

11
00:01:18,333 –> 00:01:34,833
The execute DAT is commonly used
to monitor Touch Designer
processes, or, by using the
“start” method, to create setup
routines that prepare a network
when the program is launched.

12
00:01:34,833 –> 00:01:42,867
I often use the “exit” method to
perform clean up when Touch
Designer exits.

13
00:01:42,867 –> 00:01:48,500
Next let’s look at the chop
execute DAT.

14
00:01:48,500 –> 00:01:53,133
This operator is extremely
powerful and useful.

15
00:01:53,133 –> 00:02:06,333
It provides a simple framework
for you to convert CHOP
processes, to analyze CHOP
behaviors, and to build logic
based on CHOP events.

16
00:02:06,333 –> 00:02:11,767
You must first provide the DAT
with a reference CHOP.

17
00:02:11,767 –> 00:02:14,567
This is the CHOP that will be
monitored.

18
00:02:14,567 –> 00:02:23,867
You can toggle the “Active”
parameter to start or stop the
DAT’s execution.

19
00:02:23,867 –> 00:02:29,500
There are 5 methods that
correspond to CHOP events.

20
00:02:29,500 –> 00:02:41,300
It’s very important to realize
that ON is defined as any value
greater than 0, and OFF is
defined as 0.

21
00:02:41,300 –> 00:03:01,000
I’ve built some Python snippets
to showcase some simple ON/OFF
state logic, and I’ve used the
“valueChange” method to fill a
table cell with the evaluation
of the beat CHOP’s first
channel.

22
00:03:01,000 –> 00:03:14,400
This setup can help you
visualize the nature of OFF/ON
state logic, and help you
understand the options you have
for designing CHOP execution
timing.

23
00:03:14,400 –> 00:03:18,033
Next we’ll look at the dat
execute DAT.

24
00:03:18,033 –> 00:03:24,967
This operator and workflow is
very similar to that of the CHOP
execute DAT.

25
00:03:24,967 –> 00:03:30,433
Here I’ve built a representation
of a common Touch Designer
network.

26
00:03:30,433 –> 00:03:37,167
The end result is a table that
changes dynamically based on
user input.

27
00:03:37,167 –> 00:03:46,200
The dat execute DAT monitors
this table, and outputs data
based on the table’s state.

28
00:03:46,200 –> 00:03:51,233
There are 5 possible methods, or
states, we can monitor.

29
00:03:51,233 –> 00:04:05,667
The size and shape of the table
will change based on user
activity, and we can use this
activity to trigger any other
sort of logic in Touch Designer.

30
00:04:05,667 –> 00:04:18,833
Touch Designer has several
powerful methods for each
operator, including the table
DAT, that can help you modify or
access information about that
DAT.

31
00:04:18,833 –> 00:04:30,667
Here, I’ve used the “numRows”
and “numCols” members of the
table DAT class, to report the
size and shape of the table.

32
00:04:30,667 –> 00:04:42,667
I designed this network as a way
to illustrate a technique for
changing a TOP into a CHOP, then
into a DAT.

33
00:04:42,667 –> 00:04:54,833
By using the button, we can add
a colored cell to the table, and
by using the sliders, we can
alter the shape of the table.

34
00:04:54,833 –> 00:05:03,433
Notice how the dat execute DAT
creates a response to the
table’s changing shape.

35
00:05:03,433 –> 00:05:19,967
Keep in mind, the logic I’ve
written for the changing cell
method does not report the cell
ID, but only keeps track of the
fact that an unknown cell has
changed.

36
00:05:19,967 –> 00:05:26,533
You can use this network as a
basis for creating more
sophisticated logic.

37
00:05:26,533 –> 00:05:41,233
For example, you could restrict
user input to certain
specifications, or create
triggers that execute other
behaviors based on certain
criteria.

38
00:05:41,233 –> 00:05:45,200
Let’s take a look at the op
execute DAT.

39
00:05:45,200 –> 00:05:51,833
This DAT is more generic than
the chop or dat execute DATs.

40
00:05:51,833 –> 00:05:56,467
It can monitor any operator,
including TOPs.

41
00:05:56,467 –> 00:06:02,667
It is a common practice to
change Touch Designer networks
dynamically.

42
00:06:02,667 –> 00:06:11,300
Using an op execute DAT is a
good way to keep track of
changes to Touch Designer
networks.

43
00:06:11,300 –> 00:06:19,067
I’m using an info CHOP to report
information about the blur TOP.

44
00:06:19,067 –> 00:06:23,633
The info CHOP is an extremely
important operator.

45
00:06:23,633 –> 00:06:33,000
It’s used very commonly in Touch
Designer, and it’s a great
companion to the op execute DAT.

46
00:06:33,000 –> 00:06:49,633
I’m using the info CHOP to
report the number of times the
blur TOP has cooked, and I’m
using the op execute DAT to
report when that state changes.

47
00:06:49,633 –> 00:06:53,867
The op execute DAT can monitor
flag states.

48
00:06:53,867 –> 00:06:58,733
Flags are the buttons running
down the left side of an
operator.

49
00:06:58,733 –> 00:07:06,233
Bypass is a commonly used flag;
it will stop an operator from
cooking.

50
00:07:06,233 –> 00:07:14,267
Remember, in order to work
properly, the op execute DAT
must have an operator to
monitor.

51
00:07:14,267 –> 00:07:26,133
In this case the blur TOP, and
the methods we wish to employ
must have their corresponding
toggle enabled in the parameters
panel.

52
00:07:26,133 –> 00:07:33,167
The “wireChange” method lets us
monitor the inputs and outputs
of any operator.

53
00:07:33,167 –> 00:07:42,333
When we change the blur TOP’s
input, we see the op execute DAT
can report this change.

54
00:07:42,333 –> 00:07:49,667
We see that still images don’t
cook unless forced to, and
movies cook every frame.

55
00:07:49,667 –> 00:07:55,067
We can also see the effect of
enabling the bypass flag.

56
00:07:55,067 –> 00:07:59,067
Now let’s look at the panel
execute DAT.

57
00:07:59,067 –> 00:08:06,433
The panel execute DAT is similar
to the chop execute DAT, but it
monitors panels.

58
00:08:06,433 –> 00:08:16,333
Panels are a special type of
component, they are used to
create customized interactive
controls.

59
00:08:16,333 –> 00:08:22,367
They are often used to create
user interface elements.

60
00:08:22,367 –> 00:08:31,867
Here, I’m monitoring a field
panel. A field panel allows
users to type text strings into
a field.

61
00:08:31,867 –> 00:08:37,267
The panel execute DAT has a
parameter named “Panel Value”.

62
00:08:37,267 –> 00:08:45,400
By clicking the arrow button to
the right, we can see a list of
all the available values the
panel offers.

63
00:08:45,400 –> 00:08:55,867
I’ve added a panel CHOP, which
also monitors the field panel,
to show you some of the values
that are interactively
monitored.

64
00:08:55,867 –> 00:09:02,800
Panels are accessed under the
components tab of the OP create
dialogue.

65
00:09:02,800 –> 00:09:16,500
Similar to the chop execute DAT,
the value of 0 or NULL equates
to OFF, and anything other than
0 equates to ON.

66
00:09:16,500 –> 00:09:23,533
I’m using using a special Python
snippet to reference the value
of the text string in the field.

67
00:09:23,533 –> 00:09:31,367
The operator it references is
the “out1” DAT, located inside
the field component.

68
00:09:31,367 –> 00:09:48,600
When I type new text into the
field, you’ll see the results
are monitored by the panel
execute DAT, and the changes are
processed by the various 5
methods employed by the DAT.

69
00:09:48,600 –> 00:09:58,200
If I change the value in text
field to 0, you’ll see that we
get a report that the field is
currently OFF.

70
00:09:58,200 –> 00:10:04,967
I change the value to 1, and the
field state is reported as ON.

71
00:10:04,967 –> 00:10:20,867
This technique is extremely
useful in building user
interfaces, where user actions
need to be closely monitored,
and can trigger resulting
animations or logic actions.

72
00:10:20,867 –> 00:10:27,400
The parameter execute DAT
monitors an operator’s
parameters.

73
00:10:27,400 –> 00:10:35,267
I’ve wired 2 constant CHOPs to a
switch CHOP, and we’ll monitor
the switch.

74
00:10:35,267 –> 00:10:46,400
The switch CHOP has 2 parameters
we are interested in monitoring:
the “index” parameter and the
“indexfirst” parameter.

75
00:10:46,400 –> 00:10:59,300
The parameters we wish to
monitor must be entered by name
in the parameter named
“Parameter” in the parameter
execute DAT.

76
00:10:59,300 –> 00:11:05,100
It’s a bit confusing, yes, but
very logical and powerful.

77
00:11:05,100 –> 00:11:16,633
You can always find the actual
name of the parameter by
hovering your mouse over the
entry in the parameter panel.

78
00:11:16,633 –> 00:11:30,633
The setup for this example is
similar to the previous
examples, but since we are
monitoring and accessing
parameters, pay attention to the
Python snippets I’ve used.

79
00:11:30,633 –> 00:11:40,533
The Python object named “par” is
used to access a parameter,
followed by the parameter’s
name.

80
00:11:40,533 –> 00:11:53,200
It’s important to understand the
underlying architecture and
difference between, a CHOP’s
parameters, and its channel
values.

81
00:11:53,200 –> 00:11:58,200
This example is designed to help
you see that difference.

82
00:11:58,200 –> 00:12:10,533
We can use Python expressions to
drive the “Index” parameter of
the switch CHOP, or we can use a
constant, which is an integer or
a float.

83
00:12:10,533 –> 00:12:21,200
The parameter execute DAT can
monitor the state of the “Index”
parameter, and tell us what
method we are currently using.

84
00:12:21,200 –> 00:12:34,900
If we are using expressions, we
can access the value of that
expression as an evaluation, or,
we can access the Python snippet
itself as a string.

85
00:12:34,900 –> 00:12:36,900
Since we are monitoring the
parameter named “inputfirst”, we
can also tell whether or not
that parameter is enabled.

Nov 12 2014

Evaluate DAT tutorial.

The Evaluate DAT. TouchDesigner 088. 2014.
The Evaluate DAT is an extremely powerful Operator. You can use it to selectively change, replace, or tweak DAT networks. If you have a solid understanding of the Evaluate DAT, you will find more and more uses for it.

1
00:00:00,267 –> 00:00:05,200
Let’s take a look at the
evaluate DAT.

2
00:00:05,200 –> 00:00:12,600
The evaluate DAT can alter the
content of a source table by
using expressions.

3
00:00:12,600 –> 00:00:22,000
The Python expression
“me.inputCell.val” is a
reference to each incoming cell.

4
00:00:22,000 –> 00:00:31,867
The evaluate DAT will examine
the content of every incoming
cell, and assign it to that
variable.

5
00:00:31,867 –> 00:00:40,100
I set the evaluate DAT to output
the result of the expression
evaluation.

6
00:00:40,100 –> 00:00:50,600
The Python expression will
create a string that appends
“hello”, to the input value, to
an exclamation point.

7
00:00:50,600 –> 00:00:59,300
The second example shows how we
can use the evaluate DAT to
perform math functions on the
input values.

8
00:00:59,300 –> 00:01:10,467
We start with a noise CHOP that
creates 60 samples, then use a
chop to DAT to create a table
with 60 rows.

9
00:01:10,467 –> 00:01:20,567
The Python snippet will convert
the input cell value to a
floating point number, then
multiply that by PI.

10
00:01:20,567 –> 00:01:29,833
The next example shows the
ability of the evaluate DAT to
process multiple rows and
columns simultaneously.

11
00:01:29,833 –> 00:01:35,300
The second input is now a table
with 2 columns, not 1.

12
00:01:35,300 –> 00:01:46,333
The first cell uses the Python
expression “me.inputCell.row”,
to extract the index of the row
being processed.

13
00:01:46,333 –> 00:01:58,933
In this example, we start with a
table that has entries that need
to maintain their order, but
they need to be assigned new
identification indices in proper
sequence.

14
00:01:58,933 –> 00:02:03,933
We use the row index to create
that new sequence.

15
00:02:03,933 –> 00:02:11,633
The last example shows how the
evaluate DAT can create new
entries in a table.

16
00:02:11,633 –> 00:02:17,833
Here, the second input is a
table of 2 rows and 4 columns.

17
00:02:17,833 –> 00:02:25,600
We want to re-sequence the ID
indices, keep the NAME column,
keep the AGE column,

18
00:02:25,600 –> 00:02:34,533
and then finally, use the AGE
column to calculate new values
for the AGE_in_days column.

19
00:02:34,533 –> 00:02:35,933

20
00:02:35,933 –> 00:02:47,100
When we simply use the
“me.inputCell.val” expression,
the evaluate DAT will leave the
input values unchanged.

21
00:02:47,100 –> 00:02:57,867
For the IDs, since we start
evaluating on row 1, we need to
subtract 1, so that we start
with index 0.

22
00:02:57,867 –> 00:03:02,000
The next 2 columns remain
unchanged.

23
00:03:02,000 –> 00:03:14,800
For the last column, we use the
expression “me.inputCell.offset”
to evaluate a specific offset
from the current cell.

24
00:03:14,800 –> 00:03:27,200
In this case, we want to look at
the column to the left, or
behind the current cell, and use
that value as the basis for the
rest of the math function.

25
00:03:27,200 –> 00:03:29,200

Posted In
Tagged
Nov 12 2014

Sort DAT tutorial.

The Sort DAT. TouchDesigner 088. 2014.
The Sort DAT allows you to re-arrange rows and columns in tables based on specific criteria.

1
00:00:00,533 –> 00:00:03,467
Let’s examine the sort DAT.

2
00:00:03,467 –> 00:00:09,633
The sort DAT will sort incoming
table DAT entries by row or by
column.

3
00:00:09,633 –> 00:00:17,633
Remember, we can click the
“edit” button in the table DAT
parameters to launch our default
text editor.

4
00:00:17,633 –> 00:00:21,967
We wire our table DAT to a sort
DAT.

5
00:00:21,967 –> 00:00:26,300
In the sort DAT, we must choose
use a sort method.

6
00:00:26,300 –> 00:00:35,567
Here we will sort our rows, and
we specify a column index of
0 because we only have one
column.

7
00:00:35,567 –> 00:00:37,400

8
00:00:37,400 –> 00:00:41,867
We choose to order our incoming
data alphabetically.

9
00:00:41,867 –> 00:00:45,067

10
00:00:45,067 –> 00:00:49,967
Let’s look at some more
complicated sorting methods.

11
00:00:49,967 –> 00:00:55,833
Here we sort our rows, but we
change our column index to 1.

12
00:00:55,833 –> 00:01:06,667
Since our columns are indexed on
a base 0 numbering system, we
are now sorting the numerical
entries in the second column.

13
00:01:06,667 –> 00:01:15,267
The sorted values now step
numerically- 8, 9, 20, 22 and
77.

14
00:01:15,267 –> 00:01:20,100
Now we sort column index 2,
which is our third column.

15
00:01:20,100 –> 00:01:21,400

16
00:01:21,400 –> 00:01:28,500
Our row entries now step 3, 6,
6, 8 and 66.

17
00:01:28,500 –> 00:01:29,700

18
00:01:29,700 –> 00:01:35,500
In this example we will sort our
incoming table DAT entries by
column.

19
00:01:35,500 –> 00:01:36,500

20
00:01:36,500 –> 00:01:41,700
We turn on the “preserve first”
option in the parameters panel.

21
00:01:41,700 –> 00:01:51,100
This allows our first column, in
this case our row identification
entries, to retain their
original order.

22
00:01:51,100 –> 00:01:52,600

23
00:01:52,600 –> 00:02:02,033
If we specify a row index of 0,
we will sort our columns based
on the values in the first row.

24
00:02:02,033 –> 00:02:12,500
The columns that begin with the
values 22, 3, and 7, are now
re-ordered into 3, 7, 22.

25
00:02:12,500 –> 00:02:14,967

26
00:02:14,967 –> 00:02:19,533
Let’s change to specify row
index 1.

27
00:02:19,533 –> 00:02:24,733
Now we re-sort our columns based
on the entries in the second
row.

28
00:02:24,733 –> 00:02:26,300

29
00:02:26,300 –> 00:02:31,500
The sort DAT is a simple but
very effective way to
restructure table data.

30
00:02:31,500 –> 00:02:33,500

Posted In
Tagged
Nov 12 2014

Select DAT tutorial.

The Select DAT. TouchDesigner 088. 2014.
The Select DAT can function in two powerful ways. It can help you create specified selection sets from table DATs, and it can allow you to reference DATs as instances.

1
00:00:00,500 –> 00:00:04,067
Let’s examine the select DAT.

2
00:00:04,067 –> 00:00:15,100
The select DAT chooses a subset
of rows and columns from the
input table DAT based on
specific search criteria.

3
00:00:15,100 –> 00:00:23,733
The select DAT has several
options for defining that search
or extraction criteria.

4
00:00:23,733 –> 00:00:31,267
In this example we will select
the range of rows based on the
name of the row.

5
00:00:31,267 –> 00:00:35,700
The first entry in a row is
considered its name.

6
00:00:35,700 –> 00:00:36,633

7
00:00:36,633 –> 00:00:45,533
In this example we will select
our rows by name, and we will
select our column subset by
index.

8
00:00:45,533 –> 00:00:53,500
The index is the numerical
identification value of the row
or column, starting with 0.

9
00:00:53,500 –> 00:01:02,800
If we extract a range of columns
starting with column index 1, we
will effectively delete column
0.

10
00:01:02,800 –> 00:01:09,733
The columns in “table2” are
indexed in the numerical range 0
to 5.

11
00:01:09,733 –> 00:01:18,433
In the parameters panel, we can
enter values by typing them in
directly, or by using the
slider.

12
00:01:18,433 –> 00:01:25,367
We can also use Python to create
expressions that will generate
numerical values.

13
00:01:25,367 –> 00:01:33,300
The Python expression will
automatically be evaluated, and
in this case, produce a
numerical result.

14
00:01:33,300 –> 00:01:47,700
In this example, “me” is the DAT
named “select2”, “inputs[0]” is
the DAT named “table2”, and
“numCols” is the number of
columns in “table2”.

15
00:01:47,700 –> 00:01:57,833
Even though we use a base 0
numbering system to index the
number of columns or rows, there
are 6 total columns, not 5.

16
00:01:57,833 –> 00:02:04,333
We subtract 1 from the total row
count to generate our desired
index.

17
00:02:04,333 –> 00:02:06,800

18
00:02:06,800 –> 00:02:16,700
We can click the “edit” button
on the parameters panel of a
text DAT to launch our default
text editor.

19
00:02:16,700 –> 00:02:25,167
Any changes we make and save in
the text editor will
automatically be updated in
Touch Designer.

20
00:02:25,167 –> 00:02:34,767
We can also press the “viewer
active” button on the bottom
right of the operator, to type
changes directly into the
operator.

21
00:02:34,767 –> 00:02:45,900
The text editor will launch with
a temporary file, so it’s
important to keep track of
changes made in either the text
editor, or directly in the
operator.

22
00:02:45,900 –> 00:02:53,733
In this example we convert our
text DAT to a table, by using
the convert DAT.

23
00:02:53,733 –> 00:03:04,000
The “split cells” option defines
which character Touch Designer
will use create new cells from
the incoming text DAT.

24
00:03:04,000 –> 00:03:12,100
As with any operator, we can
middle mouse click on the
operator to display information
about that node.

25
00:03:12,100 –> 00:03:13,367

26
00:03:13,367 –> 00:03:19,433
We’ve converted our text to a
table, now we feed that into a
select DAT.

27
00:03:19,433 –> 00:03:20,533

28
00:03:20,533 –> 00:03:25,367
We’ve chosen to extract our rows
by selected values.

29
00:03:25,367 –> 00:03:26,733

30
00:03:26,733 –> 00:03:34,167
The first entry in each row is
the value or string we will need
to search for.

31
00:03:34,167 –> 00:03:36,100

32
00:03:36,100 –> 00:03:43,433
We can separate string entries
by a “space” character to search
for multiple patterns.

33
00:03:43,433 –> 00:03:52,267
The select DAT will extract each
row from the incoming table that
matches the search pattern.

34
00:03:52,267 –> 00:03:57,667
Now we will extract our columns
by selected values.

35
00:03:57,667 –> 00:04:05,433
Again, the first value in each
column is the value or string we
will need to search for.

36
00:04:05,433 –> 00:04:06,800

37
00:04:06,800 –> 00:04:14,733
In this example we will use
Python expressions to create our
search and extraction criteria.

38
00:04:14,733 –> 00:04:21,600
I’ve included some links so you
can learn more about Python
regular expressions.

39
00:04:21,600 –> 00:04:23,700
We start with a text DAT.

40
00:04:23,700 –> 00:04:29,867
As you can see, I’ve capitalized
each occurrence of the letter
“M”.

41
00:04:29,867 –> 00:04:37,000
We wire the text DAT to a
convert DAT, to convert the text
into a table.

42
00:04:37,000 –> 00:04:41,700
We use the “space” character as
our split cell value.

43
00:04:41,700 –> 00:04:44,267

44
00:04:44,267 –> 00:04:53,500
We wire the convert DAT to our
select DAT, and we choose to
extract our rows by selected
condition.

45
00:04:53,500 –> 00:04:56,367

46
00:04:56,367 –> 00:05:05,533
We use a Python regular
expression to create our search
criteria, in this case the
capitalized letter M.

47
00:05:05,533 –> 00:05:08,433

48
00:05:08,433 –> 00:05:23,433
We use the “str.search” method
which will search for every
occurrence of the capitalized M
in every cell of our input table
DAT.

49
00:05:23,433 –> 00:05:29,200
We’ve extracted every row that
contains the string capital M.

50
00:05:29,200 –> 00:05:30,133

51
00:05:30,133 –> 00:05:42,067
In its default settings, the
selected DAT extracts only the
rows whose first cell contains
the letter M.

52
00:05:42,067 –> 00:05:50,967
We can easily change this
default setting, by adjusting
the “from column” parameter.

53
00:05:50,967 –> 00:06:00,833
We can search a specific column
to find cells that contain our
search string, then extract that
entire row.

54
00:06:00,833 –> 00:06:04,333

55
00:06:04,333 –> 00:06:11,667
In this example we search for
the value “5” in our input table
DAT.

56
00:06:11,667 –> 00:06:20,300
We search column 0, and for each
cell that contains the character
5, we extract that entire row.

57
00:06:20,300 –> 00:06:23,667
Now let’s extract some specific
columns.

58
00:06:23,667 –> 00:06:28,367
Let’s take a look at the
“str.match” method.

59
00:06:28,367 –> 00:06:33,067
The “match” method is different
than the “search” method.

60
00:06:33,067 –> 00:06:39,567
The “match” method only
evaluates the first character of
the input cell.

61
00:06:39,567 –> 00:06:45,033
With the match method, the input
cell “34” will evaluate FALSE.

62
00:06:45,033 –> 00:06:50,733
The search method evaluates all
the characters of the input
cell.

63
00:06:50,733 –> 00:06:57,900
When we search for the 3
character, we find two
conditions that evaluate TRUE.

64
00:06:57,900 –> 00:07:05,533
When we match for the 3
character, we also find two
conditions that evaluate TRUE.

65
00:07:05,533 –> 00:07:07,533

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