forked from ae-scripting/scripting-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprecompSelected.jsx
More file actions
32 lines (25 loc) · 847 Bytes
/
Copy pathprecompSelected.jsx
File metadata and controls
32 lines (25 loc) · 847 Bytes
1
//Snippet to precomp all selected layers into separate comps//CC-BY, Nik Ska, 2014var precompSelected = this;precompSelected.go = function(_moveAllAttributes){ var activeComp = app.project.activeItem; if(activeComp && activeComp instanceof CompItem){ var sel = activeComp.selectedLayers; if(sel){ app.beginUndoGroup("Batch Precomp"); //sort selection by index sel = sel.sort(function(a,b){ return (b.index - a.index) }); for(var s = sel.length-1; s>=0; s--){ //check for Text of Shape layers if(sel[s] instanceof ShapeLayer || sel[s] instanceof TextLayer) move = true; else move = _moveAllAttributes; var p = activeComp.layers.precompose([sel[s].index], sel[s].name+"_precomp", move); p.parentFolder = activeComp.parentFolder; } app.endUndoGroup(); } }}precompSelected.go(false)