We’ve written a few classes to serialize various objects, one way we’re thinking of handling this is by adding a ‘special’ method to the classes we want to write out.
We’ve managed to do this with motionbuilder thanks to python’s flexibility, however we’re unable to add methods to any maya.api.OpenMaya classes:
def my_method(self): return 'my_method' maya.api.OpenMaya.MObject.my_method = my_method # Error: TypeError: file <maya console> line 1: can't set attributes of built-in/extension type 'OpenMaya.MObject' #
This is the case for almost all maya.api classes. Has anyone gotten around this?