Yeah no rotation. But you should be able to reliably calculate rotation by using the smartObjectMore.transform array. Also, Photoshop doesn’t give smart objects an anchor point, so the UI shows the position as the center (average) of the 4 corners:
function rotationFromCorners(points) {
var A = points.upperLeft;
var B = points.upperRight;
var radians = Math.atan2(B.y - A.y, B.x - A.x);
return radians * (180/Math.PI);
}
function getAvgPointPosition(points) {
var xa = (points.upperLeft.x + points.upperRight.x + points.lowerRight.x + points.lowerLeft.x)/4;
var ya = (points.upperLeft.y + points.upperRight.y + points.lowerRight.y + points.lowerLeft.y)/4;
return {x:xa, y:ya};
}
// BatchPlay smartObjectMore.transform array of a 1920x1080 image
var t = [
0,
0,
1920,
0,
1920,
1080,
0,
1080
];
// Parse points from .transform into something more readable
var smartObjectPoints = {
upperLeft: {x:t[0], y:t[1]},
upperRight: {x:t[2], y:t[3]},
lowerRight: {x:t[4], y:t[5]},
lowerLeft: {x:t[6], y:t[7]}
};
var smartObjectRotation = rotationFromCorners(smartObjectPoints);
var smartObjectPosition = getAvgPointPosition(smartObjectPoints);
Keep in mind you may start to get inaccuracies from a simple 2-point rotation calculation if you start to throw stuff like Transform > Skew/Distort/Perspective into the mix. Then you may need to compare .transform to the smartObjectMore.nonAffineTransform data. It can get a little tricky, but if you know you’ll be dealing with mostly just basic SO transforms, using the corners should be consistent.