X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_mesh.py;h=3873bf329e627f2d108085b73cc0ca76b1c2b8af;hb=9d8e4aa5a9573b34fe06455af249c762433d47c0;hp=c1dd2ac09b488cd87e5e856b7a46ebdedf10b42d;hpb=912ae952489699769be43f90d4478263461964a4;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index c1dd2ac0..3873bf32 100644 --- a/blender/io_mspgl/export_mesh.py +++ b/blender/io_mspgl/export_mesh.py @@ -1,5 +1,6 @@ import itertools import bpy +import mathutils class VertexCache: def __init__(self, size): @@ -34,22 +35,16 @@ class VertexCache: class MeshExporter: def __init__(self): + self.show_progress = True self.use_strips = True - self.use_degen_tris = True + self.use_degen_tris = False self.max_strip_len = 1024 - self.optimize_cache = False + self.optimize_cache = True self.cache_size = 64 - self.export_lines = True - self.export_uv = "UNIT0" - self.tbn_vecs = False - self.tbn_uvtex = "" self.compound = False self.material_tex = False - self.smoothing = "MSPGL" - self.export_groups = False - self.max_groups = 2 - def stripify(self, mesh, progress = None): + def stripify(self, mesh, progress=None): for f in mesh.faces: f.flag = False @@ -62,6 +57,7 @@ class MeshExporter: cache = VertexCache(self.cache_size) island = [] + face_neighbors = [] island_strips = [] while 1: if not island: @@ -81,11 +77,13 @@ class MeshExporter: face = queue.pop(0) island.append(face) - for n in f.get_neighbors(): + for n in face.get_neighbors(): if not n.flag: n.flag = True queue.append(n) + face_neighbors = [f.get_neighbors() for f in island] + # Unflag the island for the next phase for f in island: f.flag = False @@ -95,11 +93,11 @@ class MeshExporter: # or along borders of a non-closed island. best = 5 face = None - for f in island: + for i, f in enumerate(island): if f.flag: continue - score = sum(not n.flag for n in f.get_neighbors()) + score = sum(not n.flag for n in face_neighbors[i]) if score>0 and score