[Bf-extensions-cvs] [d464ae7] blender-v2.77-release: Fix T47831: Obj_Import_Problem.

Bastien Montagne noreply at git.blender.org
Tue Apr 5 10:54:45 CEST 2016


Commit: d464ae7c75d5a69f3713796fe069a399ba225fd8
Author: Bastien Montagne
Date:   Sat Mar 19 17:23:28 2016 +0100
Branches: blender-v2.77-release
https://developer.blender.org/rBAd464ae7c75d5a69f3713796fe069a399ba225fd8

Fix T47831: Obj_Import_Problem.

Actually, think that's not valid OBJ (using '0' index instead of nothing when not assigning data to some face corner).
But since supporting this is easy...

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

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 aff0b34..daeed23 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -21,8 +21,8 @@
 bl_info = {
     "name": "Wavefront OBJ format",
     "author": "Campbell Barton, Bastien Montagne",
-    "version": (2, 3, 0),
-    "blender": (2, 76, 0),
+    "version": (2, 3, 1),
+    "blender": (2, 77, 0),
     "location": "File > Import-Export",
     "description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures",
     "warning": "",
diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 7b06582..2028a1c 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -1015,14 +1015,14 @@ def load(context,
 
                         # formatting for faces with normals and textures is
                         # loc_index/tex_index/nor_index
-                        if len(obj_vert) > 1 and obj_vert[1]:
+                        if len(obj_vert) > 1 and obj_vert[1] and obj_vert[1] != b'0':
                             idx = int(obj_vert[1]) - 1
                             face_vert_tex_indices.append((idx + len(verts_tex) + 1) if (idx < 0) else idx)
                             face_vert_tex_valid = True
                         else:
                             face_vert_tex_indices.append(...)
 
-                        if len(obj_vert) > 2 and obj_vert[2]:
+                        if len(obj_vert) > 2 and obj_vert[2] and obj_vert[2] != b'0':
                             idx = int(obj_vert[2]) - 1
                             face_vert_nor_indices.append((idx + len(verts_nor) + 1) if (idx < 0) else idx)
                             face_vert_nor_valid = True



More information about the Bf-extensions-cvs mailing list