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

Merged paths: lost subpaths and points with JSX

Contributor ,
Jan 28, 2017 Jan 28, 2017

Copy link to clipboard

Copied

Hi everyone,

I've created several paths

RmgdWS

Then I run this code to log the number of subpaths and points

for (var i = 0; i < activeDocument.pathItems[0].subPathItems.length; i++) {

    $.writeln("subpath: #" + i + "\t points: " + activeDocument.pathItems[0].subPathItems.pathPoints.length);

}

And I'm getting

subpath: #0 points: 4

subpath: #1 points: 4

subpath: #2 points: 4

Perfect. Then I do Merge Shape Components command and run the same code and I'm getting

subpath: #0 points: 4

Where're the other 2 subpaths? Or other 8 points?

I'm not sure if that's a bug or intentional, but is there a way to find these lost subpaths/points or maybe to un-merge the combined path?

Thanks,

Sergey

TOPICS
Actions and scripting

Views

595

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 1 Correct answer

Enthusiast , Jan 28, 2017 Jan 28, 2017

It seems to that I can see same issue.

I can't found this in DOM.

Anyway I like more action manager. You can do more with AM and you have better chance to see correct values. But it's more difficult.

If you want read values I recommend this:

GitHub - JavierAroche/descriptor-info: JSX module to recursively get all the properties in an ActionDescriptor used in A…

This can create object which looks like DOM approach but there is more properties. Anyway it is read-only. Example how to use it.

// Include t
...

Votes

Translate

Translate
Adobe
Enthusiast ,
Jan 28, 2017 Jan 28, 2017

Copy link to clipboard

Copied

It seems to that I can see same issue.

I can't found this in DOM.

Anyway I like more action manager. You can do more with AM and you have better chance to see correct values. But it's more difficult.

If you want read values I recommend this:

GitHub - JavierAroche/descriptor-info: JSX module to recursively get all the properties in an Action...

This can create object which looks like DOM approach but there is more properties. Anyway it is read-only. Example how to use it.

// Include the JSON helper 
#include "JSON.jsx"  // Include the descriptor-info module
#include "descriptor-info.jsx"     // ActionDescriptor example  
var ref = new ActionReference();    //ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );    ref.putEnumerated( charIDToTypeID("Path"), charIDToTypeID("Path"), stringIDToTypeID("vectorMask") );    var desc = executeActionGet(ref);      // Retrieve its properties by running the getProperties function, passing the ActionDescriptor as a param  // Optional @param {Object} descFlags // Optional @flag {Boolean} reference - return reference descriptors. Could slighly affect speed. // Optional @flag {Boolean} extended - returns extended information about the descriptor.
var descFlags = {
     reference : true,
     extended : false
};   var descObject = descriptorInfo.getProperties( desc ); // If using descFlags > descriptorInfo.getProperties( desc, descFlags );   $.writeln(JSON.stringify(descObject, null, 4)); // Running in ExtendScript  // Running in Brackets with the Brackets-to-Photoshop extension // https://github.com/JavierAroche/brackets-to-photoshop // Brackets-to-Photoshop extension includes the JSON helper by default  $.writeln(descObject);

This forum sh** with my code, so here is undeformed form.

[JavaScript] // Include the JSON helper #include "JSON.jsx" // Include the descriptor-info - Pastebi...

You need place JSON.jsx and descriptor-info.jsx in same folder as you script (or place their content inside your script).

Then you can run:

descObject.pathContents.pathComponents[0].pathComponent.subpathListKey[2].subpathsList.points[3].pathPoint.anchor.horizontal

In: "subpathListKey" you should see your subpaths which are merged into one path inside path-layer. Paths which are not merged should be in "pathComponents"

Descriptor is for selected layer vector mask.

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
Contributor ,
Jan 28, 2017 Jan 28, 2017

Copy link to clipboard

Copied

LATEST

Ooooh, thank you so much, Jarda, I forgot to try to find the points with AM-code

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