]> git.tdb.fi Git - libs/gl.git/commitdiff
Fixes and improvements to exporting materials
authorMikko Rasa <tdb@tdb.fi>
Thu, 23 May 2019 21:20:26 +0000 (00:20 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 23 May 2019 21:21:23 +0000 (00:21 +0300)
blender/io_mspgl/export_material.py
blender/io_mspgl/export_object.py
blender/io_mspgl/material.py

index 0860c28bbc2061a0cf1ed0c31b8689175504d7d9..c3aa654e41ed16ffb6a84e20b93e490f84fdac8e 100644 (file)
@@ -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")
index cbd009a150080a9f9ec67369a47b9299a69c184b..0e6a9022c24790e8f960e84d9ac1c5a2439ebbee 100644 (file)
@@ -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:
index 54b2c5d823a64300aea352af5545b87273087a7a..a45e881571aea4c0da4b5678f3662eb189863d13 100644 (file)
@@ -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: