moved most global vars in textures.py into an instantiatable class
This commit is contained in:
40
contrib/gallery.py
Normal file
40
contrib/gallery.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
"""
|
||||||
|
Outputs a huge image with all currently-supported block textures.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from overviewer_core import textures
|
||||||
|
import sys
|
||||||
|
import Image
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print "usage: %s [output.png]" % (sys.argv[0],)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
t = textures.Textures()
|
||||||
|
t.generate()
|
||||||
|
|
||||||
|
blocks = {}
|
||||||
|
|
||||||
|
for blockid in xrange(t.max_blockid):
|
||||||
|
for data in xrange(t.max_data):
|
||||||
|
tex = t.blockmap[blockid * t.max_data + data]
|
||||||
|
if tex:
|
||||||
|
if not blockid in blocks:
|
||||||
|
blocks[blockid] = {}
|
||||||
|
blocks[blockid][data] = tex
|
||||||
|
|
||||||
|
columns = max(map(len, blocks.values()))
|
||||||
|
rows = len(blocks)
|
||||||
|
texsize = t.texture_size
|
||||||
|
|
||||||
|
gallery = Image.new("RGBA", (columns * texsize, rows * texsize), t.bgcolor)
|
||||||
|
|
||||||
|
row = 0
|
||||||
|
for blockid, textures in blocks.iteritems():
|
||||||
|
column = 0
|
||||||
|
for data, tex in textures.iteritems():
|
||||||
|
gallery.paste(tex[0], (column * texsize, row * texsize))
|
||||||
|
column += 1
|
||||||
|
row += 1
|
||||||
|
|
||||||
|
gallery.save(sys.argv[1])
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user