-
Paint effect stroke shape to Shape layer shape via script
Hi!
IWhen working with paint stroke effect, I usually like to paste the path info to a shape layer’s path (as easy as go to the paint stroke path, then copy, and go to the shape layer path and paste.
BUT I’m trying to automate that a bit via scripting, so when the script is executed, it automatically copies that info of the stroke path value and paste into the shape layer’s path value.
I was reading a bit here at the redefinery site but Im totally stuck, because I don’t know how to use the stored data in the paintStroke array he mentions about, and paste into the shapePathData of a new created shape(this is the code from the Redefinery article, just in case you can’t click at the link)
// given:
// layer = Layer object, and the layer can have effects applied
//
var selectedPaintBrushes = new Array(); // Store brush strokes in an array
var effects = layer.property("Effects"); // Look for layers that can have effects
if (effects !== null)
{
var effect, paintStrokes, paintStroke;
// Iterate over all effects on the layer
for (var i = 1; i <= effects.numProperties; i++)
{
effect = effects.property(i);
if (effect.matchName === "ADBE Paint") // Look for Paint effects
{
// Get PropertyGroup containing the strokes
paintStrokes = effect.property("ADBE Paint Group");
// Iterate over the brush strokes
for (var j = 1; j <= paintStrokes.numProperties; j++)
{
// Store only selected strokes in the array
paintStroke = paintStrokes.property(j);
if (paintStroke.selected)
selectedPaintBrushes[selectedPaintBrushes.length] = paintStroke;
}
}
}
}
// The selectedPaintBrushes array now contains the list of selected paint brush strokes
// in top-to-bottom order
do you have any ideas?
thanks!