forked from ff6347/after-effects-script-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
select-all-masks-on layer.jsx
43 lines (35 loc) · 1.19 KB
/
select-all-masks-on layer.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* @author redefinery with some edits by fabiantheblind
* @description select all masks on layer
* take a look into the fundamentals
* http://www.redefinery.com/ae/fundamentals/
* @todo [description]
*/
// given:
// layer = Layer object, and the layer can have masks applied
//
fun();
function fun() {
app.beginUndoGroup('XXX');
var curComp = app.project.activeItem;
if (!curComp || !(curComp instanceof CompItem)) {
alert('noComp');
return;
}
var layer = curComp.selectedLayers[0];
var masksGroup = layer('Masks');
var selectedMasks = new Array(); // Store masks in an array; starts as empty
if (masksGroup != null) {
// Iterate through properties of masksGroup
// Append selected mask to the array
for (var i = 1; i <= masksGroup.numProperties; i++) {
masksGroup.property(i).selected = true;
}
// ~ if (masksGroup.property(i).selected)
// ~ selectedMasks[selectedMasks.length] = masksGroup.property(i);
// ~ }
// The selectedMasks array now contains the list of selected masks
// in top-to-bottom order
}
app.endUndoGroup();
}