[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31284] trunk/blender/release/scripts/io/ import_scene_obj.py: bugfix [#23227] . obj import with UV produces broken UV map in 2.53.0 (r30593)

Campbell Barton ideasman42 at gmail.com
Thu Aug 12 13:33:07 CEST 2010


Revision: 31284
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31284
Author:   campbellbarton
Date:     2010-08-12 13:33:07 +0200 (Thu, 12 Aug 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/io/import_scene_obj.py

Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_obj.py	2010-08-12 11:09:19 UTC (rev 31283)
+++ trunk/blender/release/scripts/io/import_scene_obj.py	2010-08-12 11:33:07 UTC (rev 31284)
@@ -82,24 +82,22 @@
 
 # same as above except that it adds 0 for triangle faces
 def unpack_face_list(list_of_tuples):
-    l = []
+    # allocate the entire list
+    flat_ls = [0] * (len(list_of_tuples) * 4)
+    i = 0
+
     for t in list_of_tuples:
-        face = [i for i in t]
+        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]
 
-        if len(face) != 3 and len(face) != 4:
-            raise RuntimeError("{0} vertices in face.".format(len(face)))
+        flat_ls[i:i + len(t)] = t
+        i += 4
+    return flat_ls
 
-        # rotate indices if the 4th is 0
-        if len(face) == 4 and face[3] == 0:
-            face = [face[3], face[0], face[1], face[2]]
-
-        if len(face) == 3:
-            face.append(0)
-
-        l.extend(face)
-
-    return l
-
 def BPyMesh_ngon(from_data, indices, PREF_FIX_LOOPS= True):
     '''
     Takes a polyline of indices (fgon)





More information about the Bf-blender-cvs mailing list