]> git.tdb.fi Git - libs/gl.git/commitdiff
Use image path as texture identifier if available
authorMikko Rasa <tdb@tdb.fi>
Mon, 15 Sep 2014 09:43:28 +0000 (12:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 15 Sep 2014 09:43:28 +0000 (12:43 +0300)
This is more likely to be correct in common resource loading setups.

blender/io_mspgl/export_object.py

index 0de98f8446a609692ccd527f8aeddc1bcd599da4..00410a23ff0d071ea9b500967f406ef1daed2393 100644 (file)
@@ -6,6 +6,13 @@ def linear_to_srgb(l):
        else:
                return 1.055*(l**(1/2.4))-0.055
 
+def image_name(i):
+       fp = i.filepath
+       if fp:
+               return os.path.split(fp)[1]
+       else:
+               return i.name
+
 
 class ObjectExporter:
        def __init__(self):
@@ -133,7 +140,7 @@ class ObjectExporter:
                                                out_file.write("raw_data", texdata)
                                                out_file.end()
                                        else:
-                                               out_file.write("texture", '"%s"'%tex.image.name)
+                                               out_file.write("texture", '"%s"'%image_name(tex.image))
                                        out_file.end()
 
                out_file.end()