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

How to get the anchor point of smart object from script?

Community Beginner ,
Aug 05, 2020 Aug 05, 2020

I am using java script to parse the PSD file and generate layer information in another format. 

In target PSD, smart object layers are expected to be rotated/scaled with certain Anchor Point (Pivot) and it need not to be MIDDLECENTRE. In such case how can i calculate the Anchor Point from layer. I am using Adobe Photoshop CC 2020. 

TOPICS
Actions and scripting
1.2K
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 , Aug 05, 2020 Aug 05, 2020

It hard to deal with Smart Object layer in a Photoshop Script unless the Script created the Smart Object for it the knows quite a bit about the  Object Smart Object layer Object Transform That it is not distorting or rotating the object. The  object transform may be  scaling the object but the script can scale it to 100% and get the bounds of  the layer know the object size.   

 

If the smart exist and your script did not create you may be able to use the code r-bin posted in this forum to the g

...
Translate
Adobe
Community Beginner ,
Aug 05, 2020 Aug 05, 2020

layer.anchorPoint returns undefined

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 ,
Aug 05, 2020 Aug 05, 2020

Please explain what you are talking about; how is the anchor point defined, …? 

Maybe post a screenshot including the pertinent Panels to clarify. 

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 ,
Aug 05, 2020 Aug 05, 2020
LATEST

It hard to deal with Smart Object layer in a Photoshop Script unless the Script created the Smart Object for it the knows quite a bit about the  Object Smart Object layer Object Transform That it is not distorting or rotating the object. The  object transform may be  scaling the object but the script can scale it to 100% and get the bounds of  the layer know the object size.   

 

If the smart exist and your script did not create you may be able to use the code r-bin posted in this forum to the get  information about the existing Object transform.  You seem to  get the four corner points and the warping data.  If the four corners form a perfect rectangle the Object  may not currently be rotated or distorted but it could be rotated some multiple of 90 and the aspect ratio could have been  change to distort the object.

 

Here is a Smart object layer in a mockup.  Other Smart object Layer in the mockup share this smart Object.  Each Smart Object  layer has it own complex transform for the layer that transforms rotates and warps the object for the layer's use.  Look at the seat back transform and warp.  Wrapping is a transform option look at the transform tool option bar. 

Capture.jpg

JJMack
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