Skip to content

Commit 840b80c

Browse files
Added check for last render version to force render
1 parent 09e796b commit 840b80c

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

overviewer_core/tileset.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from . import nbt, world
3838
from .files import FileReplacer, get_fs_caps
3939
from .optimizeimages import optimize_image
40-
from .util import roundrobin
40+
from .util import roundrobin, findGitVersion
4141

4242

4343
"""
@@ -309,6 +309,7 @@ def __init__(self, worldobj, regionsetobj, assetmanagerobj, texturesobj, options
309309

310310
self.last_rendertime = config.get('last_rendertime', 0)
311311
self.forcerendertime = config.get('forcerendertime', 0)
312+
self.lastrenderversion = config.get('lastrenderversion', 0)
312313

313314
if "renderchecks" not in self.options:
314315
# renderchecks was not given, this indicates it was not specified
@@ -318,20 +319,25 @@ def __init__(self, worldobj, regionsetobj, assetmanagerobj, texturesobj, options
318319
# No persistent config?
319320
if os.path.exists(self.outputdir):
320321
# Somehow there's no config but the output dir DOES exist.
321-
# That's strange!
322+
# That's strange! Run forcerender in case of OV version change
322323
logging.warning(
323324
"For render '%s' I couldn't find any persistent config, "
324325
"but I did find my tile directory already exists. This "
325326
"shouldn't normally happen, something may be up, but I "
326327
"think I can continue...", self.options['name'])
327-
logging.info("Switching to --check-tiles mode")
328-
self.options['renderchecks'] = 1
328+
logging.info("Switching to --forcerender mode")
329+
self.options['renderchecks'] = 2
329330
else:
330331
# This is the typical code path for an initial render, make
331332
# this a "forcerender"
332333
self.options['renderchecks'] = 2
333334
logging.debug("This is the first time rendering %s. Doing "
334335
"a full-render", self.options['name'])
336+
elif self.lastrenderversion != findGitVersion():
337+
# Force render in case there is a version change that is breaking
338+
logging.warning("Re-rendering world due to version change."
339+
"This will avoid any bad rendering between incompatible versions")
340+
self.options['renderchecks'] = 2
335341
elif not os.path.exists(self.outputdir):
336342
# Somehow the outputdir got erased but the metadata file is
337343
# still there. That's strange!
@@ -377,6 +383,11 @@ def __init__(self, worldobj, regionsetobj, assetmanagerobj, texturesobj, options
377383
self.options['renderchecks'] = 2
378384
os.mkdir(self.outputdir)
379385

386+
if self.lastrenderversion != findGitVersion() and self.options['renderchecks'] not in [2, 3]:
387+
logging.warning("Normally renders from different versions should be"
388+
"overridden or ignored to prevent incompatibilities,"
389+
"but we will honor your decision.")
390+
380391
# must wait until outputdir exists
381392
self.fs_caps = get_fs_caps(self.outputdir)
382393

@@ -591,7 +602,8 @@ def bgcolorformat(color):
591602
poititle=self.options.get("poititle"),
592603
showlocationmarker=self.options.get("showlocationmarker"),
593604
center=(self.options.get("center") or self.options.get("spawn")
594-
or [0, 64, 0])
605+
or [0, 64, 0]),
606+
lastrenderversion=findGitVersion()
595607
)
596608
d['maxZoom'] = self.options.get('maxzoom', self.treedepth)
597609
if d['maxZoom'] < 0:

0 commit comments

Comments
 (0)