The goal is to adjust a current path points of an existing shape layer.
I’m able to generate and add a new path (top left), and remove the old path, however the new path doesn’t have the same fill.
export const asModal = async (name: string, callback: Function) => {
return await photoshop.core.executeAsModal(async () => await callback(), { name});
};
export const shapeTrial = () => {
const points = [[0, 0],[0, 200],[200, 200],[200, 0]];
asModal("shape", async () => {
let pointInfos = points.map((point) => {
const psPoint = new photoshop.app.PathPointInfo();
psPoint.anchor = point;
psPoint.leftDirection = point;
psPoint.rightDirection = point;
psPoint.kind = photoshop.constants.PointKind.CORNERPOINT;
return psPoint;
});
const spi = new photoshop.app.SubPathInfo();
spi.closed = true;
spi.operation = photoshop.constants.ShapeOperation.SHAPEXOR;
spi.entireSubPath = pointInfos;
photoshop.app.activeDocument.pathItems.add("box", [spi]);
});
};
I think I need to update the points on the original path to preserve the fill, but I’m not seeing a way to via the API so far as the pathPoints
object seems to be read-only.
photoshop.app.activeDocument.pathItems[0].subPathItems[0].pathPoints
Also tried Alchemist by @Jarda, but it doesn’t seem to record any relevant BatchPlay events when moving points around with the Direct Selection tool.