-
Runing a function in nested comps in AE
Hi! I am trying to create a function which extends the outpoint of every layer in a comp.
I need the function to detect when the layer is a precomp, enter it, and run again inside of it.
so far, if I call the function within itself I create a loop which hangs AE.
Any ideas on how to approach this?(Check line 23 ==> extendOut(activeSubC.layer(u).source) <== this is where I am crashing AE. this is not working… if you delete this line, the script works just fine for the first selected layers and it’s firsts precomps. but not for precomps inside those.
thanks!
app.beginUndoGroup(“extendOut”);
//DEFINING GENERAL VARIABLES
var activeC = app.project.activeItem;
var activeSel = activeC.selectedLayers;//THE FUNCTION THAT RUNS INSIDE EVERY PRECOMP SELECTED.
function extendOut(compToExtend){
var activeCItems=compToExtend.numLayers;
var activeSubC=compToExtend;
for(u=1;u<=activeCItems;u++){
//DEFINE THE VARIABLES FOR THE SCRIPT
var currentSubLayer=activeSubC.layer(u);
var inSubLay=currentSubLayer.inPoint;
var activeSubCDuration=activeSubC.duration;// EXTENDING A PRECOMP
if(activeSubC.layer(u).source instanceof CompItem){
currentSubLayer.source.duration=activeSubCDuration-inSubLay;
currentSubLayer.outPoint=activeSubCDuration;
extendOut(activeSubC.layer(u).source)
};// EXTENDING A VIDEO LAYER
if(currentSubLayer.canSetTimeRemapEnabled==true && currentSubLayer.source.hasVideo==true){
currentSubLayer.timeRemapEnabled=true;
currentSubLayer.outPoint=activeSubCDuration;
};//EXTENDING EVERYTHING ELSE
else{
currentSubLayer.outPoint=activeCDuration;
}
};
};//RUN THE SCRIPT FOR THE FIRST TIME ONLY FOR SELECTED LAYERS
for(i=0;i
Sorry, there were no replies found.