From 1fc1a2099320c49ed3deacda4134630aa3daf85b Mon Sep 17 00:00:00 2001
From: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Tue, 13 Sep 2016 12:26:05 +0200
Subject: [PATCH] Fix T49338: Export to OBJ add extra space to the texture file
 name on MTL file

---
 io_scene_obj/export_obj.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 9418cc673..3933abfa2 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -188,7 +188,10 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
                         options.append('-o %.6f %.6f %.6f' % mtex.offset[:])
                     if mtex.scale != Vector((1.0, 1.0, 1.0)):
                         options.append('-s %.6f %.6f %.6f' % mtex.scale[:])
-                    fw('%s %s %s\n' % (key, " ".join(options), repr(filepath)[1:-1]))
+                    if options:
+                        fw('%s %s %s\n' % (key, " ".join(options), repr(filepath)[1:-1]))
+                    else:
+                        fw('%s %s\n' % (key, repr(filepath)[1:-1]))
 
 
 def test_nurbs_compat(ob):
-- 
GitLab