Activity › Forums › Adobe After Effects › Batch Sequence Layers on Multiple Compositions from Project Panel
-
Batch Sequence Layers on Multiple Compositions from Project Panel
Posted by Luke Theobald on July 31, 2024 at 9:52 pmHello all,
I’m hoping you can help me with this question. I am looking for a solution of how to sequence layers within multiple compositions at once. Perhaps via a script?
Basically I want to be able to select many compositions in the project panel at once, hit a button, and they all automatically run the same process that Keyframe Assistant does to sequence their contained layers with no overlap.
Does anyone have knowledge of how this could be achieved?
Luke Theobald replied 1 year, 12 months ago 3 Members · 9 Replies -
9 Replies
-
Dan Ebberts
August 1, 2024 at 2:06 pmIt seems like it should be pretty straightforward. Something like this maybe:
var mySelection = app.project.selection;
var myComp, delta;
for (var i = 0; i < mySelection.length; i++){
myComp = mySelection[i];
if (! (myComp instanceof CompItem)) continue;
for (var j = myComp.numLayers; j >1; j--){
delta = myComp.layer(j).outPoint - myComp.layer(j-1).inPoint;
myComp.layer(j-1).startTime +=delta;
}
} -
Luke Theobald
August 1, 2024 at 2:19 pmFantastic Dan, thank you so much this is great! Just have one further question…
It works like a charm as long as there are no locked layers in the compositions, if there are locked layers it gives an error after the first composition and doesn’t affect the following compositions selected in the project panel. Is there any way around this, for the script to ignore errors and keep running?
-
Luke Theobald
August 1, 2024 at 3:17 pmIdeally, the script would ignore the locked layers. I am using this script to sequence certain (unlocked) layers in many compositions, but I want other layers (locked) within these same compositions to be unaffected by the layer sequencing process.
Thanks for your help with this!
-
Dan Ebberts
August 1, 2024 at 3:58 pmTry this:
var mySelection = app.project.selection;
var myComp, delta;
for (var i = 0; i < mySelection.length; i++){
myComp = mySelection[i];
if (! (myComp instanceof CompItem)) continue;
for (var j = myComp.numLayers; j >1; j--){
if (myComp.layer(j).locked) continue;
for (var k = j -1; k > 0; k--){
if (myComp.layer(k).locked) continue;
delta = myComp.layer(j).outPoint - myComp.layer(k).inPoint;
myComp.layer(k).startTime +=delta;
}
}
} -
Luke Theobald
August 1, 2024 at 4:04 pmThis is perfect Dan! Thank you so much for your help. This will save me a ton of time.
-
Dan Ebberts
August 1, 2024 at 10:46 pmActually, that last one isn’t quite right. This should be better:
var mySelection = app.project.selection;
var myComp, delta;
for (var i = 0; i < mySelection.length; i++){
myComp = mySelection[i];
if (! (myComp instanceof CompItem)) continue;
for (var j = myComp.numLayers; j >1; j--){
if (myComp.layer(j).locked) continue;
for (var k = j -1; k > 0; k--){
if (myComp.layer(k).locked) continue;
delta = myComp.layer(j).outPoint - myComp.layer(k).inPoint;
myComp.layer(k).startTime +=delta;
break;
}
}
}
Reply to this Discussion! Login or Sign Up