Activity › Forums › Adobe After Effects › Extend length of comp to match the longest layer
-
Extend length of comp to match the longest layer
Posted by Xavier Paredes on November 23, 2022 at 1:50 pmI have a lot of comps (74) all of which have a layer that extends past the length of the comp. I now need to adjust the length of the comp so nothing gets left out.
I know I can do this manually by opening the Comp Settings pop-up but I’m hoping there’s a shortcut or faster way?
TIA
Xavier Paredes replied 1 year ago 3 Members · 4 Replies -
4 Replies
-
Graham Quince
November 26, 2022 at 10:47 pmNot used it myself, but maybe something like this tool would help:
https://aescripts.com/elastic-comp-changer/
-
Walter Soyka
December 1, 2022 at 5:42 pmI’m way late to the party, but this would make a useful script. Save this code as a .jsx file, and it will step through all selected comps, extending their duration to the latest out point of its layers.
var projectSelection = app.project.selection;
if (projectSelection.length == 0) {
alert("Select one or more comps in the project panel.");
} else {
app.beginUndoGroup("Extend selected comps to longest layer");
writeLn("Extending selected comps to longest layer...");
var processedCompsCount = 0;
var modifiedCompsCount = 0;
for (var i = 0; i < projectSelection.length; i++) {
if (projectSelection[i] instanceof CompItem) {
var modifiedComp = false;
var currentComp = projectSelection[i];
for (var j = 1; j <= currentComp.numLayers; j++) {
if (currentComp.layer(j).outPoint > currentComp.duration) {
currentComp.duration = currentComp.layer(j).outPoint;
modifiedComp = true;
}
}
processedCompsCount++;
if (modifiedComp) { modifiedCompsCount++; }
}
}
writeLn("Processed " + processedCompsCount + " comp" + (processedCompsCount == 1 ? "" : "s") + " and modified " + modifiedCompsCount + ".");
app.endUndoGroup();
} -
Xavier Paredes
December 1, 2022 at 7:48 pmHi Walter,
I wound up using Keyboard Maestro to automate the repetitiveness. But I will test your solution next time I have a similar project.
I really appreciate you posting this solution.
Reply to this Discussion! Login or Sign Up