From 147f7097b77e591197dc38b2b263add57d69e4fc Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 28 Mar 2021 13:40:17 +0300 Subject: [PATCH] Fix handling of techniques in object exporter Materials with external rendering mode don't get technique resources generated them, so it's better to use the technique name here. --- blender/io_mspgl/export_object.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/blender/io_mspgl/export_object.py b/blender/io_mspgl/export_object.py index dcb5623f..7c1c5603 100644 --- a/blender/io_mspgl/export_object.py +++ b/blender/io_mspgl/export_object.py @@ -177,19 +177,21 @@ class ObjectExporter: if l.material_slots: material = l.material_slots[0].material if material: - if material.material_map: - tech_res = resources["material_map_{}.tech".format(os.path.splitext(material.technique)[0])] + if material.render_mode=='EXTERNAL': + tech_name = material.technique + elif material.material_map: + tech_name = "material_map_{}.tech".format(os.path.splitext(material.technique)[0]) else: - tech_res = resources[material.name+".tech"] + tech_name = material.name+".tech" else: - tech_res = resources["stub.tech"] + tech_name = "stub.tech" - if tech_res.name!=prev_tech: + if tech_name!=prev_tech: if material and material.render_mode=='EXTERNAL': lod_st.append(Statement("technique", material.technique)) else: - lod_st.append(obj_res.create_reference_statement("technique", tech_res)) - prev_tech = tech_res.name + lod_st.append(obj_res.create_reference_statement("technique", resources[tech_name])) + prev_tech = tech_name if i>0: st = Statement("level_of_detail", i) -- 2.45.2