Clone

From TouchDesigner 088 Wiki

Clones are TouchDesigner's mechanism to assure many components match the structure and behavior of a master clone. As the master component is edited, all its clones are changed automatically to match.

a master (button1) and its three clones. each clone gets a different .jpg from a table

A component's Clone parameter is the path to its master component. It is not a clone if the Clone parameter is blank or points to a non-existent component.

Common within all Clones: What a clone has in common with its master:

  • All clones will be forced to contain the same operators (nodes).
  • The wiring between the nodes and the layout of the nodes in the network will be the same.
  • The parameters of the nodes INSIDE the clone are forced to be the same.
  • The flags of the nodes, like bypass and viewer state, will be forced to be the same.

Unique to each Clone: However clones can be made to cook and output differently:

  • component inputs - Operators like CHOPs and SOPs that feed into the clone via the inputs may have differing data. Therefore the data output from nodes in the clone will often be different, as will the data output from the clone itself.
  • variables - Variables in nodes inside the clone that use $OPN (operator parent's name) and $OPD (digits in operator's parent's name) can be used to differentiate between clones. For example, the clone's name's digits can be used to look up values in tables externally (tab("tabpath", $OPD, "value")). Therefore parameters may have the same expressions, but the expressions may evaluate to different values.
  • immune nodes - Nodes that are inside the clone and are set to be "immune" are untouchable and unique. Nodes that have their immune flag set are not forced to match the master of the clones. For example, you may put an immune Table DAT inside a clone that makes it unique, encapsulated and portable.
  • component parameters - Parameters of the clone component (its dimensions, background, override, transform, ...) may be set differently. These are not the parameters of nodes inside the clone, just parameters of the clone itself.

Clone Immunity and the Immune Flag

Clone Immunity allows a node to exist inside a cloned network without it being a clone itself. You can add any number of Clone Immune nodes inside a Clone and they will not be changed if the Master Clone is changed, their contents will remain the same. A perfect example is using Clone Immune to keep personalized DAT tables inside clones: these tables can contain different data in each clone.

If you place a Clone Immune node in the Master Clone, then that Immune node will be created in each clone, using the Master Clone's current value the first time it is created. After that, the Immune Node in the Clones does not update if you make a change to the values in the Master Clone, or delete it entirely.

Making a Parameter of All Clones have Same Value

Right-click on any parameter that is the master of any number of clones and select “Copy to all Clones”. This finds all the clones and make the values all the same.

See also

Immune, Replicator Component