[Bf-extensions-cvs] [19166e31] master: Fix T68249: Obj import will error if texture coordinates do not have 2 values.
Bastien Montagne
noreply at git.blender.org
Mon Aug 5 15:28:00 CEST 2019
Commit: 19166e3172c39a7231bdb885543c9665bbf254cc
Author: Bastien Montagne
Date: Mon Aug 5 15:27:25 2019 +0200
Branches: master
https://developer.blender.org/rBA19166e3172c39a7231bdb885543c9665bbf254cc
Fix T68249: Obj import will error if texture coordinates do not have 2 values.
===================================================================
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 f06acdba..f9cda8f3 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, 13),
+ "version": (3, 5, 14),
"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 86b93204..bc0bb199 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -725,6 +725,8 @@ def create_mesh(new_objects,
me.loops.foreach_set("normal", loops_nor)
if verts_tex and me.polygons:
+ # Some files Do not explicitely write the 'v' value when it's 0.0, see T68249...
+ verts_tex = [uv if len(uv) == 2 else uv + [0.0] for uv in verts_tex]
me.uv_layers.new(do_init=False)
loops_uv = tuple(uv for (_, _, face_vert_tex_indices, _, _, _, _) in faces
for face_uvidx in face_vert_tex_indices
@@ -1042,7 +1044,7 @@ def load(context,
if vdata_len:
if do_quick_vert:
try:
- vdata.append(tuple(map(float_func, line_split[1:vdata_len + 1])))
+ vdata.append(list(map(float_func, line_split[1:vdata_len + 1])))
except:
do_quick_vert = False
# In case we get too many failures on quick parsing, force fallback to full multi-line one.
@@ -1052,7 +1054,8 @@ def load(context,
skip_quick_vert = True
if not do_quick_vert:
context_multi_line = handle_vec(line_start, context_multi_line, line_split,
- context_multi_line or line_start, vdata, vec, vdata_len)
+ context_multi_line or line_start,
+ vdata, vec, vdata_len)
elif line_start == b'f' or context_multi_line == b'f':
if not context_multi_line:
More information about the Bf-extensions-cvs
mailing list