-
Notifications
You must be signed in to change notification settings - Fork 56
/
separateBrushes.jsx
39 lines (33 loc) · 1.49 KB
/
separateBrushes.jsx
1
//snippet to separate brushes into different layers//CC-BY, Nik Ska, 2014var separateBrushes = this;separateBrushes.separate = function(_removeOrigin){ var activeComp = app.project.activeItem; if(activeComp && activeComp instanceof CompItem){ var sel = activeComp.selectedLayers; if(sel){ //getting first selected layer brushes var brushes = sel[0].property("ADBE Effect Parade").property("ADBE Paint").property("ADBE Paint Group"); if(brushes){ app.beginUndoGroup("Separating brushes"); for(var i = 1; i <= brushes.numProperties; i++){ //first we duplicate a layer var newLayer = sel[0].duplicate(); newLayer.name+= (' - ' + brushes.property(i).name); //now getting its brushes var newLayerBrushes = newLayer.property("ADBE Effect Parade").property("ADBE Paint").property("ADBE Paint Group"); //cycling though brushes and removing the ones we don't need for(var j = brushes.numProperties; j>0; j--){ if(j!=i) newLayerBrushes.property(j).remove() } } //disabling original layer sel[0].enabled = false; //or removing it if(_removeOrigin) sel[0].remove(); app.endUndoGroup(); } } }}separateBrushes.separate(false)