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

The script for obtaining the Bezier curve coordinates of the deformed smart object was not fou

Community Beginner ,
Mar 22, 2024 Mar 22, 2024

I am writing a script that obtains the Bessel curve coordinate data after obtaining the deformation of the smart object, and I didn’t find the relevant API.

 

const layers = app.activeDocument.layers;

for(var i = 0; i < layers.length; ++i) {

  var layer = layers[i];

  if (layer.kind === LayerKind.SMARTOBJECT) {
    alert(layer.kind);
    // layer, Layer is an smart object, but the smart object data cannot be obtained from Layer
  }
}
TOPICS
Actions and scripting
829
Translate
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

Community Expert , Mar 22, 2024 Mar 22, 2024

Does this help? 

// get stuff for warp on a smart objects;
// based on code by michael l hale;
// 2024, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
var
...
Translate
Adobe
Community Expert ,
Mar 22, 2024 Mar 22, 2024

I don’t understand what you mean. 

Please explain with the help of screenshots/sketches. 

Translate
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 Beginner ,
Mar 22, 2024 Mar 22, 2024

17110983074029.png
I want to get these coordinate data

Translate
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 ,
Mar 22, 2024 Mar 22, 2024

Does this help? 

// get stuff for warp on a smart objects;
// based on code by michael l hale;
// 2024, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
var placedDesc = soDesc.getEnumerationValue(stringIDToTypeID('placed'));
var theFileRef = soDesc.getString(stringIDToTypeID('fileReference'));
var theDocID = soDesc.getString(stringIDToTypeID('documentID'));
var warp = soMoreDesc.getObjectValue(stringIDToTypeID("warp"));
var envelopeWarp = warp.getObjectValue(stringIDToTypeID("customEnvelopeWarp"));
var meshPoints = envelopeWarp.getList(stringIDToTypeID("meshPoints"));
var xx = new Array;
for (var m = 0; m < meshPoints.count; m++) {
    xx.push(checkDesc2 (meshPoints.getObjectValue(m)));
};
alert ("warp\n\n"+xx.join("\n\n"));
};
//////
////// based on code by michael l hale //////
function checkDesc2 (theDesc, theAlert) {
var c = theDesc.count;
var str = '';
for(var i=0;i<c;i++){ //enumerate descriptor's keys
str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';
};
if (theAlert == true) {alert("desc\n\n"+str);
return};
return str
};
////// check //////
function getValues (theDesc, theNumber) {
switch (theDesc.getType(theDesc.getKey(theNumber))) {
case DescValueType.ALIASTYPE:
return theDesc.getPath(theDesc.getKey(theNumber));
break;
case DescValueType.BOOLEANTYPE:
return theDesc.getBoolean(theDesc.getKey(theNumber));
break;
case DescValueType.CLASSTYPE:
return theDesc.getClass(theDesc.getKey(theNumber));
break;
case DescValueType.DOUBLETYPE:
return theDesc.getDouble(theDesc.getKey(theNumber));
break;
case DescValueType.ENUMERATEDTYPE:
return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStringID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));
break;
case DescValueType.INTEGERTYPE:
return theDesc.getInteger(theDesc.getKey(theNumber));
break;
case DescValueType.LISTTYPE:
return theDesc.getList(theDesc.getKey(theNumber));
break;
case DescValueType.OBJECTTYPE:
return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObjectType(theDesc.getKey(theNumber))));
break;
case DescValueType.REFERENCETYPE:
return theDesc.getReference(theDesc.getKey(theNumber));
break;
case DescValueType.STRINGTYPE:
return theDesc.getString(theDesc.getKey(theNumber));
break;
case DescValueType.UNITDOUBLE:
return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUnitDoubleType(theDesc.getKey(theNumber))));
break;
default: 
break;
};
};
Translate
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 Beginner ,
Mar 22, 2024 Mar 22, 2024

