-
Script to remove everything from a Comp except light layers..not working!
Hello I am writing a basic script to remove all the layers except lights. But sometimes it works and sometimes it doesn’t and usually a camera/solid is left behind. Here is the script. Thanks in advance.
app.beginUndoGroup("Trial");
var srcComp = app.project.activeItem;if (srcComp == null || !(srcComp instanceof CompItem)){
alert("Please select an active Composition and run again");
} else{
var lightComp = srcComp.duplicate();
for (i=1;i<=lightComp.numLayers;i++) {
var curLayer = lightComp.layer(i)
if ((curLayer.property("intensity") == null) || (curLayer instanceof CameraLayer) || (curLayer instanceof AVLayer)) { curLayer.remove(); }else{
alert("Yes!");
};
};
};Satya Meka,
https://www.gutsblow.com