]> git.tdb.fi Git - libs/gl.git/commitdiff
Make the edge map transient
authorMikko Rasa <tdb@tdb.fi>
Sat, 4 May 2019 20:11:47 +0000 (23:11 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 4 May 2019 20:11:47 +0000 (23:11 +0300)
It's only actually used to associate edges with faces so it's simpler if
it doesn't need to be maintained in other functions.

blender/io_mspgl/mesh.py

index 42b1b1bd054417a4156fbd247cfad37592f23785..a05d4537c384ab6fb5517a7f360f0084636df9d1 100644 (file)
@@ -170,7 +170,6 @@ class Mesh:
                self.vertices = [Vertex(v) for v in self.vertices]
                self.faces = [Face(f) for f in self.polygons]
                self.edges = [Edge(e) for e in self.edges]
-               self.edge_map = {e.key: e for e in self.edges}
                self.loops = self.loops[:]
 
                self.materials = self.materials[:]
@@ -192,6 +191,7 @@ class Mesh:
                for v in self.vertices:
                        v.groups = [VertexGroup(g) for g in v.groups]
 
+               edge_map = {e.key: e for e in self.edges}
                for f in self.faces:
                        if len(f.vertices)>4:
                                raise ValueError("Ngons are not supported")
@@ -201,7 +201,7 @@ class Mesh:
                                v.faces.append(f)
 
                        for k in f.edge_keys:
-                               e = self.edge_map[k]
+                               e = edge_map[k]
                                e.faces.append(f)
                                f.edges.append(e)
 
@@ -262,7 +262,6 @@ class Mesh:
                for e in self.edges[offset:]:
                        e.index += offset
                        e.key = make_edge_key(e.vertices[0].index, e.vertices[1].index)
-                       self.edge_map[e.key] = e
 
                self.lines += other.lines
 
@@ -421,14 +420,12 @@ class Mesh:
                                                        ne.faces.append(f)
                                                e = ne
                                        else:
-                                               del self.edge_map[e.key]
                                                self.vertices[i].edges.remove(e)
 
                                        e.vertices[e.vertices.index(self.vertices[i])] = v
                                        v.edges.append(e)
 
                                        e.key = make_edge_key(e.vertices[0].index, e.vertices[1].index)
-                                       self.edge_map[e.key] = e
 
                                for f in g:
                                        self.vertices[i].faces.remove(f)