Skip to content
Permalink
Browse files

Revert "textures: remove baffling texture generation logic"

This reverts commit 9895fe8.

The original code was correct, but confusing. Overviewer did regenerate
the texture in each worker process because Python pickling is incredibly
fragile fucking garbage designed by idiots who have no clue of what
a good language looks like.
  • Loading branch information
CounterPillow committed Mar 2, 2020
1 parent 9895fe8 commit e5ec41fcf931a9024cc39ee6536e8d6095f9fff9
Showing with 7 additions and 2 deletions.
  1. +7 −2 overviewer_core/textures.py
@@ -94,16 +94,21 @@ def __init__(self, texturepath=None, bgcolor=(26, 26, 26, 0), northdirection=0):
##

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

##

0 comments on commit e5ec41f

Please sign in to comment.
You can’t perform that action at this time.