-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EF_CreateMasksFromText.jsx
51 lines (39 loc) · 1.64 KB
/
EF_CreateMasksFromText.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
44
45
46
47
48
49
50
51
/**========================================================================
* ? EF_CreateMasksFromText.jsx
* @author Eveline Falcão (https://evelinefalcao.com)
* @email [email protected]
* @version 1.0.0
* @createdFor Adobe After Effects CC 2024 (Version 24.1.0 Build 78)
* @description Creates masks from selected text layers by executing the "Create Masks from Text" menu command.
*========================================================================**/
(function createMasksFromText() {
function processLayers(layer) {
var comp = layer.containingComp;
var initialSelection = comp.selectedLayers;
if (layer instanceof TextLayer) {
// Deselect all layers
for (var k = 0; k < layers.length; k++) {
layers[k].selected = false;
}
// Select only the current layer
layer.selected = true;
// 2933: CreateOutlineMasks ("Create Masks from Text")
app.executeCommand(2933);
// Deselect the created solid layer
var newLayer = comp.selectedLayers[0];
newLayer.selected = false;
}
}
var comp = app.project.activeItem;
var layers = comp.selectedLayers;
app.beginUndoGroup("'Create Masks from Text Layer'");
for (var layer = 0; layer < layers.length; layer++) {
var curLayer = layers[layer];
processLayers(curLayer);
// Reselect the original layers
for (var j = 0; j < layers.length; j++) {
layers[j].selected = true;
}
}
app.endUndoGroup();
})()