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.
If a layer is a precomp, layer.source gives you access to the actual comp:
thisLayer.source.layer("theMatteLayer")
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")...
Copy link to clipboard
Copied
If a layer is a precomp, layer.source gives you access to the actual comp:
thisLayer.source.layer("theMatteLayer")
Copy link to clipboard
Copied
Awesome, thanks Mathias!