Error 8800: Conventional Photoshop errors occur. This function may not be used in this version of Photoshop:
-<No basis information is available>
Line: 15
var envelPewarp = Warp.getObjectValue (Stringidtotypeid ("customEnvelopeWarp");



Translate
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 ,
Mar 22, 2024 Mar 22, 2024

Could you please post meaningful screenshots with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible? 

Is a Smart Object with a Warp applied the active Layer? 

Screenshot 2024-03-22 at 11.01.34.pngScreenshot 2024-03-22 at 11.01.52.png

Translate
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 Beginner ,
Mar 22, 2024 Mar 22, 2024

Is there any corresponding action documentation

Translate
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 ,
Mar 22, 2024 Mar 22, 2024
quote

Is there any corresponding action documentation


By @zeyou36248626sb54

What do you mean? 

What good would Actions be in this case? 

Translate
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 Beginner ,
Mar 22, 2024 Mar 22, 2024

Want to see some "ACTINDEScripts" related documents, improve the skills

Translate
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 ,
Mar 22, 2024 Mar 22, 2024

Thing is ExtendScript Photoshop Scripting is on legacy status and may »vanish« at some point in the future. 

So if you are (relatively) new to the matter you may want to focus on UXP Scripting right away. 

 

For ExtendScript you could do a search for »photoshop-scripting-guide-2020.pdf« and »photoshop-javascript-ref-2020.pdf«. 

You could also look into @DavideBarranca ’s book/s, I think he has published on both ES and UXP Sxripting. 

https://www.ps-scripting.com/professional-ps-uxp.html

Translate
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 Beginner ,
Mar 22, 2024 Mar 22, 2024

It can be successful with my other file, which may be caused by different operations. You have helped me, thank you

Translate
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 Beginner ,
Mar 22, 2024 Mar 22, 2024

Blue dot coordinate data

Translate
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 ,
Mar 22, 2024 Mar 22, 2024

May I ask how you intend to process/use the information? 

Translate
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 ,
Jul 11, 2025 Jul 11, 2025

The default is 16 control points, which is normal. If you add control points manually, an error will be reported. customEnvelopeWarp does not exist

Translate
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 ,
Jul 11, 2025 Jul 11, 2025
quote

customEnvelopeWarp does not exist

Can you provide the image file for testing? 

Translate
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 ,
Jul 11, 2025 Jul 11, 2025

Please try this Script: 

// get stuff for warp on a smart objects;
// based on code by michael l hale;
// 2025, use it at your own risk;
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
var placedDesc = soDesc.getEnumerationValue(stringIDToTypeID('placed'));
var theFileRef = soDesc.getString(stringIDToTypeID('fileReference'));
var theDocID = soDesc.getString(stringIDToTypeID('documentID'));
if (soMoreDesc.hasKey(stringIDToTypeID('quiltWarp'))) {
var quiltWarp = soMoreDesc.getObjectValue(stringIDToTypeID('quiltWarp'));
var envelopeWarp = quiltWarp.getObjectValue(stringIDToTypeID("customEnvelopeWarp"));
} else {
var warp = soMoreDesc.getObjectValue(stringIDToTypeID("warp"));
var envelopeWarp = warp.getObjectValue(stringIDToTypeID("customEnvelopeWarp"));
};
var meshPoints = envelopeWarp.getList(stringIDToTypeID("meshPoints"));
var xx = new Array;
for (var m = 0; m < meshPoints.count; m++) {
    xx.push(checkDesc2 (meshPoints.getObjectValue(m)));
};
alert (meshPoints.count+" points in warp\n\n"+xx.join("\n\n"));
};
//////
////// based on code by michael l hale //////
function checkDesc2 (theDesc, theAlert) {
var c = theDesc.count;
var str = '';
for(var i=0;i<c;i++){ //enumerate descriptor's keys
str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';
};
if (theAlert == true) {alert("desc\n\n"+str);
return};
return str
};
////// check //////
function getValues (theDesc, theNumber) {
switch (theDesc.getType(theDesc.getKey(theNumber))) {
case DescValueType.ALIASTYPE:
return theDesc.getPath(theDesc.getKey(theNumber));
break;
case DescValueType.BOOLEANTYPE:
return theDesc.getBoolean(theDesc.getKey(theNumber));
break;
case DescValueType.CLASSTYPE:
return theDesc.getClass(theDesc.getKey(theNumber));
break;
case DescValueType.DOUBLETYPE:
return theDesc.getDouble(theDesc.getKey(theNumber));
break;
case DescValueType.ENUMERATEDTYPE:
return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStringID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));
break;
case DescValueType.INTEGERTYPE:
return theDesc.getInteger(theDesc.getKey(theNumber));
break;
case DescValueType.LISTTYPE:
return theDesc.getList(theDesc.getKey(theNumber));
break;
case DescValueType.OBJECTTYPE:
return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObjectType(theDesc.getKey(theNumber))));
break;
case DescValueType.REFERENCETYPE:
return theDesc.getReference(theDesc.getKey(theNumber));
break;
case DescValueType.STRINGTYPE:
return theDesc.getString(theDesc.getKey(theNumber));
break;
case DescValueType.UNITDOUBLE:
return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUnitDoubleType(theDesc.getKey(theNumber))));
break;
default: 
break;
};
};
Translate
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 ,
Jul 11, 2025 Jul 11, 2025
LATEST

The script works fine, thank you very much。

Translate
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