From d5a302ff5a27018c2cda8ecc60840d5f72ee4e33 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 24 May 2019 00:20:26 +0300 Subject: [PATCH] Fixes and improvements to exporting materials --- blender/io_mspgl/export_material.py | 4 ++-- blender/io_mspgl/export_object.py | 2 +- blender/io_mspgl/material.py | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/blender/io_mspgl/export_material.py b/blender/io_mspgl/export_material.py index 0860c28b..c3aa654e 100644 --- a/blender/io_mspgl/export_material.py +++ b/blender/io_mspgl/export_material.py @@ -40,8 +40,8 @@ class MaterialExporter: textures["normal_map"] = s.texture if material.technique: - if not obj.inherit_tech: - return [] + if not material.inherit_tech: + return tech_res if self.single_file: raise Exception("Can't export inherited technique to a single file") diff --git a/blender/io_mspgl/export_object.py b/blender/io_mspgl/export_object.py index cbd009a1..0e6a9022 100644 --- a/blender/io_mspgl/export_object.py +++ b/blender/io_mspgl/export_object.py @@ -172,7 +172,7 @@ class ObjectExporter: material = l.material_slots[0].material if material: if material.material_map: - tech_res = resources["material_map_{}.tech".format(material.technique)] + tech_res = resources["material_map_{}.tech".format(os.path.splitext(material.technique)[0])] else: tech_res = resources[material.name+".tech"] else: diff --git a/blender/io_mspgl/material.py b/blender/io_mspgl/material.py index 54b2c5d8..a45e8815 100644 --- a/blender/io_mspgl/material.py +++ b/blender/io_mspgl/material.py @@ -1,7 +1,12 @@ +import os + class MaterialMap: def __init__(self, materials): self.technique = materials[0].technique - self.name = "material_map_"+self.technique + if self.technique: + self.name = "material_map_"+os.path.splitext(self.technique)[0] + else: + self.name = "material_map" self.materials = materials self.srgb_colors = materials[0].srgb_colors for m in self.materials: -- 2.43.0