I'm developing a C++ plugin and I would like to know a way to work with a non-Maya class objects through the scene. I mean, I want to have an instance of a class external to Maya API as attribute of the Node class. The class is quite complex and is composed by multiple classes.
What I've seen is that a Node can give me Structured Data Storage, but as far as I know it works only with Maya types which is not enough for my purposes.
Right now I'm using MPxCommand to execute the computation of that object, but once it has finished, it's destroyed. I want to keep it alive in the scene so I need to use Nodes somehow. At the moment it's not necessary storing the data.
So, do you know a way to do the equivalent in Maya of a typical OOP class? I've not found any example in the devkit or documentation.
class Foo : public MPxNode
{
public:
Foo () {};
virtual ~Foo () {};
virtual MStatus compute(const MPlug& plug, MDataBlock& data);
static void* creator();
static MStatus initialize();
static MObject inputMesh;
static MTypeId id;
// I want to keep it alive through the scene.
// static ClassBar myBarObject; // How can I do this??
// barFunction(...); // use ClassBar myBarObj
};
MObject Foo::inputMesh;
MTypeId Foo::id( 0x80000 );
//ClassBar Foo::myBarObj; // ????
Thank you very much