X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mesh_mspgl%2Fexport_mspgl.py;h=c776c54fea3fddec0051941e7230884abc60d695;hb=6aad00e0661dd515c0bc5a6ca05215bf6718bc75;hp=5a1bbe1130be97b39acaf49c067679da4798f070;hpb=ccce05f213b3e97e18d88c1665c144df7ed1c218;p=libs%2Fgl.git diff --git a/blender/io_mesh_mspgl/export_mspgl.py b/blender/io_mesh_mspgl/export_mspgl.py index 5a1bbe11..c776c54f 100644 --- a/blender/io_mesh_mspgl/export_mspgl.py +++ b/blender/io_mesh_mspgl/export_mspgl.py @@ -75,6 +75,7 @@ class Exporter: self.compound = False self.object = False self.material_tex = False + self.textures = "REF" self.smoothing = "MSPGL" def stripify(self, mesh, progress = None): @@ -93,6 +94,7 @@ class Exporter: island_strips = [] while 1: if not island: + # No current island; find any unused face to start from queue = [] for f in mesh.faces: if not f.flag: @@ -103,38 +105,46 @@ class Exporter: if not queue: break + # Find all faces connected to the first one while queue: - f = queue[0] - del queue[0] - island.append(f) + face = queue.pop(0) + island.append(face) - for e in f.edges: - other = e.other_face(f) - if other and not other.flag: - other.flag = True - queue.append(other) + for n in f.get_neighbors(): + n.flag = True + queue.append(n) + # Unflag the island for the next phase for f in island: f.flag = False + # Find an unused face with as few unused neighbors as possible, but + # at least one. This heuristic gives a preference to faces in corners + # or along borders of a non-closed island. best = 5 face = None for f in island: if f.flag: continue - score = 0 - for e in f.edges: - other = e.other_face(f) - if other and not other.flag: - score += 1 + + score = sum(n.flag for n in f.get_neighbors()) if score>0 and score