From: Mikko Rasa Date: Thu, 23 May 2019 21:20:26 +0000 (+0300) Subject: Fixes and improvements to exporting materials X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d5a302ff5a27018c2cda8ecc60840d5f72ee4e33;p=libs%2Fgl.git Fixes and improvements to exporting materials --- 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: