37
37
from . import nbt , world
38
38
from .files import FileReplacer , get_fs_caps
39
39
from .optimizeimages import optimize_image
40
- from .util import roundrobin
40
+ from .util import roundrobin , findGitVersion
41
41
42
42
43
43
"""
@@ -309,6 +309,7 @@ def __init__(self, worldobj, regionsetobj, assetmanagerobj, texturesobj, options
309
309
310
310
self .last_rendertime = config .get ('last_rendertime' , 0 )
311
311
self .forcerendertime = config .get ('forcerendertime' , 0 )
312
+ self .lastrenderversion = config .get ('lastrenderversion' , 0 )
312
313
313
314
if "renderchecks" not in self .options :
314
315
# renderchecks was not given, this indicates it was not specified
@@ -318,20 +319,25 @@ def __init__(self, worldobj, regionsetobj, assetmanagerobj, texturesobj, options
318
319
# No persistent config?
319
320
if os .path .exists (self .outputdir ):
320
321
# 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
322
323
logging .warning (
323
324
"For render '%s' I couldn't find any persistent config, "
324
325
"but I did find my tile directory already exists. This "
325
326
"shouldn't normally happen, something may be up, but I "
326
327
"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
329
330
else :
330
331
# This is the typical code path for an initial render, make
331
332
# this a "forcerender"
332
333
self .options ['renderchecks' ] = 2
333
334
logging .debug ("This is the first time rendering %s. Doing "
334
335
"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
335
341
elif not os .path .exists (self .outputdir ):
336
342
# Somehow the outputdir got erased but the metadata file is
337
343
# still there. That's strange!
@@ -377,6 +383,11 @@ def __init__(self, worldobj, regionsetobj, assetmanagerobj, texturesobj, options
377
383
self .options ['renderchecks' ] = 2
378
384
os .mkdir (self .outputdir )
379
385
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
+
380
391
# must wait until outputdir exists
381
392
self .fs_caps = get_fs_caps (self .outputdir )
382
393
@@ -591,7 +602,8 @@ def bgcolorformat(color):
591
602
poititle = self .options .get ("poititle" ),
592
603
showlocationmarker = self .options .get ("showlocationmarker" ),
593
604
center = (self .options .get ("center" ) or self .options .get ("spawn" )
594
- or [0 , 64 , 0 ])
605
+ or [0 , 64 , 0 ]),
606
+ lastrenderversion = findGitVersion ()
595
607
)
596
608
d ['maxZoom' ] = self .options .get ('maxzoom' , self .treedepth )
597
609
if d ['maxZoom' ] < 0 :
0 commit comments