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