• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Finding if a vertex point is selected from a script

Explorer ,
Apr 07, 2021 Apr 07, 2021

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!

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Advocate , Apr 07, 2021 Apr 07, 2021

Nope, sorry, AE does not provide any API to get selected points, unfortunatelly.

Votes

Translate

Translate
Advocate , Apr 07, 2021 Apr 07, 2021

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

...

Votes

Translate

Translate
Advocate ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

Nope, sorry, AE does not provide any API to get selected points, unfortunatelly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 07, 2021 Apr 07, 2021

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 07, 2021 Apr 07, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 07, 2021 Apr 07, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2021 Apr 07, 2021

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:

  • Points Follow Nulls
  • Nulls Follow Points
  • Trace Path

 

Which option is best depents on how you plant to animate and/or make edits later.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

LATEST

Thanks Warren, your response has really helped me! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines