]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix bugs that crept in with refactoring
authorMikko Rasa <tdb@tdb.fi>
Sun, 12 Aug 2012 15:53:52 +0000 (18:53 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 12 Aug 2012 15:53:52 +0000 (18:53 +0300)
Also add an additional safeguard against an infinite loop

blender/io_mesh_mspgl/export_mspgl.py
blender/io_mesh_mspgl/mesh.py

index c776c54fea3fddec0051941e7230884abc60d695..c0fd96e9b5e71550f9a0b90bf1aeef2b113b5089 100644 (file)
@@ -111,8 +111,9 @@ class Exporter:
                                        island.append(face)
 
                                        for n in f.get_neighbors():
-                                               n.flag = True
-                                               queue.append(n)
+                                               if not n.flag:
+                                                       n.flag = True
+                                                       queue.append(n)
 
                                # Unflag the island for the next phase
                                for f in island:
@@ -127,7 +128,7 @@ class Exporter:
                                if f.flag:
                                        continue
 
-                               score = sum(n.flag for n in f.get_neighbors())
+                               score = sum(not n.flag for n in f.get_neighbors())
                                if score>0 and score<best:
                                        face = f
                                        best = score
@@ -137,6 +138,8 @@ class Exporter:
                                strip = mesh.create_strip(face, self.max_strip_len)
                                if strip:
                                        island_strips.append(strip)
+                               else:
+                                       face.flag = True
                        else:
                                # Couldn't find a candidate face for starting a strip, so we're
                                # done with this island
index d674dbdb24975c25c2ca9fafca7e61b3e4a5d2cb..aa8df8d254665d4240b50a34934753515a56e96c 100644 (file)
@@ -91,7 +91,7 @@ class Face:
                raise KeyError("No edge %s"%(key,))
 
        def get_neighbors(self):
-               neighbors = [e.other_face(f) for e in self.edges]
+               neighbors = [e.other_face(self) for e in self.edges]
                return list(filter(bool, neighbors))