A Parent Shortcut allows any component to be referenced in any of its children operators with a
parent.Name notation, no matter how deep the children reside inside the component.
Note: For global shortcuts to components in another part of your project, see Global OP Shortcut.
The advantages of using the parent shortcut inside a component is:
- You don't need to know how many parent levels up the main component is. Instead of writing
parent(3)to get to a main component, you write
- The component then becomes very portable and can be copy/pasted or moved into any network.
To specify a shortcut, enter a name in a component's Parent Shortcut parameter, for example,
Effect. To reference the shortcut, use
Name is the value entered in the component's shortcut parameter,
parent.Effect in this case.
Since all uses of
parent.Name will refer to the parent shortcut instead of using absolute paths, moving the component into another network will not break any expressions in the component.
Note that by default, the component
/project1 has its Parent Shortcut parameter set to
parent.Project will refer to this top level operator from anywhere inside.
Example: A panel is located at
/project1/fireEffect. Instead of using
parent(2),par.w etc to access its width, (depending on where the expression is located), set the Parent Shortcut of the panel to
Effect. Then anywhere inside the component,
parent.Effect will refer to
parent.Effect.par.w is the width of the panel.
If you move the
fireEffect component to an entirely different location:
/project3/controlpanel/effects/fireEffect, then any internal expression with
parent.Effect will conveniently point to
If all clones of a master component have the same parent shortcut, using that name inside any of the clones will refer to the unique location of each clone, making paths in clones simpler and clones more portable.
A Parent Shortcut is a parameter on a component that contains a name that you can use anywhere inside the component to refer to that component using the syntax
parent.Name, for example
parent.Effect.par.w to obtain panel width.
There are four types of shortcuts: Application Shortcuts that are built-in to TouchDesigner's authoring interface, Panel Shortcuts that you create for any custom built panels, Parent Shortcuts for accessing a component from within that component, and Global OP Shortcuts that access a unique component from anywhere in TouchDesigner.