From: Mikko Rasa Date: Sun, 10 Sep 2017 12:19:40 +0000 (+0300) Subject: Small optimization for mesh exporter performance X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;ds=sidebyside;h=fc7566b2d83eb5b73aa516b045116e02150df83c;p=libs%2Fgl.git Small optimization for mesh exporter performance --- diff --git a/blender/io_mspgl/export_mesh.py b/blender/io_mspgl/export_mesh.py index c37d60ca..541874b2 100644 --- a/blender/io_mspgl/export_mesh.py +++ b/blender/io_mspgl/export_mesh.py @@ -64,6 +64,7 @@ class MeshExporter: cache = VertexCache(self.cache_size) island = [] + face_neighbors = [] island_strips = [] while 1: if not island: @@ -88,6 +89,8 @@ class MeshExporter: 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 @@ -97,11 +100,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