ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Automatic Dynamic Parenting with Duplication

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Christian Magadan
Automatic Dynamic Parenting with Duplication
on Jan 26, 2017 at 8:19:37 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".


Return to posts index

Dan Ebberts
Re: Automatic Dynamic Parenting with Duplication
on Jan 26, 2017 at 9:30:00 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



Return to posts index

Christian Magadan
Re: Automatic Dynamic Parenting with Duplication
on Jan 26, 2017 at 9:46:07 pm

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]