-
Script to Sequence Layers (What i’m doing wrong?)
Hello guys, i’m trying to create a script to sequence layers, but i’m having this little problem:
If i have the layers trimmed, they should remain that way, instead they are going back to they original start point, see, if i have layers like the example 1 image, the should be sequenced like the “Good result” image, instead they are sequencing like the “bad result”.
This is the line of code that i’m using:
var comp = app.project.activeItem;
var err = this.selErr;
if (this.checkActiveItem(comp)) throw(err);
var selLayers = comp.selectedLayers.reverse();
if (selLayers.length < 1) throw(err);
var offset = parseFloat(pal.gr.gr2.framesEt.text) * comp.frameDuration;
app.beginUndoGroup(this.scriptTitle);
for (var i = 0; i < selLayers.length; i++)
{
selLayers[i].startTime = (selLayers[i].inPoint = selLayers[i].startTime) + i * offset;
}
app.endUndoGroup();