Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Automatic Dynamic Parenting with Duplication

  • Automatic Dynamic Parenting with Duplication

    Posted by Christian Magadan on January 26, 2017 at 8:19 pm

    Is it possible in After Effects to cause a layer to parent itself to the layer below it automatically when you duplicate it?

    Example:

    You have a Null and create a small solid and parent it to that Null. When I duplicate the solid #1, it creates a copy that is ALSO parented to the Null. Instead of this, I want solid #2 to be parented to solid #1. When I duplicate Solid #2, I want solid #3 to be parented to solid #2, and so on.

    I know I can do this manually, but if I need to create 100 solids, I don’t want to have to go 1 by 1 and parent each one individually. I would rather be able to hit “duplicate” and as each copy is created, it is dynamically parented to the layer below it.

    Is there a way to accomplish this by using expressions? I know you can set up expressions based on which layer the object is currently parented to, but I haven’t found a way to dynamically parent an object to its “Index+1”.

    Christian Magadan replied 9 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 26, 2017 at 9:30 pm

    Not with expressions. After all your layers are created, you could use a simple script like this to parent each selected layer to the layer above:


    var myComp = app.project.activeItem;
    var s = myComp.selectedLayers;
    for (var i = 0; i < s.length; i++){
    s[i].parent = myComp.layer(s[i].index-1);
    }

    Dan

  • Christian Magadan

    January 26, 2017 at 9:46 pm

    Didn’t think so. Thanks! I’ll try this out!

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