[Bf-extensions-cvs] [d79fa2c0] master: Fix T65326: OBJ import is broken when no material is in OBJ file.

Bastien Montagne noreply at git.blender.org
Mon Jun 3 12:00:16 CEST 2019


Commit: d79fa2c042e34e1639030b06ff762673a0a68803
Author: Bastien Montagne
Date:   Mon Jun 3 11:58:25 2019 +0200
Branches: master
https://developer.blender.org/rBAd79fa2c042e34e1639030b06ff762673a0a68803

Fix T65326: OBJ import is broken when no material is in OBJ file.

Caused by rB8252cc7044ea (fix for T65215), we actually need a default
material in edges-only case too, not to exclude None (default) one in
that case...

===================================================================

M	io_scene_obj/__init__.py
M	io_scene_obj/import_obj.py

===================================================================

diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index e7253ea7..15f2d2a0 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "Wavefront OBJ format",
     "author": "Campbell Barton, Bastien Montagne",
-    "version": (3, 5, 8),
+    "version": (3, 5, 9),
     "blender": (2, 80, 0),
     "location": "File > Import-Export",
     "description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures",
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 09cf7efc..c565bd05 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -520,7 +520,7 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
 
             face_vert_loc_indices[loop_idx] = map_index  # remap to the local index
 
-            if context_material is not None and context_material not in unique_materials_split:
+            if context_material not in unique_materials_split:
                 unique_materials_split[context_material] = unique_materials[context_material]
 
         faces_split.append(face)
@@ -1104,6 +1104,8 @@ def load(context,
                         #     as a polyline, and not a regular face...
                         face[1][:] = [True]
                         faces.append(face)
+                        if context_material is None:
+                            use_default_material = True
                     # Else, use face_vert_loc_indices previously defined and used the obj_face
 
                     context_multi_line = b'l' if strip_slash(line_split) else b''



More information about the Bf-extensions-cvs mailing list