-
Recursive compo length
Hello there for my first post on this forum.
I try to set the duration of a compo and all of its layers. i want to do same things for all nested sub-compo (recursive).
When i run this script, After effect just freeze!Reccursive_fit_length = function(Compo,T)
{
var tgt_AE = ((T+1)/25); //convert time for AE (Divide per FPS)
Compo.duration = tgt_AE; //change duration of the compo
if (Compo.layers.length >= 1)
{
for (i=1;i<=(Compo.layers.length);i++) //for all layers
{
var lay = Compo.layers[i];
//$.writeln(lay.name)
if (lay.source instanceof CompItem){Reccursive_fit_length((lay.source),T)}//if we have a sub-compo, do the same (recursive)
lay.outPoint = tgt_AE; //set layers to the same duration
}//end loop layers
}//end if at least one layer
}//end fn
Reccursive_fit_length(app.project.item(1),400)