ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Make a script to parent bottom layer to current selected layer.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Carlos Pendas
Make a script to parent bottom layer to current selected layer.
on Feb 16, 2017 at 5:51:18 am

Hello, I've got this very repetitive task that I perform dozens of times per hour, I need to parent the layer right under the selected layer to the selected layer. Ideally I would assign a shortcut to this script.

Problem is, I read through the documentation, searched forums and I can't understand how to do it. Can anyone point me in the right direction?

Thanks!


Return to posts index

Dan Ebberts
Re: Make a script to parent bottom layer to current selected layer.
on Feb 16, 2017 at 6:52:26 am

This should get you headed in the right direction:


var myComp = app.project.activeItem;
var myLayers = myComp.selectedLayers;
if (myLayers.length > 0){
var myLayer = myComp.selectedLayers[0];
if (myLayer.index < myComp.numLayers){
myComp.layer(myLayer.index +1).parent = myLayer;
}
}



Dan



Return to posts index

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