forked from ae-scripting/scripting-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrimFirstToSecond.jsx
More file actions
28 lines (25 loc) · 830 Bytes
/
trimFirstToSecond.jsx
File metadata and controls
28 lines (25 loc) · 830 Bytes
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
//Trim First Selected layer to the second one
//CC-BY-SA Nik Ska, 2013
var ns_Trim = {}
ns_Trim.go = function(){
var activeComp = app.project.activeItem; //active item
if(activeComp && activeComp instanceof CompItem){ //if it's a comp
var sel = activeComp.selectedLayers; //selected layers
app.beginUndoGroup("Trim"); //Undo
if(sel.length>1){ //if more than 1 are selected
//sel[0].startTime = sel[1].startTime; //trim
sel[0].inPoint = sel[1].inPoint;
sel[0].outPoint = sel[1].outPoint;
var prev = sel[1]; //remembering previous layer
}
else if(prev){
//with layer remembered
//trim all firther selected
sel[0].startTime = prev.startTime;
sel[0].inPoint = prev.inPoint;
sel[0].outPoint = prev.outPoint;
}
app.endUndoGroup(); //closing Undo
}
}
ns_Trim.go()