Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions pull layer’s comp name?

  • pull layer’s comp name?

    Posted by Alex Printz on November 8, 2018 at 4:00 pm

    Hey all, quick expression question:

    If I have declared a layer in a variable:
    L = comp("Comp 1").layer("Shape Layer 1");
    can I later pull the comp name for L? e.g. (doesn’t work)
    N = L.propertyGroup(1).name

    or do I need to declare them individually?
    C = comp("Comp 1");
    L = C.layer("Shape Layer 1");
    n = C.name;

    I would really prefer to declare as a single line (as this will half the time be pickwhip’d, half not), so if it’s at all possible I’d love to hear!

    Alex Printz
    Mograph Designer

    Alex Printz replied 7 years, 5 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    November 8, 2018 at 4:36 pm

    The second one. Expressions don’t have anything like the containingComp attribute that’s available in scripting.

    Dan

  • Alex Printz

    November 8, 2018 at 5:49 pm

    Actually, it turns out that you can. After a bit of experimenting, you can grab the comp :

    L = comp("Comp 1").layer("Shape Layer 1");
    n = L.thisComp.name;

    Strangely, if you do this, you cannot grab the layer the same way:

    R = comp("Comp 1").layer("Shape Layer 1").content("Rectangle Path 1");
    n = R.thisLayer.name

    but you can do this:

    R = comp("Comp 1").layer("Shape Layer 1").content("Rectangle Path 1");
    n = R.propertyGroup(2).name

    Alex Printz
    Mograph Designer

  • Dan Ebberts

    November 8, 2018 at 6:23 pm

    >n = L.thisComp.name;

    I’m really surprised that this works. The expression language reference lists thisComp as a global object representing the comp containing the expression, but it must really be a layer attribute, with the layer defaulting to thisLayer.

    thisLayer.thisComp.name

    (which I would expect to throw an error) gives the same result as:

    thisComp.name

    You learn something every day I guess…

    Dan

  • Alex Printz

    November 9, 2018 at 3:16 pm

    Yeah that was really unexpected now that I’m looking at adobe reference page. Interesting that it can be referenced via the layer. Might have to play around with that some more.

    Alex Printz
    Mograph Designer

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