Copy link to clipboard
Copied
Hey,
I'm looking for a way to read the position values of a selected path vertex point. I know I can read the position of all vertices using this code:
var myLayer = app.project.item(1).layer(1);
var contents = myLayer.property("ADBE Root Vectors Group").property("ADBE Vector Group");
var shapeGroup = contents.property("ADBE Vectors Group");
var pathGroup = shapeGroup.property("ADBE Vector Shape - Group");
var myPath = pathGroup.property("ADBE Vector Shape");
var myShape = myPath.value;
alert(myShape.vertices);
But what if I want to select only one vertex and get only that position? Is there a way to find out whether or not a vertex is selected?
Thanks!
Nope, sorry, AE does not provide any API to get selected points, unfortunatelly.
There are 2 tools I've produced that deals with shapes and point selections:
https://aescripts.com/penpal and https://aescripts.com/vertex-tool
In Penpal extension we load the shape data into HTML Canvas and let user select points in there, and later perform actions based on the selection.
In the Vertex Tool I had a separate layer that "represents" selected layer by jumping from one vertex to another, when user clicks on a ScriptUI button. However, this is dumb way to do that. More professio
...Copy link to clipboard
Copied
Nope, sorry, AE does not provide any API to get selected points, unfortunatelly.
Copy link to clipboard
Copied
I wish it was possible, I could really use it right now. I want to write a script that lets you align path points (like in Illustrator). Now I know it's not possible to do it by getting the selected points, but do you know any other way I could make that happen?
Copy link to clipboard
Copied
There are 2 tools I've produced that deals with shapes and point selections:
https://aescripts.com/penpal and https://aescripts.com/vertex-tool
In Penpal extension we load the shape data into HTML Canvas and let user select points in there, and later perform actions based on the selection.
In the Vertex Tool I had a separate layer that "represents" selected layer by jumping from one vertex to another, when user clicks on a ScriptUI button. However, this is dumb way to do that. More professional way, avoiding the missing API for point selection from AEs side is implemented in Penpal.
What I'm trying to say here is that there's no perfect solution for this - what ever you do, is create a hacky way for a missing API.
Copy link to clipboard
Copied
Looks like it's going to be more difficult that I thought. Thank you for your help Tomas, hopefully I'll be anywhere near your level some day.
Copy link to clipboard
Copied
Select the Mask Path and then choose Window > Create Nulls From Paths. This results in a Null Object for each Mask Path Vertex, providing the corresponding position value of the vertex via the Null Object Position.
This script presents the following three options:
Which option is best depents on how you plant to animate and/or make edits later.
Copy link to clipboard
Copied
Thanks Warren, your response has really helped me!