mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +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
|
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue