mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
Convert all skins.
Skin groups are now partially supported.
This commit is contained in:
parent
f8e1e3d4ec
commit
7489d5646b
1 changed files with 13 additions and 6 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue