diff options
author | Vincent Petithory <vincent.petithory@gmail.com> | 2013-03-27 21:00:47 +0100 |
---|---|---|
committer | Vincent Petithory <vincent.petithory@gmail.com> | 2013-03-27 21:00:47 +0100 |
commit | 15257e49db8a6bfa383306c8ec35f60bfa354468 (patch) | |
tree | 557047f9d47ed257a9c472e1c2bf6f7d86abc44d | |
parent | 795fe02f1080ff254d279ae28187df8fb1beb78e (diff) | |
download | tools-15257e49db8a6bfa383306c8ec35f60bfa354468.tar.gz tools-15257e49db8a6bfa383306c8ec35f60bfa354468.tar.bz2 tools-15257e49db8a6bfa383306c8ec35f60bfa354468.tar.xz tools-15257e49db8a6bfa383306c8ec35f60bfa354468.zip |
Minimap renderer: add special args:
* "all" to create minimaps of all existing maps
* "update" to update all existing minimaps
-rwxr-xr-x | client/minimap-render.py | 17 |
1 files 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() |