FORUMS: list search recent posts

After effects [ Scripting ] Invert Selection

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
John Joseph
After effects [ Scripting ] Invert Selection
on Jul 28, 2017 at 4:21:11 pm

Hi Guys
i am doing a script and i want it to invert the layers selection (to deselect any currently selected layers and select all other layers)
this is extremely simple in after effects but i can't get it to work in scripting as i am new in the scripting field
I searched everywhere always get something about re-arranging the selection






Thanks


Return to posts index

Walter Soyka
Re: After effects [ Scripting ] Invert Selection
on Jul 31, 2017 at 7:08:00 pm

Try this:

// pick a comp to work on here; we'll use the active item
comp = app.project.activeItem;

// step through all the layers in our selected comp and toggle their selection state
for (var i = 1; i <= comp.numLayers; i++) {
comp.layers[i].selected = !comp.layers[i].selected;
}


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

John Joseph
Re: After effects [ Scripting ] Invert Selection
on Aug 4, 2017 at 2:18:24 pm

Walter Soyka ... Thank yooooou
Simple and effective ... can be applied on different scenarios not just selection !
Thanks again :)


Return to posts index

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