- #return
-
- """faces=[Face(f) for f in mesh.faces]
-
- edges=dict([(e.key, Edge(e)) for e in mesh.edges])
- for f in faces:
- for e in f.edge_keys:
- edges[e].faces.append(f)
- f.edges.append(edges[e])
-
- smooth_limit=math.cos(mesh.degr*math.pi/180)
- for e in edges.itervalues():
- e.check_smooth(smooth_limit)
-
- if self.debug:
- ntris=sum([len(f.verts)-2 for f in faces])
- print "%d faces (%d triangles), %d edges"%(len(faces), ntris, len(edges))
-
- smooth_groups=[]
- for f in faces:
- if not f.smooth_group:
- sg=SmoothGroup(len(smooth_groups))
- smooth_groups.append(sg)
- self.find_smooth_group(f, sg)
-
- for sg in smooth_groups:
- sg.find_vertices()
- if mesh.faceUV:
- sg.separate_uv()
- sg.create_edges()
-
- verts=[]
- for sg in smooth_groups:
- for v in sg.verts:
- v.index=len(verts)
- verts.append(v)
-
- if self.debug:
- print "%d smooth groups:"%len(smooth_groups)
- for i in range(len(smooth_groups)):
- sg=smooth_groups[i]
- print " %d: %d faces, %d vertices"%(i, len(sg.faces), len(sg.verts))
- print "%d vertices total"%len(verts)"""
-
- strips=[]
- if self.use_strips:
- for f in mesh.faces:
- f.flag=False
-
- while 1:
- best=5
- face=None
- for f in mesh.faces:
- if f.flag:
- continue
- score=0
- for e in f.edges:
- other=e.other_face(f)
- if other and not other.flag:
- score+=1
- if score>0 and score<best:
- face=f
- best=score
-
- if not face:
- break
-
- strip=mesh.create_strip(face, self.use_degen_tris and sum([len(s) for s in strips])%2, self.strip_debug)
- if strip:
- strips.append(strip)
-