-
Notifications
You must be signed in to change notification settings - Fork 22
/
Select Mattes.jsx
40 lines (33 loc) · 818 Bytes
/
Select Mattes.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
/**
* Selects all layers that are track mattes in the current comp.
*
* @author Zack Lovatt <[email protected]>
* @version 0.1.1
*/
(function selectMattes() {
if (parseFloat(app.version) < 23.0) {
alert("This script requires AE 23.0 or newer to run!");
return;
}
var comp = app.project.activeItem;
if (!(comp && comp instanceof CompItem)) {
alert("Please select a composition!");
return;
}
var layers = comp.layers;
if (layers.length == 0) {
return;
}
app.beginUndoGroup("Select Matte Layers");
try {
app.executeCommand(2004); // Deselect all
for (var ii = 1, il = layers.length; ii <= il; ii++) {
var layer = layers[ii];
layer.selected = layer.isTrackMatte == true;
}
} catch (e) {
alert(e);
} finally {
app.endUndoGroup();
}
})();