Created
July 1, 2012 17:08
-
-
Save ff6347/3028987 to your computer and use it in GitHub Desktop.
Split The Shapes from one layer to multiple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
main(); | |
function main(){ | |
app.beginUndoGroup("Split Shape layer"); | |
var curComp = app.project.activeItem; | |
if (!curComp || !(curComp instanceof CompItem)){ | |
alert("Please select a Composition."); | |
return; | |
} | |
if (curComp.selectedLayers.length < 1){ | |
alert("Please select at least one layer"); | |
return; | |
} | |
var shapelayer = curComp.selectedLayers[0]; | |
if(shapelayer instanceof ShapeLayer){ | |
}else{ | |
return; | |
}; | |
var number = shapelayer("ADBE Root Vectors Group").numProperties; | |
for(var i = 1 ; i < number;i++){ | |
var shape = shapelayer("ADBE Root Vectors Group").property(i).property("ADBE Vector Shape").value; | |
var newLayer = curComp.layers.addShape(); | |
newLayer.anchorPoint.setValue([curComp.width/2,curComp.height/2]) | |
newLayer.name = "Shape"; | |
var vcs = newLayer("ADBE Root Vectors Group").addProperty("ADBE Vector Shape - Group"); | |
var maskShape = vcs.property("ADBE Vector Shape"); | |
maskShape.setValue(shape); | |
var fill = newLayer("ADBE Root Vectors Group").addProperty("ADBE Vector Graphic - Fill"); | |
fill.property("ADBE Vector Fill Color").setValue([1,1,1]); | |
fill.property("ADBE Vector Fill Opacity").setValue(100); | |
//~ var bMstroke = newLayer("ADBE Root Vectors Group").addProperty("ADBE Vector Graphic - Stroke"); | |
//~ bMstroke.property("ADBE Vector Stroke Color").setValue(meta.bMarkerStrokeColor); | |
//~ bMstroke.property("ADBE Vector Stroke Width").setValue(1); | |
//~ bMstroke.property("ADBE Vector Stroke Opacity").setValue(meta.bMarkerFillTint); | |
} | |
app.endUndoGroup(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment