Merge remote-tracking branch 'tswsl1989/issue478'
This commit is contained in:
@@ -124,6 +124,8 @@ def main():
|
|||||||
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
|
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
|
||||||
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
|
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
|
||||||
parser.add_option("--north-direction", dest="north_direction", action="store", helptext="Specifies which corner of the screen north will point to. Defaults to whatever the current map uses, or lower-left for new maps. Valid options are: " + ", ".join(avail_north_dirs) + ".", type="choice", default="auto", choices=avail_north_dirs)
|
parser.add_option("--north-direction", dest="north_direction", action="store", helptext="Specifies which corner of the screen north will point to. Defaults to whatever the current map uses, or lower-left for new maps. Valid options are: " + ", ".join(avail_north_dirs) + ".", type="choice", default="auto", choices=avail_north_dirs)
|
||||||
|
parser.add_option("--changelist", dest="changelist", action="store", helptext="Output list of changed tiles to file. If the file exists, it's contents will be overwritten.",advanced=True)
|
||||||
|
parser.add_option("--changelist-format", dest="changelist_format", action="store", helptext="Output relative or absolute paths for --changelist. Only valid when --changelist is used", type="choice", default="relative", choices=["relative","absolute"],advanced=True)
|
||||||
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
|
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
|
||||||
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
|
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
|
||||||
|
|
||||||
@@ -277,6 +279,18 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
|||||||
logging.getLogger().setLevel(
|
logging.getLogger().setLevel(
|
||||||
logging.getLogger().level - 10*options.verbose)
|
logging.getLogger().level - 10*options.verbose)
|
||||||
|
|
||||||
|
if options.changelist:
|
||||||
|
try:
|
||||||
|
changefile = open(options.changelist,'w+')
|
||||||
|
except IOError as e:
|
||||||
|
logging.error("Unable to open file %s to use for changelist." % options.changelist)
|
||||||
|
logging.error("I/O Error: %s" % e.strerror)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if options.changelist_format and not options.changelist:
|
||||||
|
logging.error("changelist_format specified without changelist.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
logging.info("Welcome to Minecraft Overviewer!")
|
logging.info("Welcome to Minecraft Overviewer!")
|
||||||
logging.debug("Current log level: {0}".format(logging.getLogger().level))
|
logging.debug("Current log level: {0}".format(logging.getLogger().level))
|
||||||
|
|
||||||
@@ -337,6 +351,21 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
|||||||
# finish up the map
|
# finish up the map
|
||||||
m.finalize()
|
m.finalize()
|
||||||
|
|
||||||
|
if options.changelist:
|
||||||
|
changed=[]
|
||||||
|
for tile in r.rendered_tiles:
|
||||||
|
if options.changelist_format=="absolute":
|
||||||
|
tile=os.path.abspath(tile)
|
||||||
|
changed.append(tile)
|
||||||
|
for zl in range(q[0].p - 1):
|
||||||
|
tile=os.path.dirname(tile)
|
||||||
|
changed.append("%s.%s" % (tile, imgformat))
|
||||||
|
#Quick and nasty way to remove duplicate entries
|
||||||
|
changed=list(set(changed))
|
||||||
|
changed.sort()
|
||||||
|
for path in changed:
|
||||||
|
changefile.write("%s\n" % path)
|
||||||
|
changefile.close()
|
||||||
|
|
||||||
def list_rendermodes():
|
def list_rendermodes():
|
||||||
"Prints out a pretty list of supported rendermodes"
|
"Prints out a pretty list of supported rendermodes"
|
||||||
|
|||||||
@@ -479,6 +479,8 @@ class QuadtreeGen(object):
|
|||||||
tileimg.save(imgpath, quality=self.imgquality, subsampling=0)
|
tileimg.save(imgpath, quality=self.imgquality, subsampling=0)
|
||||||
else: # png
|
else: # png
|
||||||
tileimg.save(imgpath)
|
tileimg.save(imgpath)
|
||||||
|
#Add tile to list of rendered tiles
|
||||||
|
poi_queue.put(['rendered',imgpath])
|
||||||
|
|
||||||
if self.optimizeimg:
|
if self.optimizeimg:
|
||||||
optimize_image(imgpath, self.imgformat, self.optimizeimg)
|
optimize_image(imgpath, self.imgformat, self.optimizeimg)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ from time import gmtime, strftime, sleep
|
|||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module has routines related to distributing the render job to multipule nodes
|
This module has routines related to distributing the render job to multiple nodes
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -109,6 +109,9 @@ class RenderNode(object):
|
|||||||
|
|
||||||
self.options = options
|
self.options = options
|
||||||
self.quadtrees = quadtrees
|
self.quadtrees = quadtrees
|
||||||
|
#List of changed tiles
|
||||||
|
self.rendered_tiles = []
|
||||||
|
|
||||||
#bind an index value to the quadtree so we can find it again
|
#bind an index value to the quadtree so we can find it again
|
||||||
#and figure out which worlds are where
|
#and figure out which worlds are where
|
||||||
i = 0
|
i = 0
|
||||||
@@ -162,7 +165,8 @@ class RenderNode(object):
|
|||||||
|
|
||||||
quadtrees = self.quadtrees
|
quadtrees = self.quadtrees
|
||||||
|
|
||||||
# do per-quadtree init.
|
# do per-quadtree init
|
||||||
|
|
||||||
max_p = 0
|
max_p = 0
|
||||||
total = 0
|
total = 0
|
||||||
for q in quadtrees:
|
for q in quadtrees:
|
||||||
@@ -203,6 +207,10 @@ class RenderNode(object):
|
|||||||
world.POI.append(item[1])
|
world.POI.append(item[1])
|
||||||
elif item[0] == "removePOI":
|
elif item[0] == "removePOI":
|
||||||
world.persistentData['POI'] = filter(lambda x: x['chunk'] != item[1], world.persistentData['POI'])
|
world.persistentData['POI'] = filter(lambda x: x['chunk'] != item[1], world.persistentData['POI'])
|
||||||
|
|
||||||
|
elif item[0] == "rendered":
|
||||||
|
self.rendered_tiles.append(item[1])
|
||||||
|
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
pass
|
pass
|
||||||
while count_to_remove > 0:
|
while count_to_remove > 0:
|
||||||
@@ -231,6 +239,9 @@ class RenderNode(object):
|
|||||||
world.POI.append(item[1])
|
world.POI.append(item[1])
|
||||||
elif item[0] == "removePOI":
|
elif item[0] == "removePOI":
|
||||||
world.persistentData['POI'] = filter(lambda x: x['chunk'] != item[1], world.persistentData['POI'])
|
world.persistentData['POI'] = filter(lambda x: x['chunk'] != item[1], world.persistentData['POI'])
|
||||||
|
elif item[0] == "rendered":
|
||||||
|
self.rendered_tiles.append(item[1])
|
||||||
|
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -278,7 +289,7 @@ class RenderNode(object):
|
|||||||
# Do the final one right here:
|
# Do the final one right here:
|
||||||
for q in quadtrees:
|
for q in quadtrees:
|
||||||
q.render_innertile(os.path.join(q.destdir, q.tiledir), "base")
|
q.render_innertile(os.path.join(q.destdir, q.tiledir), "base")
|
||||||
|
|
||||||
def _apply_render_worldtiles(self, pool,batch_size):
|
def _apply_render_worldtiles(self, pool,batch_size):
|
||||||
"""Returns an iterator over result objects. Each time a new result is
|
"""Returns an iterator over result objects. Each time a new result is
|
||||||
requested, a new task is added to the pool and a result returned.
|
requested, a new task is added to the pool and a result returned.
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class World(object):
|
|||||||
# stores Points Of Interest to be mapped with markers
|
# stores Points Of Interest to be mapped with markers
|
||||||
# a list of dictionaries, see below for an example
|
# a list of dictionaries, see below for an example
|
||||||
self.POI = []
|
self.POI = []
|
||||||
|
|
||||||
# if it exists, open overviewer.dat, and read in the data structure
|
# if it exists, open overviewer.dat, and read in the data structure
|
||||||
# info self.persistentData. This dictionary can hold any information
|
# info self.persistentData. This dictionary can hold any information
|
||||||
# that may be needed between runs.
|
# that may be needed between runs.
|
||||||
|
|||||||
Reference in New Issue
Block a user