Fix a data corruption issue in mesh exporter
authorMikko Rasa <tdb@tdb.fi>
Tue, 11 Jun 2019 21:07:38 +0000 (00:07 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 11 Jun 2019 21:07:38 +0000 (00:07 +0300)
Apparently mathutils.Vector can refer to external data, in this case the
mesh's UV coordinates, which gets deleted with the mesh.  Copy the values
to make sure they are retained.

blender/io_mspgl/mesh.py

index 125bc5bbbaf01a938af18ec21eefb76239f1534b..91648d28e5b28b1ab6db369586b46d974b0c332e 100644 (file)
@@ -61,8 +61,8 @@ class Vertex:
                        self.tan = None
                        self.bino = None
                self.index = vertex.index
-               self.co = vertex.co
-               self.normal = vertex.normal
+               self.co = mathutils.Vector(vertex.co)
+               self.normal = mathutils.Vector(vertex.normal)
                self.flag = False
                self.edges = []
                self.faces = []
@@ -148,7 +148,7 @@ class UvLayer:
                else:
                        self._layer = arg
                        self.name = arg.name
-                       self.uvs = [d.uv for d in self.data]
+                       self.uvs = [mathutils.Vector(d.uv) for d in self.data]
 
                self.unit = None
                self.hidden = False