From 41213f2c30eb647eca4b705c755993e1d4b953e3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 15 Sep 2011 22:45:23 +0900 Subject: [PATCH] Make the skin show in blender's 3d view. Much thanks to ideasman_42 for showing me which code I needed to grok to get it working. --- tools/qfmdl/import_mdl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/qfmdl/import_mdl.py b/tools/qfmdl/import_mdl.py index 1bf6ca1ae..616ca9909 100644 --- a/tools/qfmdl/import_mdl.py +++ b/tools/qfmdl/import_mdl.py @@ -227,6 +227,7 @@ def import_mdl(operator, context, filepath): faces, uvs = make_faces (mdl) verts = make_verts (mdl, 0) load_skins (mdl) + img = mdl.images[0] # use the first skin for now mesh = bpy.data.meshes.new(mdl.name) mesh.from_pydata(verts, [], faces) uvlay = mesh.uv_textures.new(mdl.name) @@ -234,14 +235,15 @@ def import_mdl(operator, context, filepath): mdl_uv = uvs[i] for j, uv in enumerate(f.uv): uv[0], uv[1] = mdl_uv[j] - + f.image = img + f.use_image = True mat = bpy.data.materials.new(mdl.name) mat.diffuse_color = (1,1,1) mat.use_raytrace = False tex = bpy.data.textures.new(mdl.name, 'IMAGE') tex.extension = 'CLIP' tex.use_preview_alpha = True - tex.image = mdl.images[0] # use the first skin for now + tex.image = img mat.texture_slots.add() ts = mat.texture_slots[0] ts.texture = tex