def symmetrizeTarget(context, left2right): utils.setupVertexPairs(context, False) ob = context.object scn = context.scene if not utils.isTarget(ob): return bpy.ops.object.mode_set(mode='OBJECT') verts = ob.active_shape_key.data bverts = ob.data.vertices for vn in the.Mid.keys(): v = verts[vn] v.co[0] = 0 for (lvn,rvn) in the.Left.items(): lv = verts[lvn].co rv = verts[rvn].co if left2right: rv[0] = -lv[0] rv[1] = lv[1] rv[2] = lv[2] bverts[rvn].select = bverts[lvn].select else: lv[0] = -rv[0] lv[1] = rv[1] lv[2] = rv[2] bverts[lvn].select = bverts[rvn].select print("Target symmetrized") return
def execute(self, context): the.Proxy = None ob = context.object for mod in ob.modifiers: if mod.type == 'ARMATURE': mod.show_in_editmode = True mod.show_on_cage = True else: ob.modifiers.remove(mod) utils.removeShapeKeys(ob) ob.shape_key_add(name="Basis") ob["NTargets"] = 0 ob["ProxyFile"] = 0 ob["ObjFile"] = 0 ob["MhxMesh"] = True utils.setupVertexPairs(context, True) return{'FINISHED'}