Search code examples
pythoncameramayasetattr

Set Maya Image Plane Attr "Image Number" to expression "=frame" through python


I'm trying to set the attribute "Image Number" to the expression "=frame" through python. Currently I've tried

cmds.setAttr(myImagePlane+".ufe", 1)
cmds.setAttr(myImagePlane+".fe", '=frame')

Which doesn't work as .fe only takes integers. From maya documentation I don't see an attribute directly for image number. How can I get around this without the user having to manually create the expression?


Solution

  • you can create an expression through cmds.expression

    cmds.expression(o=myImagePlane, s='{}.fe = frame;'.format(myImagePlane))