diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-05 16:27:25 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-08-05 16:27:25 +0300 |
commit | 19166e3172c39a7231bdb885543c9665bbf254cc (patch) | |
tree | 96fd974042efd0556d37cdf7d3d63c1225fea6a8 /io_scene_obj | |
parent | 58cd47ab13f45b749d10e63d7663607311b7e04e (diff) |
Fix T68249: Obj import will error if texture coordinates do not have 2 values.
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_obj/import_obj.py | 7 |
2 files changed, 6 insertions, 3 deletions
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: |