diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-12 15:33:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-12 15:33:07 +0400 |
commit | 702ce76cd28392745132feb2dfb6592d220cb8ec (patch) | |
tree | 2750793d52016589c2b94dd6d640cce9bf691f64 | |
parent | 150eb890dfbfbe5a8260c426d5ed3defed47a2d8 (diff) |
bugfix [#23227] .obj import with UV produces broken UV map in 2.53.0 (r30593)
eekadoodle face order fix was only being checked for quads, not tri's.
-rw-r--r-- | release/scripts/io/import_scene_obj.py | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/release/scripts/io/import_scene_obj.py b/release/scripts/io/import_scene_obj.py index 78f3f122cb3..c129ad7bde6 100644 --- a/release/scripts/io/import_scene_obj.py +++ b/release/scripts/io/import_scene_obj.py @@ -82,23 +82,21 @@ def unpack_list(list_of_tuples): # same as above except that it adds 0 for triangle faces def unpack_face_list(list_of_tuples): - l = [] - for t in list_of_tuples: - face = [i for i in t] - - if len(face) != 3 and len(face) != 4: - raise RuntimeError("{0} vertices in face.".format(len(face))) - - # rotate indices if the 4th is 0 - if len(face) == 4 and face[3] == 0: - face = [face[3], face[0], face[1], face[2]] + # allocate the entire list + flat_ls = [0] * (len(list_of_tuples) * 4) + i = 0 - if len(face) == 3: - face.append(0) - - l.extend(face) - - return l + for t in list_of_tuples: + if len(t) == 3: + if t[2] == 0: + t = t[1], t[2], t[0] + else: # assuem quad + if t[3] == 0 or t[2] == 0: + t = t[2], t[3], t[0], t[1] + + flat_ls[i:i + len(t)] = t + i += 4 + return flat_ls def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True): ''' |