Copy link to clipboard
Copied
I need help figuring out how to add the shape to a group. I need access to the group transforms so I can position each of the paths I am creating.
Here is an image of what I would like to achieve.
https://drive.google.com/file/d/1OEzRtp1ILlZR7L5T_7BPfk-JlYiaQRPg/view?usp=...
What I have so far only creates a shape layer with a vector path without a group.
var sVerts= [[-4.66796875,-4.614013671875],[-4.66796875,-1.584716796875],[4.701171875,-1.584716796875],[8.44921875,1.823486328125],[8.44921875,3.798095703125],[4.701171875,7.206298828125],[-4.66796875,7.206298828125],[-8.44921875,3.798095703125],[-8.44921875,3.387939453125],[-5.3125,2.809814453125],[-5.3125,4.512939453125],[5.283203125,4.512939453125],[5.283203125,1.208251953125],[-4.048828125,1.208251953125],[-7.833984375,-2.199462890625],[-7.833984375,-3.797607421875],[-4.048828125,-7.206298828125],[4.498046875,-7.206298828125],[8.283203125,-4.072998046875],[8.283203125,-3.729248046875],[5.248046875,-3.082275390625],[5.248046875,-4.614013671875]]; var sITans= [[0,0],[0,0],[0,0],[0,-2.7265625],[0,0],[2.86328125,0],[0,0],[0,2.693359375],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,2.728515625],[0,0],[-2.83203125,0],[0,0],[0,-2.51806640625],[0,0],[0,0],[0,0]]; var sOTans = [[0,0],[0,0],[0,0],[0,-2.7265625],[0,0],[2.86328125,0],[0,0],[0,2.693359375],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,2.728515625],[0,0],[-2.83203125,0],[0,0],[0,-2.51806640625],[0,0],[0,0],[0,0]]; logoShapeLayer = activeItem.layers.addShape(); logoShapeLayer.name="S Path"; sShapeGroup = logoShapeLayer.property("ADBE Root Vectors Group"); sShapeGroup.addProperty("ADBE Vector Shape - Group"); logoShapeGroup.addProperty("ADBE Vector Graphic - Fill"); var sShape = new Shape(); sShape.vertices = sVerts; sShape.inTangents = sITans; sShape.outTangents = sOTans; sShape.closed = true; sShapeGroup.property(1).property("ADBE Vector Shape").setValue(sShape);
Like this:
var sShape = new Shape(); sShape.vertices = sVerts; sShape.inTangents = sITans; sShape.outTangents = sOTans; sShape.closed = true;
var layer = activeItem.layers.addShape();
layer.name="S Path";
var group = layer.content.addProperty("ADBE Vector Group");
group.name = "Subgroup";
var pathGroup = group.content.addProperty("ADBE Vector Shape - Group");
pathGroup.property("ADBE Vector Shape").setValue(sShape);
You could also refer to the "Contents" property using matchnames, but that only compli
...Copy link to clipboard
Copied
Like this:
var sShape = new Shape(); sShape.vertices = sVerts; sShape.inTangents = sITans; sShape.outTangents = sOTans; sShape.closed = true;
var layer = activeItem.layers.addShape();
layer.name="S Path";
var group = layer.content.addProperty("ADBE Vector Group");
group.name = "Subgroup";
var pathGroup = group.content.addProperty("ADBE Vector Shape - Group");
pathGroup.property("ADBE Vector Shape").setValue(sShape);
You could also refer to the "Contents" property using matchnames, but that only complicates things.
The matchName of the content of a layer is "ADBE Root Vectors Group", and that of a group is "ADBE Vectors Group"
(and also: unlike the Root one, the "Contents" of a group is elided - doesnt appear in the UI).
Xavier
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more