forked from zlovatt/zl_Scriptlets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Disable All Comp Expressions.jsx
48 lines (39 loc) · 1.08 KB
/
Disable All Comp Expressions.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
/**
* Disable all expressions in all comps (and precomps)
*
* @author Zack Lovatt <[email protected]>
* @version 0.2.0
*/
(function() {
/**
* Recursively loops through all properties and disables found expressions
*
* @param {PropertyGroup} propertyGroup Property group to loop through
*/
function recursiveDisableExpressions(propertyGroup) {
for (var ii = 1; ii <= propertyGroup.numProperties; ii++) {
var property = propertyGroup.property(ii);
if (property instanceof PropertyGroup) {
recursiveDisableExpressions(property);
continue;
}
if (!property.canSetExpression) {
continue;
}
if (property.expressionEnabled === true) {
property.expressionEnabled = false;
}
}
}
app.beginUndoGroup('Disable All Comp Expressions');
var comp = app.project.activeItem;
if (!(comp && comp instanceof CompItem)) {
alert('Open a comp!');
return;
}
for (var ii = 1; ii <= comp.numLayers; ii++) {
var layer = comp.layer(ii);
recursiveDisableExpressions(layer);
}
app.endUndoGroup();
})();