Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression to reference upper level comp regardless of name?

  • Expression to reference upper level comp regardless of name?

    Posted by David Cabestany on July 17, 2014 at 6:36 pm

    Is there a way to have an expression look at the properties of the comp that encloses the layer that has it in?

    For example, I have this couple comps named Arrow curved an Arrow straight and each of them are used roughly 40 times each on my project, but they are nested in different comps and more importantly each instance has different rotation values.

    I need a drop shadow effect applied inside “Arrow” to always point to the right and bottom regardless of what rotation and orientation each specific instance of the layer has, so that if the arrow is pointing downward or upward the shadow is automatically corrected to always be down to the right.

    Is there some code similar to comp(“[name of the comp]”) but that instead looks at the upper comp regardless of which one is it every time?

    Thanks,
    D.

    Auric johnson replied 3 years, 11 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    July 17, 2014 at 7:05 pm

    There’s no way to make a precomp render differently, based on which comp it happens to be nested in. You’d need a separate copy of the precomp for each occurrence that needed to be different. In some cases, by using a clever naming scheme (where the name of the outer comp can be determined by the name of the precomp) you can automate things the way you are describing. For example, in “precomp 7” you might have an expression that strips the number off its own name and appends it to “outer comp ” to create the name of the parent comp (“outer comp 7” in this example) on the fly. Then the expression can address the parent comp by name.

    Dan

  • David Cabestany

    July 17, 2014 at 7:07 pm

    I’ll look into that.

    Thanks a lot Dan.

  • Auric johnson

    October 8, 2020 at 10:58 am

    I linked a check box to a check box inside a precomp using index

    comp(thisComp.layer(index-1).name).layer(“This is a full title”).effect(“Side title”)(“Checkbox”)

    looks at comp name in the layer above, then goes to a layer in that comp into its effect

    I dunno if thats what u need but i was searching for a solution for this issue and came across this thread.

    need to figure out how to find the text layer within the precomp

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy