X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Fmesh.py;h=fc31a1252a630fa0ef03fff894b7b735d31e2a78;hb=b61c103559c83d6fe7309f2ca4489f09e701c4cf;hp=aa8df8d254665d4240b50a34934753515a56e96c;hpb=fcdc70624618488c514676874006f5eddc4e63df;p=libs%2Fgl.git diff --git a/blender/io_mspgl/mesh.py b/blender/io_mspgl/mesh.py index aa8df8d2..fc31a125 100644 --- a/blender/io_mspgl/mesh.py +++ b/blender/io_mspgl/mesh.py @@ -43,11 +43,13 @@ class Vertex: self.uvs = mv.uvs[:] self.tan = mv.tan self.bino = mv.bino + self.group_weight_scale = mv.group_weight_scale else: self._mvert = mv self.uvs = [] self.tan = None self.bino = None + self.group_weight_scale = 1 self.flag = False self.faces = [] @@ -361,6 +363,12 @@ class Mesh: if v.bino.length: v.bino.normalize() + def sort_vertex_groups(self, max_groups): + for v in self.vertices: + if v.groups: + v.groups = sorted(v.groups, key=(lambda g: g.weight), reverse=True) + v.group_weight_scale = 1.0/sum(g.weight for g in v.groups[:max_groups]) + def create_strip(self, face, max_len): # Find an edge with another unused face next to it edge = None