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

Referencing a Controller in a Main Comp from a Nested Comp

Engaged ,
Feb 11, 2022 Feb 11, 2022

Copy link to clipboard

Copied

Hi everybody,

 

I'm trying to make a guide layer set. With help I've managed to get a set of layers to reference a controller. However, I'd like to move my controller out of the precomp and into the parenting master comp to control it. Otherwise, this set of guide layers has to sit in the main comp. I'd rather have them at the bottom in their own folder/precomp etc to reference from a slider in the main comp. That is have a precomp designated for guide layers controlled from the main composition.

 

I read a Creative Cow article from like 2007 saying that there was no way for a precomp to 'parent' or upwardly nest reference to the comp it's residing in. Is that true or is there a format that I can use like...

thisComp.parent.Ctrl

or 

thisComp("parent").Ctrl 

etc

?

 

Hopefully that description makes sense. Thanks for any guidance with this situation.

TOPICS
Expressions , How to , Scripting

Views

1.0K

Translate

Translate

Report

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
LEGEND ,
Feb 11, 2022 Feb 11, 2022

Copy link to clipboard

Copied

There is indeed no such thing as .parent/ ("parent") for the simple reason that sub-compositions can be used and re-used across multiple other comps  in whatever arbitrary combination. This is simply a logic problem. Therefore you'll have to reference everything by name just like you would do with any other stuff:

 

comp("XYZ").layer("ABC").effect("Dummy")("Slider")

 

Mylenium

Votes

Translate

Translate

Report

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
Engaged ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

Expressions always have the scope of the project panel, where all footage items and all compositions are available without any connections to each other and without any hierachry.

So you have to call them by their names, as Mylenium provides.

 

Another way around would be to make progressive checks. If you want to know the layer number a precomp has in the main comp, you can cycle through all layers of the main comp and check for a matching name.

 

*Martin

Votes

Translate

Translate

Report

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
Engaged ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

Okay, so if I'm understanding this right all referencing in After Effects is a top-down process. So if I wanted to reference an element/object in a parenting comp, could I do so with an absolute reference?

 

Like (I'd have to research the naming conventions for the tree, but)...

 

Project.MainComp.ControllerInQuestion.doThis();

 

Would that be a way for a nested clip to reference something above it? Since I can't "pick whip" to a parenting clip, reference it absolutely as a project object? If so, I'm trying to do could work because it would always be named "GuideControl".

 

Am I warm in my assessment? 

 

 

 

 

Votes

Translate

Translate

Report

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
Engaged ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

Sorry if I added confusion while trying to give further explaination.

Mylenium already pointed out everything noticeable to this topic.

 

*Martin

Votes

Translate

Translate

Report

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
LEGEND ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

I already provided the correct syntax. AE's expressions are completely agnostic of any hierarchy and there is no inheritance in the JS sense as would be indicated by the .something syntax. Again, all references are absolute. And of course you can erasily pickwhip across comps. That's what multiple undocked timelines and locked viewers are for. I suggest you read the online help on these basics.

 

Mylenium

Votes

Translate

Translate

Report

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
Engaged ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

Right, okay. I understand the syntax then, but in terms of scope can timeline A reference timeline B simply by use absolute references?

 

Sorry for being redundant, but I'm not aware of any trace() or console() to get a response in AE.

Votes

Translate

Translate

Report

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
LEGEND ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

LATEST

Again, you reference property streams in expressions and nothing more. A "timeline" is your comp or more specifically a visual representation of the temporal relations of the layers and properties. There is nothing to reference here nor could there be any trace or console functions, because there is no global event listener system permanently running. This is quite generally a limitation in AE also relevant for scripting. You always have to point to the actual property and the evaluation is entirely controlled by changes in time and checking conditions on the properties.

 

Mylenium

Votes

Translate

Translate

Report

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