]> 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 c3aa654e41ed16ffb6a84e20b93e490f84fdac8e..956f51d430b41acb8e48f2fdc42376971c2f3453 100644 (file)
@@ -48,8 +48,8 @@ class MaterialExporter:
 
                        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)