]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/mesh.py
Add an option to use shared meshes when exporting
[libs/gl.git] / blender / io_mspgl / mesh.py
index 3ad3cecc7c570d47b3d8cad22c3dbf0949c11b83..2cd64236b18a7cec73d54f20034d26c8a52533c7 100644 (file)
@@ -45,6 +45,7 @@ class Vertex:
        def __init__(self, mv):
                if mv.__class__==Vertex:
                        self._mvert = mv._mvert
+                       self.co = mv.co
                        self.normal = mv.normal
                        self.uvs = mv.uvs[:]
                        self.tan = mv.tan
@@ -52,6 +53,8 @@ class Vertex:
                        self.group_weight_scale = mv.group_weight_scale
                else:
                        self._mvert = mv
+                       self.co = mv.co
+                       self.normal = mv.normal
                        self.uvs = []
                        self.tan = None
                        self.bino = None
@@ -148,6 +151,8 @@ class Mesh:
                self.assign_texture_units()
 
                for f in self.faces:
+                       if len(f.vertices)>4:
+                               raise ValueError("Ngons are not supported")
                        f.vertices = [self.vertices[i] for i in f.vertices]
                        for v in f.vertices:
                                v.faces.append(f)
@@ -177,6 +182,10 @@ class Mesh:
        def __getattr__(self, attr):
                return getattr(self._mesh, attr)
 
+       def transform(self, matrix):
+               for v in self.vertices:
+                       v.co = matrix*v.co
+
        def splice(self, other):
                material_map = []
                for m in other.materials: