--regionlist should be working now
This commit is contained in:
@@ -93,7 +93,7 @@ def main():
|
|||||||
parser.add_option("-p", "--processes", dest="procs", help="How many worker processes to start. Default %s" % cpus, default=cpus, action="store", type="int")
|
parser.add_option("-p", "--processes", dest="procs", help="How many worker processes to start. Default %s" % cpus, default=cpus, action="store", type="int")
|
||||||
parser.add_option("-z", "--zoom", dest="zoom", help="Sets the zoom level manually instead of calculating it. This can be useful if you have outlier chunks that make your world too big. This value will make the highest zoom level contain (2**ZOOM)^2 tiles", action="store", type="int", configFileOnly=True)
|
parser.add_option("-z", "--zoom", dest="zoom", help="Sets the zoom level manually instead of calculating it. This can be useful if you have outlier chunks that make your world too big. This value will make the highest zoom level contain (2**ZOOM)^2 tiles", action="store", type="int", configFileOnly=True)
|
||||||
parser.add_option("-d", "--delete", dest="delete", help="Clear all caches. Next time you render your world, it will have to start completely over again. This is probably not a good idea for large worlds. Use this if you change texture packs and want to re-render everything.", action="store_true", commandLineOnly=True)
|
parser.add_option("-d", "--delete", dest="delete", help="Clear all caches. Next time you render your world, it will have to start completely over again. This is probably not a good idea for large worlds. Use this if you change texture packs and want to re-render everything.", action="store_true", commandLineOnly=True)
|
||||||
parser.add_option("--chunklist", dest="chunklist", help="A file containing, on each line, a path to a chunkfile to update. Instead of scanning the world directory for chunks, it will just use this list. Normal caching rules still apply.")
|
parser.add_option("--regionlist", dest="regionlist", help="A file containing, on each line, a path to a regionlist to update. Instead of scanning the world directory for regions, it will just use this list. Normal caching rules still apply.")
|
||||||
parser.add_option("--rendermodes", dest="rendermode", help="Specifies the render types, separated by commas. Use --list-rendermodes to list them all.", type="choice", choices=avail_rendermodes, required=True, default=avail_rendermodes[0], listify=True)
|
parser.add_option("--rendermodes", dest="rendermode", help="Specifies the render types, separated by commas. Use --list-rendermodes to list them all.", type="choice", choices=avail_rendermodes, required=True, default=avail_rendermodes[0], listify=True)
|
||||||
parser.add_option("--list-rendermodes", dest="list_rendermodes", action="store_true", help="List available render modes and exit.", commandLineOnly=True)
|
parser.add_option("--list-rendermodes", dest="list_rendermodes", action="store_true", help="List available render modes and exit.", commandLineOnly=True)
|
||||||
parser.add_option("--imgformat", dest="imgformat", help="The image output format to use. Currently supported: png(default), jpg.", configFileOnly=True )
|
parser.add_option("--imgformat", dest="imgformat", help="The image output format to use. Currently supported: png(default), jpg.", configFileOnly=True )
|
||||||
@@ -189,10 +189,10 @@ def main():
|
|||||||
if options.delete:
|
if options.delete:
|
||||||
return delete_all(worlddir, destdir)
|
return delete_all(worlddir, destdir)
|
||||||
|
|
||||||
if options.chunklist:
|
if options.regionlist:
|
||||||
chunklist = open(options.chunklist, 'r')
|
regionlist = map(str.strip, open(options.regionlist, 'r'))
|
||||||
else:
|
else:
|
||||||
chunklist = None
|
regionlist = None
|
||||||
|
|
||||||
if options.imgformat:
|
if options.imgformat:
|
||||||
if options.imgformat not in ('jpg','png'):
|
if options.imgformat not in ('jpg','png'):
|
||||||
@@ -221,7 +221,7 @@ def main():
|
|||||||
logging.info("Notice: Not using biome data for tinting")
|
logging.info("Notice: Not using biome data for tinting")
|
||||||
|
|
||||||
# First do world-level preprocessing
|
# First do world-level preprocessing
|
||||||
w = world.World(worlddir, useBiomeData=useBiomeData)
|
w = world.World(worlddir, useBiomeData=useBiomeData, regionlist=regionlist)
|
||||||
w.go(options.procs)
|
w.go(options.procs)
|
||||||
|
|
||||||
logging.info("Rending the following tilesets: %s", ",".join(options.rendermode))
|
logging.info("Rending the following tilesets: %s", ",".join(options.rendermode))
|
||||||
|
|||||||
@@ -427,6 +427,8 @@ class QuadtreeGen(object):
|
|||||||
for col, row, chunkx, chunky, regionfile in chunks:
|
for col, row, chunkx, chunky, regionfile in chunks:
|
||||||
# check region file mtime first.
|
# check region file mtime first.
|
||||||
region,regionMtime = get_region_mtime(regionfile)
|
region,regionMtime = get_region_mtime(regionfile)
|
||||||
|
if self.world.regionlist and region._filename not in self.world.regionlist:
|
||||||
|
continue
|
||||||
if regionMtime <= tile_mtime:
|
if regionMtime <= tile_mtime:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
11
world.py
11
world.py
@@ -78,6 +78,7 @@ class World(object):
|
|||||||
logging.info("Scanning regions")
|
logging.info("Scanning regions")
|
||||||
regionfiles = {}
|
regionfiles = {}
|
||||||
self.regions = {}
|
self.regions = {}
|
||||||
|
self.regionlist = regionlist # a list of paths
|
||||||
for x, y, regionfile in self._iterate_regionfiles():
|
for x, y, regionfile in self._iterate_regionfiles():
|
||||||
mcr = self.reload_region(regionfile)
|
mcr = self.reload_region(regionfile)
|
||||||
mcr.get_chunk_info()
|
mcr.get_chunk_info()
|
||||||
@@ -277,16 +278,22 @@ class World(object):
|
|||||||
"""Returns an iterator of all of the region files, along with their
|
"""Returns an iterator of all of the region files, along with their
|
||||||
coordinates
|
coordinates
|
||||||
|
|
||||||
|
Note: the regionlist here will be used to determinte the size of the
|
||||||
|
world.
|
||||||
|
|
||||||
Returns (regionx, regiony, filename)"""
|
Returns (regionx, regiony, filename)"""
|
||||||
join = os.path.join
|
join = os.path.join
|
||||||
if regionlist is not None:
|
if regionlist is not None:
|
||||||
for path in regionlist:
|
for path in regionlist:
|
||||||
if path.endswith("\n"):
|
path = path.strip()
|
||||||
path = path[:-1]
|
|
||||||
f = os.path.basename(path)
|
f = os.path.basename(path)
|
||||||
if f.startswith("r.") and f.endswith(".mcr"):
|
if f.startswith("r.") and f.endswith(".mcr"):
|
||||||
p = f.split(".")
|
p = f.split(".")
|
||||||
|
logging.debug("Using path %s from regionlist", f)
|
||||||
yield (int(p[1]), int(p[2]), join(self.worlddir, 'region', f))
|
yield (int(p[1]), int(p[2]), join(self.worlddir, 'region', f))
|
||||||
|
else:
|
||||||
|
logging.warning("Ignore path '%s' in regionlist", f)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for path in glob(os.path.join(self.worlddir, 'region') + "/r.*.*.mcr"):
|
for path in glob(os.path.join(self.worlddir, 'region') + "/r.*.*.mcr"):
|
||||||
dirpath, f = os.path.split(path)
|
dirpath, f = os.path.split(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user