Skip to content

Commit 65b5aab

Browse files
committed
minor updates
1 parent 0e52ad0 commit 65b5aab

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

scripts/Make Hold Keyframes.jsx

+15-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name Make Hold Keyframes
3-
* @version 1.3
3+
* @version 1.4
44
* @author Kyle Martinez <www.kyle-martinez.com>
55
*
66
* @description Convert selected keyframes into hold keyframes.
@@ -13,36 +13,29 @@
1313
* "A rising tide lifts all boats." - John F. Kennedy, 1963
1414
*/
1515

16-
(function() {
17-
function makeHoldKeyframe (property, key) {
18-
var hold = KeyframeInterpolationType.HOLD;
19-
property.setInterpolationTypeAtKey(key, hold, hold);
20-
}
16+
(function makeHoldKeyframes() {
17+
var HOLD = KeyframeInterpolationType.HOLD;
2118

22-
function findSelectedKeyframes (property) {
19+
function setKeyframesToHold(property) {
2320
var keys = property.selectedKeys;
2421
var numKeys = keys.length;
2522
for (var k = 0; k < numKeys; k++) {
26-
var key = keys[k];
27-
makeHoldKeyframe(property, key);
23+
var index = keys[k];
24+
property.setInterpolationTypeAtKey(index, HOLD, HOLD);
2825
}
2926
}
3027

31-
function findSelectedProperties (comp) {
32-
var properties = comp.selectedProperties;
33-
var numProperties = properties.length;
34-
for (var p = 0; p < numProperties; p++) {
35-
var property = properties[p];
36-
if (property.canVaryOverTime === true) {
37-
findSelectedKeyframes(property);
28+
app.beginUndoGroup("Make Hold Keyframe(s)");
29+
var comp = app.project.activeItem;
30+
var properties = comp.selectedProperties;
31+
var numProperties = properties.length;
32+
for (var p = 0; p < numProperties; p++) {
33+
var property = properties[p];
34+
if (property.propertyType === PropertyType.PROPERTY) {
35+
if (property.isTimeVarying === true) {
36+
setKeyframesToHold(property);
3837
}
3938
}
4039
}
41-
42-
app.beginUndoGroup("Make Hold Keyframes");
43-
var comp = app.project.activeItem;
44-
if (comp !== null && (comp instanceof CompItem)) {
45-
findSelectedProperties(comp);
46-
}
4740
app.endUndoGroup();
4841
})();

0 commit comments

Comments
 (0)