]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/export_material.py
Always export texture data inline if there's no image file
[libs/gl.git] / blender / io_mspgl / export_material.py
index 0860c28bbc2061a0cf1ed0c31b8689175504d7d9..956f51d430b41acb8e48f2fdc42376971c2f3453 100644 (file)
@@ -40,16 +40,16 @@ 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")
 
                        st = Statement("inherit", material.technique)
                        for s, t in textures.items():
-                               if t.default_filter:
-                                       st.sub.append(Statement("texture", s, image_name(t.image)))
+                               if t.default_filter and t.image.filepath:
+                                       st.sub.append(Statement("texture", s, os.path.basename(t.image.filepath)))
                                else:
                                        st.sub.append(tech_res.create_reference_statement("texture", s, resources[t.name+".tex2d"]))
                        if material.override_material:
@@ -68,10 +68,10 @@ class MaterialExporter:
                                ss = Statement("texunit", 0)
                                if self.single_file:
                                        ss.sub.append(tech_res.create_embed_statement("texture2d", tex_res))
-                               elif not diffuse_tex.default_filter:
-                                       ss.sub.append(tech_res.create_reference_statement("texture", tex_res))
+                               elif diffuse_tex.default_filter and diffuse_tex.image.filepath:
+                                       ss.sub.append(Statement("texture", os.path.basename(diffuse_tex.image.filepath)))
                                else:
-                                       ss.sub.append(Statement("texture", image_name(diffuse_tex.image)))
+                                       ss.sub.append(tech_res.create_reference_statement("texture", tex_res))
                                st.sub.append(ss)
 
                        tech_res.statements.append(st)