Classes | Functions | Variables
direct.stdpy.pickle Namespace Reference


class  Pickler
class  Unpickler


def dump (obj, file, protocol=None)
def dumps (obj, protocol=None)
def load (file)
def loads (str)


 pickle = __import__('pickle')

Detailed Description

This module extends standard Python's pickle module so that it is
capable of writing more efficient pickle files that contain Panda
objects with shared pointers.  In particular, a single Python
structure that contains many NodePaths into the same scene graph will
write the NodePaths correctly when used with this pickle module, so
that when it is unpickled later, the NodePaths will still reference
into the same scene graph together.

If you use the standard pickle module instead, the NodePaths will each
duplicate its own copy of its scene graph.

This is necessary because the standard pickle module doesn't provide a
mechanism for sharing context between different objects written to the
same pickle stream, so each NodePath has to write itself without
knowing about the other NodePaths that will also be writing to the
same stream.  This replacement module solves this problem by defining
a __reduce_persist__() replacement method for __reduce__(), which
accepts a pointer to the Pickler object itself, allowing for shared
context between all objects written by that Pickler.

Unfortunately, cPickle cannot be supported, because it does not
support extensions of this nature. 

Function Documentation

◆ dump()

def direct.stdpy.pickle.dump (   obj,
  protocol = None 

◆ dumps()

def direct.stdpy.pickle.dumps (   obj,
  protocol = None 

◆ load()

def direct.stdpy.pickle.load (   file)

◆ loads()

def direct.stdpy.pickle.loads (   str)

Variable Documentation

◆ pickle

pickle = __import__('pickle')