0

textures: remove baffling texture generation logic

We used to generate textures multiple times for each worker process,
which didn't seem to be intended as it was done gated behind a reversed
if statement. It just so happened to fix an issue introduced by the
pickling code which was deleting vital attributes like the actual
generated textures.

I'm honestly not sure why this was ever done, so let's just throw this
out and call it a day.

Fixes #1728
This commit is contained in:
Nicolas F
2020-02-19 15:06:42 +01:00
parent 51efdbaa4e
commit 9895fe875b

View File

@@ -94,13 +94,8 @@ class Textures(object):
## ##
def __getstate__(self): def __getstate__(self):
# we must get rid of the huge image lists, and other images
attributes = self.__dict__.copy() attributes = self.__dict__.copy()
for attr in ['blockmap', 'biome_grass_texture', 'watertexture', 'lavatexture', 'firetexture', 'portaltexture', 'lightcolor', 'grasscolor', 'foliagecolor', 'watercolor', 'texture_cache']: # Get rid of the jar list because file objects aren't pickleable like that
try:
del attributes[attr]
except KeyError:
pass
attributes['jars'] = OrderedDict() attributes['jars'] = OrderedDict()
return attributes return attributes
def __setstate__(self, attrs): def __setstate__(self, attrs):
@@ -108,7 +103,7 @@ class Textures(object):
for attr, val in list(attrs.items()): for attr, val in list(attrs.items()):
setattr(self, attr, val) setattr(self, attr, val)
self.texture_cache = {} self.texture_cache = {}
if self.generated: if not self.generated:
self.generate() self.generate()
## ##