From 702ce76cd28392745132feb2dfb6592d220cb8ec Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Aug 2010 11:33:07 +0000 Subject: 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. --- release/scripts/io/import_scene_obj.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'release') 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): ''' -- cgit v1.2.3