Many ways to connect Nodes and Parameters
There are (too?) many ways to connect stuff in TouchDesigner and it usually takes a bit of practise until you know which way is right for which situation.
We already learned how to “wire” nodes together. This is the most obvious way to connect nodes. The other ways can be boiled down to a simpe formula: Via an adress. Just like a letter in real life.
Lets see this in action:
A good example is the Ramp TOP. It actually needs a Table DAT to drive the notches of the gradient. In this case the Table DAT is “docked” to the operator as it always needs one. If you look at the top of the parameter window, you see a text field and it has the name of the Table DAT in it. This makes the connection between the two nodes as indicated by a grey, dotted line with a little arrow head.
Copy-Paste the ramp1_keys DAT. The copy will be called ramp2_keys. Write that name in the DAT text parameter of the Ramp TOP and see how the grey line now points to the new DAT operator. We simply said the RampTOP to look at another DAT by telling it the name of that DAT. The lazy variation of this is to drag and drop the Table DAT onto the text field. Wait a moment before you drop. Note a white arrow with a plus. This tells you that this is a legitimate connection and if you drop now, the name of the dropped operator is written in the adress field – connection made.
Generally Drag and Drop is a very good way to find out if things can be connected in TD. Try dragging a Parameter name onto another parameter name. The white arrow will again indicate that this is a valid connection (if it is) and when you drop, you get a little menue with four options:
- Value – This will place only the value at this moment as a static value.
- Reference – This will create a Python expression that listens to the source parameter. One way.
- Bind – This will create a bi-directional binding between both parameters – they will update each other.
- Chancel – oh well, you know : )
These options are reflected by the four little squares that we see left of the value when we expand/unfold a parameter. Note the Python expression, when you drop a Reference. These will be written for you, but you sooner or later you can also write them yourself.
As CHOPs are often used for control data, a very common approach is to map a CHOP channel onto a parameter. However, the CHOP node must be in the right state: Activated. You activate a node with the little star icon in the lower right corner. Once activated, the viewer should turn green when you hover over it with the cursor:
That tells you that the channel is now “draggable”. Drag it and drop it onto the phase parameter of the Ramp TOP. Notice again the white arrow with the plus and drop. Again you will get a little menue. Choose CHOP Reference. Notice that a Python expression has been created:
This says: Look at the operator called “constant1” and there go for the channel “chan1”
Connection made! (You could have said op(‘constant1’) as well to simply adress the first channel, no matter what the name to the same end)
The other option we see is Export CHOP.
This is yet another concept to pump data from a CHOP or DAT to a parameter. It is the fastest way, however I find it a bit unflexible. Unlike a Python expression you can not simply edit it.
Learn more about exports here:
For the sake of this introduction, we are going to neglect exports and focus on the Python expressions, which has the nice side effect that we may learn a bit about Python on the way.