Is there any way to retrieve angle and scale information of smart object?
I need to retrieve scale and rotation information changes of a smart object in a video animation using a script.
How can I do this?
I need to retrieve scale and rotation information changes of a smart object in a video animation using a script.
How can I do this?
on CC2018 it works, on CS6 do not.
function get_smart_object_corners() returns array from 4 corner-points (x,y) of smart object in pixels (value with floating point)
you can caclulate angle and vertical or horisontal dimentions.
))
Code example:
////////////////////////////////////////////////////////////////////////////////////////////
var points = get_smart_object_corners();
var w = points[0][0] - points[1][0];
var h = points[0][1] - points[1][1];
var angle = Math.atan(h/w) * 180.0 / Math.PI;
alert ("Angle is " + angle.toFixed(3) + "°");
////////////////////////////////////////////////////////////////////////////////////////////
function get_smart_object_corners()
{
try
{
var r = new ActionReference();
r.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
var d;
try { d = executeActionGet(r); } catch (e) { alert(e); return; }
try { d = d.getObjectValue(stringIDToTypeID("smartObjectMore")); } catch (e) { alert(e); return; }
try { d = d.getList(stringIDToTypeID("transform")); } catch (e) { alert(e); return; }
var ret = [[d.getDouble(0),d.getDouble(1)],
[d.getDouble(2),d.getDouble(3)],
[d.getDouble(4),d.getDouble(5)],
[d.getDouble(6),d.getDouble(7)]];
return ret;
}
catch (e) { alert(e); }
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.