MPxNode - retain variables data after reload scene

MPxNode - retain variables data after reload scene

Anonymous
Not applicable
327 Views
1 Reply
Message 1 of 2

MPxNode - retain variables data after reload scene

Anonymous
Not applicable

Hi there,

Is there a way to restore variables data within MPxNode after then Maya scene was reloaded?

 

For example in MPxNode constructor i use cycle for append some MPointArray, determined in this node by me.

By default, as i see, after when you reopen scene again, your MPxNode already has not these data, it just empty.

0 Likes
328 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Okay, as i tested, Maya create MPxNode again, after scene was reloaded. So Maya again uses constructor and destructor. (I use c++ MPxNode Plug-in verson).

So, if you want restore your custom variables data of you custom MPxNode object, you can

1 - write special class method in MPxNode, which will save and load your data to HDD

2 - use attributes of MPxNode, because these attributes can be storable (save with the scene automaticly)

 

It is good that MPxNode can contain big count of any types custom attributes. kPointArray, kDoubleArray, kStringArray, etc. These special attributes can be just not writable and readable, also can be hidden. So nobody will know that you node have special attributes for storing custom data.

 

Tested today thes second method, with custom special attributes, - work just fine.

0 Likes