X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fexport_mesh.py;h=3873bf329e627f2d108085b73cc0ca76b1c2b8af;hb=9d8e4aa5a9573b34fe06455af249c762433d47c0;hp=cae0e5894b97fa05f6f9fa21bd3c2f2b6bdc03b9;hpb=af4769679fc41cfd95bb12777423f7672ba5f661;p=libs%2Fgl.git diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index cae0e589..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): @@ -40,15 +41,8 @@ class MeshExporter: self.max_strip_len = 1024 self.optimize_cache = True self.cache_size = 64 - self.export_lines = False - 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): for f in mesh.faces: @@ -63,6 +57,7 @@ class MeshExporter: cache = VertexCache(self.cache_size) island = [] + face_neighbors = [] island_strips = [] while 1: if not island: @@ -82,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 @@ -96,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