From a13c382969691adcd5ec8d15183b9cf5e580f70f Mon Sep 17 00:00:00 2001 From: khreathor Date: Thu, 10 Jan 2019 05:40:56 +0100 Subject: [PATCH] Skingroup images import order fix --- tools/io_mesh_qfmdl/import_mdl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/io_mesh_qfmdl/import_mdl.py b/tools/io_mesh_qfmdl/import_mdl.py index 15e1cf063..28ac24762 100644 --- a/tools/io_mesh_qfmdl/import_mdl.py +++ b/tools/io_mesh_qfmdl/import_mdl.py @@ -123,6 +123,7 @@ def setup_skins(mdl, uvs): uvloop.data[k].uv = mdl_uv[j] #Load all skins + img_counter = 0 for i, skin in enumerate(mdl.skins): if skin.type: mat = setup_main_material(mdl) @@ -132,7 +133,8 @@ def setup_skins(mdl, uvs): for j, subskin in enumerate(skin.skins): tex_node = mat.node_tree.nodes.new("ShaderNodeTexImage") - tex_node.image = mdl.images[i + j] + tex_node.image = mdl.images[img_counter] + img_counter += 1 tex_node.interpolation = "Closest" if j == 0: # connect only first texture (we'll need something smarter in the future) @@ -150,7 +152,8 @@ def setup_skins(mdl, uvs): mat.node_tree.nodes.remove(mat.node_tree.nodes["Principled BSDF"]) tex_node = mat.node_tree.nodes.new("ShaderNodeTexImage") - tex_node.image = mdl.images[i] + tex_node.image = mdl.images[img_counter] + img_counter += 1 tex_node.interpolation = "Closest" mat.node_tree.links.new(tex_node.outputs[0], emissionNode.inputs[0])