FORUMS: list search recent posts

ExtendScript: find layers that are NOT selected

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eugene Boitsov
ExtendScript: find layers that are NOT selected
on Feb 10, 2019 at 12:02:45 am

Hi there,

CompItem.selectedLayers attribute allows me to keep all selected layers in the Array.
But how can I get an Array of layers that are not selected layers (the rest, basically)?

Thanx in advance,
Eugene


Return to posts index

Walter Soyka
Re: ExtendScript: find layers that are NOT selected
on Feb 10, 2019 at 2:39:57 am

Step through all the layers in the comp, check to see if they're unselected, and create your own array of unselected layers.

This code ought to do it:

function getUnselectedLayers(comp) {
if (comp instanceof CompItem) {
var unselectedLayers = [];
for (var compLayerIndex = 1; compLayerIndex < comp.numLayers; compLayerIndex++) {
if (comp.layer(compLayerIndex).selected == false) unselectedLayers.push(comp.layer(compLayerIndex));
}
return unselectedLayers;
} else {
return null;
}
}


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]