From 598132cfd662ab53ab19ee6d475f2ae9e8b1d709 Mon Sep 17 00:00:00 2001 From: Quantum Date: Fri, 1 Nov 2013 19:26:25 -0400 Subject: [PATCH] Image shrinker now reads a list of files to resize, instead of using a hard coded list. This now doesn't need the launcher to be rebuilt for every new texture. --- punyverse/assets/textures.txt | 20 ++++++++++++++++++++ small_images.py | 15 ++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 punyverse/assets/textures.txt diff --git a/punyverse/assets/textures.txt b/punyverse/assets/textures.txt new file mode 100644 index 0000000..bd541a4 --- /dev/null +++ b/punyverse/assets/textures.txt @@ -0,0 +1,20 @@ +# This file contains all the textures that is bigger than the minimum OpenGL texture size +# and hence may need to be resized depending on the machine + +mercury.jpg +earth.jpg +moon.jpg +mars.jpg +jupiter.jpg +saturn.jpg +moons/io.jpg +moons/europa.jpg +moons/ganymede.jpg +moons/callisto.jpg +moons/titan.jpg +moons/rhea.jpg +moons/iapetus.jpg +moons/dione.jpg +moons/tethys.jpg +moons/enceladus.jpg +moons/mimas.jpg diff --git a/small_images.py b/small_images.py index 8e68a40..ed00433 100644 --- a/small_images.py +++ b/small_images.py @@ -109,11 +109,20 @@ def get_main_dir(): return os.path.dirname(__file__) def main(): - texture = os.path.join(get_main_dir(), 'punyverse', 'assets', 'textures') - for file in textures: + punyverse = os.path.join(get_main_dir(), 'punyverse') + try: + with open(os.path.join(punyverse, 'assets', 'textures.txt')) as f: + files = [i.strip() for i in f if not i.startswith('#') and i.strip()] + except IOError: + files = textures + texture = os.path.join(punyverse, 'assets', 'textures') + for file in files: print 'Resizing %s:' % file, file = os.path.join(texture, file.replace('/', os.sep)) - shrink(file) + if os.path.exists(file): + shrink(file) + else: + print 'exists not' if __name__ == '__main__': main()