]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mesh_mspgl/export_mspgl.py
Fix bugs that crept in with refactoring
[libs/gl.git] / blender / io_mesh_mspgl / export_mspgl.py
index 124114e5fe60cb1111cf0385428bb149c749cd26..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
@@ -323,12 +326,13 @@ class Exporter:
                                        else:
                                                out_file.write("multitexcoord2", u.unit, *v.uvs[i])
                                        uvs[i] = v.uvs[i]
-                       if v.tan!=tan:
-                               out_file.write("attrib3", 3, *v.tan)
-                               tan = v.tan
-                       if v.bino!=bino:
-                               out_file.write("attrib3", 4, *v.bino)
-                               bino = v.bino
+                       if self.tbn_vecs:
+                               if v.tan!=tan:
+                                       out_file.write("attrib3", 3, *v.tan)
+                                       tan = v.tan
+                               if v.bino!=bino:
+                                       out_file.write("attrib3", 4, *v.bino)
+                                       bino = v.bino
                        out_file.write("vertex3", *v.co)
                out_file.end()
                for s in strips: