Hi,
I’m struggling to get layer bounds in Photoshop via Adobe framework.
Here is example code:
import sgtk
engine = sgtk.platform.current_engine()
adobe = engine.adobe
active_document = adobe.app.activeDocument
active_layer = active_document.activeLayer
bounds = active_layer.bounds
active_layer.bounds unfortunately returns a list of dictionaries representing UnitValue objects but not the actual object (which, from my understanding, should be an instance of ProxyWrapper).
# Results:
# [{u'instanceof': u'UnitValue', u'description': u'', u'__uniqueid': 1363, u'help': u'', u'properties': [u'type', u'value', u'baseUnit', u'__proto__'], u'methods': {u'convert': {u'description': u'Convert this instance to a different unit.', u'__uniqueid': 1361, u'dataType': u'boolean', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'convert'}, u'as': {u'description': u'Return this instance as a different unit.', u'__uniqueid': 1362, u'dataType': u'UnitValue', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'as'}}}, {u'instanceof': u'UnitValue', u'description': u'', u'__uniqueid': 1366, u'help': u'', u'properties': [u'type', u'value', u'baseUnit', u'__proto__'], u'methods': {u'convert': {u'description': u'Convert this instance to a different unit.', u'__uniqueid': 1364, u'dataType': u'boolean', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'convert'}, u'as': {u'description': u'Return this instance as a different unit.', u'__uniqueid': 1365, u'dataType': u'UnitValue', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'as'}}}, {u'instanceof': u'UnitValue', u'description': u'', u'__uniqueid': 1369, u'help': u'', u'properties': [u'type', u'value', u'baseUnit', u'__proto__'], u'methods': {u'convert': {u'description': u'Convert this instance to a different unit.', u'__uniqueid': 1367, u'dataType': u'boolean', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'convert'}, u'as': {u'description': u'Return this instance as a different unit.', u'__uniqueid': 1368, u'dataType': u'UnitValue', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'as'}}}, {u'instanceof': u'UnitValue', u'description': u'', u'__uniqueid': 1372, u'help': u'', u'properties': [u'type', u'value', u'baseUnit', u'__proto__'], u'methods': {u'convert': {u'description': u'Convert this instance to a different unit.', u'__uniqueid': 1370, u'dataType': u'boolean', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'convert'}, u'as': {u'description': u'Return this instance as a different unit.', u'__uniqueid': 1371, u'dataType': u'UnitValue', u'help': u'', u'arguments': [{u'dataType': u'string', u'help': u'', u'name': u'unitName', u'description': u'The unit name.'}], u'name': u'as'}}}]
Is this an intended behavior, or simply a limitation of how the bridge to photoshops API was implemented?
Is there a way to somehow capture this objects if we have their serialized representations?
Cheers,
Aleksandar