From 27a5698154d13c0986bde99a31a54da76b35ac08 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Sun, 4 Dec 2011 07:53:18 +0000
Subject: [PATCH] patch [#29490] OBJ exporter with "write materrials" unchecked
 write a line "usemtl" from ed gautier (edddy)

---
 io_scene_obj/export_obj.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index d1b3918da..3317438df 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -492,7 +492,8 @@ def write_file(filepath, objects, scene,
                         if EXPORT_GROUP_BY_MAT:
                             # can be mat_image or (null)
                             fw("g %s_%s\n" % (name_compat(ob.name), name_compat(ob.data.name)))  # can be mat_image or (null)
-                        fw("usemtl (null)\n")  # mat, image
+                        if EXPORT_MTL:
+                            fw("usemtl (null)\n")  # mat, image
 
                     else:
                         mat_data = mtl_dict.get(key)
@@ -511,8 +512,8 @@ def write_file(filepath, objects, scene,
 
                         if EXPORT_GROUP_BY_MAT:
                             fw("g %s_%s_%s\n" % (name_compat(ob.name), name_compat(ob.data.name), mat_data[0]))  # can be mat_image or (null)
-
-                        fw("usemtl %s\n" % mat_data[0])  # can be mat_image or (null)
+                        if EXPORT_MTL:
+                            fw("usemtl %s\n" % mat_data[0])  # can be mat_image or (null)
 
                 contextMat = key
                 if f_smooth != contextSmooth:
-- 
GitLab