-
Notifications
You must be signed in to change notification settings - Fork 11
/
Duplicate Selected Layer.jsx
28 lines (27 loc) · 1.09 KB
/
Duplicate Selected 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
/**
* @name Duplicate Selected Layer
* @version 1.0
* @author Kyle Martinez <www.kyle-martinez.com>
*
* @description Exactly like selected layer and hitting CMD/CTRL + D. But instead of moving the
* duplicated layer above the selected layer, move the duplicated layer below the selected layer.
* This script currently only supports duplicating the first selected layer and will ignore any
* other selected layers.
*
* @license This script is provided "as is," without warranty of any kind, expressed or implied. In
* no event shall the author be held liable for any damages arising in any way from the use of this
* script.
*
* In other words, I'm just trying to help make life as an animator easier
* "A rising tide lifts all boats." - John F. Kennedy, 1963
*/
(function duplicateSelectedLayer() {
app.beginUndoGroup("Duplicate Selected Layer");
var comp = app.project.activeItem;
var oldLayer = comp.selectedLayers[0];
var newLayer = oldLayer.duplicate();
newLayer.moveAfter(oldLayer);
oldLayer.selected = false;
newLayer.selected = true;
app.endUndoGroup();
})();