X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fmesh.py;h=2cd64236b18a7cec73d54f20034d26c8a52533c7;hb=b160f64ab6da260bad06a4e5f5bfed243e2cdc24;hp=3a7400b7e6c2f296c2a582d42af19847bdaca143;hpb=5aee3912dd2818a282e41aa5eb65c77666aa53bc;p=libs%2Fgl.git diff --git a/blender/io_mspgl/mesh.py b/blender/io_mspgl/mesh.py index 3a7400b7..2cd64236 100644 --- a/blender/io_mspgl/mesh.py +++ b/blender/io_mspgl/mesh.py @@ -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: @@ -292,10 +301,10 @@ class Mesh: if progress: progress.set_progress(0.5+i*0.5/len(self.vertices)) - def split_smooth(self, progress = None): + def split_smooth(self, progress=None): self.split_vertices(self.find_smooth_group, progress) - def split_uv(self, index, progress = None): + def split_uv(self, index, progress=None): self.split_vertices(self.find_uv_group, progress, index) def find_smooth_group(self, vertex, face):