Parent Shortcut

From TouchDesigner 088 Wiki

Parent Shortcuts allow parent components to be referenced by any children operators, no matter how deep they reside inside the component. For general global shortcuts, see Global OP Shortcut.

The advantage of using the parent shortcut inside a component is that the component then becomes very portable and can be copy/pasted or moved into any network. 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.

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.

To specify a shortcut, enter the name in a component's Parent Shortcut parameter. (This was formerly called Path Variable or Internal Shortcut.)

To reference the shortcut, use parent.Name where Name is the value entered in the component's shortcut parameter. Note that by default, the component /project1 has its Parent Shortcut parameter set to project. Thus parent.project will refer to this top level operator from anywhere inside.

Example: A panel is located at /project1/fireEffect. Instead of using parent().par.w or 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 /project1/fireEffect, and 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 /project3/controlpanel/effects/fireEffect.

For exact usage and details, see OP Class#Members.
See also: parent() in Td_Module, Global OP Shortcut