Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible to return the length of a “Parent/child” chain?

  • Is it possible to return the length of a “Parent/child” chain?

    Posted by Ryan Hauser on January 25, 2024 at 10:27 pm

    Let’s say I have a number of layers parented to each other in sequence like a chain. Think individual layers composing an animal’s tail, for example. Is it possible to, through expressions, make something that returns the number of “parents” a layer has until it reaches either the end of the parent sequence, or a specific layer?

    I know you can target through parent layer stacks by saying parent.parent.parent.transform.rotation for example, but from my limited knowledge that needs to be hard-coded on a layer-per-layer basis. I’d love to know if there’s a more generic solution that can be more broadly applied.

    Dan Ebberts
    replied 4 months, 2 weeks ago
    2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    January 25, 2024 at 10:35 pm

    This should tell you how many levels of parents a layer has:

    L = thisLayer;
    n = 0;
    L = L.parent;

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