Serialize python objects unsupported by pickle?

Hey there,

i was wondering if there is a way to serialize objects that are unsupported by pickle. Specifically i am talking about c extensions that do not support pickiling. Even more specifically i am talking about blur python object in 3dsmax :wink:

Is there a way to simply dump the object from memory to disk or alike? Yes…i am desperate heh

Cheers,
Thorsten

Oh…alternatively i’d be happy with a custom maxscript way to serialize complex materials :wink:

There’s no way to magically dump memory to a file, then restore it later. You can, however, “teach” pickle how to deal with objects it doesn’t natively support. It requires you to write code to do that serialization/deserialization. See the Pickle page in the Python docs… in particular section 11.1.4 and onward, covering getstate and setstate.

I kinda doubt this will help much with the example you listed, however.

I would have to tweak the c extension and implement that i guess…and that would probably be a real mess, as the value_wrapper object is wrapping every mxs object automagically…Prolly have to look at generating .mats and storing as blob. Or see if MaxPlus allows pickling objects (prolly not given the current state :frowning: )

Cheers and thanks,
Thorsten