Add 'aeq.project.getLayersDeep' method?
Issue #37
new
We have aeq.getItemsDeep
to create a flat arrayEx of nested items in a folder. Having this for layers in a comp (and precomps) would be good.
Pass in a comp, get a flat arrayEx of all layers in the comp and precomps.
/**
* Returns an arrayEx of all layers in comp and precomps
* @param {CompItem} comp The comp to flatten.
* @return {aeq.arrayEx} ArrayEx with Layer objects.
*/
function getLayersDeep (comp, returnArrayEx) {
// The returnArrayEx param is so we can skip the converting to arrayEx when
// recursing. It is not meant to be used outside of this function.
var layers = [];
aeq.forEachLayer(comp, function (layer) {
if (aeq.isPrecomp(layer))
layers.push.apply(layers, getLayersDeep(layer.source, false));
else
layers.push(layer);
});
// Skip converting to arrayEx when function is called by it self.
if (returnArrayEx === false)
return layers;
return aeq.arrayEx(layers);
}