]> git.tdb.fi Git - libs/gl.git/commitdiff
Some cleanups to exporter code
authorMikko Rasa <tdb@tdb.fi>
Sun, 12 May 2019 05:36:17 +0000 (08:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 12 May 2019 05:36:17 +0000 (08:36 +0300)
blender/io_mspgl/export_mesh.py
blender/io_mspgl/mesh.py

index 771f825e781b9d6d547b86f0060eb5e1633cbe56..3e146cad24699d956b1a48bd537d8ffc6ef4f5a3 100644 (file)
@@ -7,7 +7,6 @@ class MeshExporter:
                self.show_progress = True
                self.use_strips = True
                self.use_degen_tris = False
-               self.material_tex = False
 
        def join_strips(self, strips):
                big_strip = []
index c3767bd9f18884718941977115da2d66f3a1a756..f357936275ae6d352a5c6ad983dccf4d809c4421 100644 (file)
@@ -114,7 +114,7 @@ class Face:
                        if flags[i] and not flags[(i+l-1)%l]:
                                return self.vertices[i:]+self.vertices[:i]
 
-       def get_edge(self, v1, v2):     
+       def get_edge(self, v1, v2):
                key = make_edge_key(v1.index, v2.index)
                for e in self.edges:
                        if e.key==key:
@@ -143,6 +143,7 @@ class UvLayer:
                if type(arg)==str:
                        self._layer = None
                        self.name = arg
+                       self.uvs = []
                else:
                        self._layer = arg
                        self.name = arg.name
@@ -172,20 +173,20 @@ class Mesh:
                self.vertex_groups = mesh.vertex_groups
 
                # Clone basic data
-               self.vertices = [Vertex(v) for v in self.vertices]
+               self.vertices = [Vertex(v) for v in mesh.vertices]
                for v in self.vertices:
                        v.groups = [VertexGroup(g) for g in v.groups]
 
-               self.faces = [Face(f) for f in self.polygons]
-               self.edges = [Edge(e) for e in self.edges]
-               self.loops = self.loops[:]
-               self.materials = self.materials[:]
+               self.faces = [Face(f) for f in mesh.polygons]
+               self.edges = [Edge(e) for e in mesh.edges]
+               self.loops = mesh.loops[:]
+               self.materials = mesh.materials[:]
 
                # Clone only the desired UV layers
-               if self.use_uv=='NONE' or not self.uv_layers:
+               if self.use_uv=='NONE' or not mesh.uv_layers:
                        self.uv_layers = []
                else:
-                       self.uv_layers = [UvLayer(u) for u in self.uv_layers]
+                       self.uv_layers = [UvLayer(u) for u in mesh.uv_layers]
                        self.uv_layers = sorted([u for u in self.uv_layers if not u.hidden], key=(lambda u: (u.unit or 1000, u.name)))
 
                        if self.use_uv=='UNIT0':