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

How to give a precomp access to its own internal layers by relative reference?

Explorer ,
Aug 13, 2018 Aug 13, 2018

Copy link to clipboard

Copied

I have a massive number of precomped layers inside of a main comp. For each precomped layer, I want to move the anchor point depending on the position of a layer inside that precomp.

That layer inside each precomped layer is a shape layer used as a matte. Each precomped layer has the matte layer in a different position, so I want the the precomped layer to have an anchor point centered to that matte layer. All the precomped layers have the same image layer being masked out by the shape layers.

The calculation is simple to do this for each precomp by direct reference, but that would require different expression for each precomped layer. Is there a way to do this by relative/self reference so that I can just just paste same expression to all the precomped layers at once?

Something in the way of:

thisComp.thisLayer.layer("theMatteLayer")....

But I know this doesn't work because there's no layer object inside thisLayer.

TOPICS
Expressions

Views

1.1K

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

correct answers 1 Correct answer

Community Expert , Aug 13, 2018 Aug 13, 2018

If a layer is a precomp, layer.source gives you access to the actual comp:

thisLayer.source.layer("theMatteLayer")

Votes

Translate

Translate
Explorer ,
Aug 13, 2018 Aug 13, 2018

Copy link to clipboard

Copied

Well, I found a work around by replacing thisComp with a variable that points to the precomp's layer name. So something like...

compFind = thisLayer.name;

[comp(compFind).layer("theMatteLayer")...

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
Community Expert ,
Aug 13, 2018 Aug 13, 2018

Copy link to clipboard

Copied

If a layer is a precomp, layer.source gives you access to the actual comp:

thisLayer.source.layer("theMatteLayer")

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

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
Explorer ,
Aug 14, 2018 Aug 14, 2018

Copy link to clipboard

Copied

LATEST

Awesome, thanks Mathias!

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