ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

AE Script to copy layers from comp to comp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Emmanuel mauries-rinfret
AE Script to copy layers from comp to comp
on Apr 1, 2019 at 10:09:15 pm
Last Edited By Emmanuel mauries-rinfret on Apr 1, 2019 at 11:07:48 pm

How would I go about copying all the layers from a comp to another comp without losing the null parenting.
Let's say I have originalComp with 3 text layers parented to a null and I want to copy them to otherComp.

Any tip would be appreciated!


Return to posts index

Andrei Popa
Re: AE Script to copy layers from comp to comp
on Apr 2, 2019 at 8:01:58 am

If you want to copy all the layers, null included, i don't think you should worry about the parenting. And to do that, use something like this.
You must declare comp1 and comp2 according to your project. I suggest searching the rd_GimmePropPath script to easily find out that.


comp1 = app.project.item(1);
comp2 = app.project.item(2);

comp1.openInViewer();
for (i = 1; i <=comp1.numLayers; i++){
comp1.layer(i).selected = true;
}

app.executeCommand(19); //Copy
comp2.openInViewer();
app.executeCommand(20); //Paste


Andrei
My Envato portfolio.


Return to posts index

Emmanuel mauries-rinfret
Re: AE Script to copy layers from comp to comp
on Apr 2, 2019 at 12:39:53 pm

That's perfect.
Thanks!


Return to posts index

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