From: Mikko Rasa Date: Mon, 15 Sep 2014 09:43:28 +0000 (+0300) Subject: Use image path as texture identifier if available X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=637ef260fadf4f99bccd70651d30d7440e839861;p=libs%2Fgl.git Use image path as texture identifier if available This is more likely to be correct in common resource loading setups. --- diff --git a/blender/io_mspgl/export_object.py b/blender/io_mspgl/export_object.py index 0de98f84..00410a23 100644 --- a/blender/io_mspgl/export_object.py +++ b/blender/io_mspgl/export_object.py @@ -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()