added __getstate__ and __setstate__ to TileSet to fix pickling
This commit is contained in:
@@ -265,6 +265,13 @@ class TileSet(object):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("imgformat must be one of: 'png' or 'jpeg'")
|
raise ValueError("imgformat must be one of: 'png' or 'jpeg'")
|
||||||
|
|
||||||
|
# Only pickle the initial state. Don't pickle anything resulting from the
|
||||||
|
# do_preprocessing step
|
||||||
|
def __getstate__(self):
|
||||||
|
return self.regionset, self.am, self.textures, self.options, self.outputdir
|
||||||
|
def __setstate__(self, state):
|
||||||
|
self.__init__(*state)
|
||||||
|
|
||||||
def do_preprocessing(self):
|
def do_preprocessing(self):
|
||||||
"""For the preprocessing step of the Worker interface, this does the
|
"""For the preprocessing step of the Worker interface, this does the
|
||||||
chunk scan and stores the resulting tree as a private instance
|
chunk scan and stores the resulting tree as a private instance
|
||||||
@@ -1262,6 +1269,12 @@ class RenderTile(object):
|
|||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self == other
|
return not self == other
|
||||||
|
|
||||||
|
# To support pickling
|
||||||
|
def __getstate__(self):
|
||||||
|
return self.col, self.row, self.path
|
||||||
|
def __setstate__(self, state):
|
||||||
|
self.__init__(*state)
|
||||||
|
|
||||||
def get_filepath(self, tiledir, imgformat):
|
def get_filepath(self, tiledir, imgformat):
|
||||||
"""Returns the path to this file given the directory to the tiles
|
"""Returns the path to this file given the directory to the tiles
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,6 @@ class RegionSet(object):
|
|||||||
in-memory.
|
in-memory.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#self.world = worldobj
|
|
||||||
self.regiondir = regiondir
|
self.regiondir = regiondir
|
||||||
|
|
||||||
logging.info("Scanning regions")
|
logging.info("Scanning regions")
|
||||||
|
|||||||
Reference in New Issue
Block a user