Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

How can I retrieve the transform information on a layer

$
0
0

I am trying to retrieve the transformation information on a layer through script (for a smart object if it matters).

 

I've been able to do it if there is a text layer attached, but I need to be able to do it with just the smart object.

 

This is what I have so far:

 

var idnull = charIDToTypeID("null");

var layerReference = new ActionReference();

layerReference.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));

var layerDescriptor = new ActionDescriptor();

layerDescriptor.putReference(idnull, layerReference);

layerDescriptor.putEnumerated(charIDToTypeID("FTcs"), charIDToTypeID("QCSt"), charIDToTypeID("Qcsa"));

var transformDescriptor = app.executeAction(charIDToTypeID("Trnf"), layerDescriptor, DialogModes.NO);

var offset= transformDescriptor.getObjectValue(charIDToTypeID("Ofst"));

var horizontalOffset = offset.getUnitDoubleValue(charIDToTypeID("Hrzn"));

var verticalOffset = offset.getUnitDoubleValue(charIDToTypeID("Vrtc"));

 

However, horizontalOffset and verticalOffset are both returned as zero.

 

Thanks in advance, Mark.


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>