Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

[Expressions] How to refer to a comp one level above.

Participant ,
Aug 04, 2024 Aug 04, 2024

Can I reference a composition one level up in Expression?
Main > Level 1 > Level 2.
Is there a way to access a "Level 1" composition from a "Level 2" layer in a flowchart like this?
I would like to specify a composition as "one above" instead of specifying it by name.

TOPICS
Expressions , How to
494
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Dec 03, 2024 Dec 03, 2024

Essential Properties (Essential Graphics) did what I wanted to do.
What I wanted to do by referencing the hierarchy above Comp was to switch what was displayed in Comp.
This was accomplished by adding arbitrary Expression controls to the Essential Properties and applying the appropriate Expression to the layer I wanted to switch the display to.
Since the Essential Properties can be set for each placed layer, this demand was met perfectly.

Translate
Community Expert ,
Aug 04, 2024 Aug 04, 2024

There's no mechanism to reference another comp, other than by name.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 03, 2024 Dec 03, 2024

I need this too. Would be nice. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2024 Dec 03, 2024

The problem, of course, is that a comp can be nested inside any number of other comps. So what would be the expected result for "parentComp" when that could be anywhere from zero to "n" other comps?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 03, 2024 Dec 03, 2024

Essential Properties (Essential Graphics) did what I wanted to do.
What I wanted to do by referencing the hierarchy above Comp was to switch what was displayed in Comp.
This was accomplished by adding arbitrary Expression controls to the Essential Properties and applying the appropriate Expression to the layer I wanted to switch the display to.
Since the Essential Properties can be set for each placed layer, this demand was met perfectly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 03, 2024 Dec 03, 2024
LATEST

An example of doing that:
Add a Dropdown menu control to the Null layer and add the option to toggle the display to the menu.
Add like the following expression to the Opacity of the layer you want to switch the visibility of.

let f = thisComp.layer("Null").effect("Dropdown menu control")(Menu);
// This number ties the choice to the layer.
// Change it appropriately.
let n = 1;
f == n ? 100 : 0;

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines