Package mrv :: Package maya :: Package nt :: Module persistence :: Class PyPickleData
[hide private]
[frames] | no frames]

Class PyPickleData

source code

OpenMayaMPx.MPxData --+
                      |
                     PyPickleData

Allows to access a pickled data object natively within a maya file. In ascii mode, the pickle will be encoded into string data, in binary mode the cPickle will be taken in its original value.

To get the respective dict-references back, we use a tracking dict as proposed by the API Docs


Notes:
Instance Methods [hide private]
 
__init__(self) source code
 
__del__(self)
Remove ourselves from the dictionary to prevent flooding
source code
 
_writeToStream(self, ostream, asBinary)
Write our data binary or ascii respectively
source code
 
writeBinary(self, out)
cPickle to cStringIO, write in 4 byte packs using ScriptUtil
source code
 
readBinary(self, inStream, numBytesToRead)
Read in 4 byte packs to cStringIO, unpickle from there
source code
 
writeASCII(self, out)
cPickle to cStringIO, encode with base64 encoding
source code
 
readASCII(self, args, lastParsedElement)
Read base64 element and decode to cStringIO, then unpickle
source code
 
copy(self, other)
Copy other into self - allows copy pointers as maya copies the data each time you retrieve it
source code
 
typeId(self) source code
 
name(self) source code
Static Methods [hide private]
 
creator() source code
Class Variables [hide private]
  kPluginDataId = api.MTypeId(0x0010D135)
  kDataName = "PickleData"
Method Details [hide private]

__del__(self)
(Destructor)

source code 
Remove ourselves from the dictionary to prevent flooding

Note: we can be called even if maya is already unloaded or shutting down

readBinary(self, inStream, numBytesToRead)

source code 
Read in 4 byte packs to cStringIO, unpickle from there
Notes:
  • this method is more complicated than it needs be since asCharPtr does not work ! It returns a string of a single char ... which is not the same :) !
  • YES, this is a CUMBERSOME way to deal with bytes ... terrible, thanks maya :), thanks python