X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mesh_mspgl%2Fexport_mspgl.py;h=c0fd96e9b5e71550f9a0b90bf1aeef2b113b5089;hb=95cc5788bd736be92b3810d3fea398fadc8865b1;hp=6de38f8722935d884f45c4fbc441bca1e28926f7;hpb=5028e8accde81677fc4a50c771b955cf324851b2;p=libs%2Fgl.git diff --git a/blender/io_mesh_mspgl/export_mspgl.py b/blender/io_mesh_mspgl/export_mspgl.py index 6de38f87..c0fd96e9 100644 --- a/blender/io_mesh_mspgl/export_mspgl.py +++ b/blender/io_mesh_mspgl/export_mspgl.py @@ -1,5 +1,3 @@ -# $Id: mesh_export.py 137 2010-12-05 19:22:35Z tdb $ - import bpy class VertexCache: @@ -71,10 +69,14 @@ class Exporter: self.optimize_cache = False self.cache_size = 64 self.export_lines = True + self.export_uv = "UNIT0" self.tbn_vecs = False + self.tbn_uvtex = "" self.compound = False self.object = False self.material_tex = False + self.textures = "REF" + self.smoothing = "MSPGL" def stripify(self, mesh, progress = None): for f in mesh.faces: @@ -92,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: @@ -102,38 +105,49 @@ 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(): + if not n.flag: + 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(not n.flag for n in f.get_neighbors()) if score>0 and score