Convert all skins.

Skin groups are now partially supported.
This commit is contained in:
Bill Currie 2011-09-15 19:19:21 +09:00
parent f8e1e3d4ec
commit 7489d5646b

View file

@ -193,13 +193,11 @@ def make_faces(mdl):
return faces, uvs
def load_skins(mdl):
for i in range(mdl.numskins):
if mdl.skins[i].type:
continue #skin groups not yet supported
img = bpy.data.images.new("%s_%d" % (mdl.name, i),
mdl.skinwidth, mdl.skinheight)
def load_skin(skin, name):
img = bpy.data.images.new(name, mdl.skinwidth, mdl.skinheight)
mdl.images.append(img)
p = [0.0] * mdl.skinwidth * mdl.skinheight * 4
d = mdl.skins[i].pixels
d = skin.pixels
for j in range(mdl.skinheight):
for k in range(mdl.skinwidth):
c = quakepal.palette[d[j * mdl.skinwidth + k]]
@ -212,6 +210,15 @@ def load_skins(mdl):
p[l + 3] = 1.0
img.pixels[:] = p[:]
mdl.images=[]
for i in range(mdl.numskins):
if mdl.skins[i].type:
for j in range(mdl.skins[i].numskins):
load_skin (mdl.skins[i].skins[j],
"%s_%d_%d" % (mdl.name, i, j))
else:
load_skin (mdl.skins[i], "%s_%d" % (mdl.name, i))
def import_mdl(operator, context, filepath):
mdl = load_mdl(filepath)