From: Mikko Rasa Date: Sun, 21 Mar 2021 16:11:14 +0000 (+0200) Subject: Fix suspicious code in the mesh exporter X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2e7ed8bf667c2a3b79683cbda2ebce15019e5f88;p=libs%2Fgl.git Fix suspicious code in the mesh exporter The pivot_vertices function was expecting a list of vertices, but only one vertex was passed in. In fact the entire function seemed rather useless now that the mesh is triangulated at an early stage. --- diff --git a/blender/io_mspgl/mesh.py b/blender/io_mspgl/mesh.py index ac3f7c67..2296019e 100644 --- a/blender/io_mspgl/mesh.py +++ b/blender/io_mspgl/mesh.py @@ -95,13 +95,6 @@ class Face: n = self.vertices.index(v) return [(n+i)%len(self.vertices) for i in range(len(self.vertices))] - def pivot_vertices(self, *vt): - flags = [(v in vt) for v in self.vertices] - l = len(self.vertices) - for i in range(l): - if flags[i] and not flags[(i+l-1)%l]: - return self.vertices[i:]+self.vertices[:i] - def get_edge(self, v1, v2): key = make_edge_key(v1.index, v2.index) for e in self.edges: @@ -552,9 +545,9 @@ class Mesh: for i, v in enumerate(self.vertices): v.normal = mathutils.Vector() for f in v.faces: - fv = f.pivot_vertices(v) - edge1 = fv[1].co-fv[0].co - edge2 = fv[-1].co-fv[0].co + vi = f.pivot_vertex(v) + edge1 = f.vertices[vi[1]].co-v.co + edge2 = f.vertices[vi[-1]].co-v.co if edge1.length and edge2.length: # Use the angle between edges as a weighting factor. This gives # more consistent normals on bends with an inequal number of