From 15257e49db8a6bfa383306c8ec35f60bfa354468 Mon Sep 17 00:00:00 2001 From: Vincent Petithory Date: Wed, 27 Mar 2013 21:00:47 +0100 Subject: Minimap renderer: add special args: * "all" to create minimaps of all existing maps * "update" to update all existing minimaps --- client/minimap-render.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/client/minimap-render.py b/client/minimap-render.py index 33917ee..c9cb4a1 100755 --- a/client/minimap-render.py +++ b/client/minimap-render.py @@ -129,12 +129,14 @@ def usage(): Example: $ ./minimap-render.py 007-1 will render the map at maps/007-1.tmx in the graphics/minimaps directory. + $ ./minimap-render.py all + will render all existing maps found in the maps directory. + $ ./minimap-render.py update + will update all existing minimaps found in the graphics/minimaps directory. For convenience, $ ./minimap-render.py 007-1.tmx - is also acceptable, for e.g running things like, - $ ./minimap-render.py $(ls ../maps/) - that would render all existing maps. + is also accepted. \n''' % sys.argv[0]) def main(): @@ -148,7 +150,14 @@ def main(): return 126 status = 0 - for map_name in sys.argv[1:]: + if sys.argv[1].lower() == 'all': + map_names = sorted([os.path.splitext(p)[0] for p in os.listdir(os.path.join(CLIENT_DATA_ROOT, u'maps'))]) + elif sys.argv[1].lower() == 'update': + map_names = sorted([os.path.splitext(p)[0] for p in os.listdir(os.path.join(CLIENT_DATA_ROOT, u'graphics', u'minimaps'))]) + else: + map_names = sys.argv[1:] + + for map_name in map_names: # Render tiles at 1 pixel size map_renderer = MinimapRenderer(map_name, 1, True) status += map_renderer.render() -- cgit v1.2.3-60-g2f50