From 637ef260fadf4f99bccd70651d30d7440e839861 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 15 Sep 2014 12:43:28 +0300 Subject: [PATCH] Use image path as texture identifier if available This is more likely to be correct in common resource loading setups. --- blender/io_mspgl/export_object.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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() -- 2.45.2