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.

This commit is contained in:
Quantum 2013-11-01 19:26:25 -04:00
parent ad1970d2d2
commit 598132cfd6
2 changed files with 32 additions and 3 deletions

View file

@ -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

View file

@ -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()