# generate shapekey from armature (or other) deformation # deformation should not change the vertex order import bpy obj = bpy.context.selected_objects[0] # use to_mesh to get deformed mesh data # https://blender.stackexchange.com/questions/34789/how-to-get-vertex-coordinates-after-modifier-in-python temp_data = obj.to_mesh(bpy.context.scene, True, 'PREVIEW') verts = temp_data.vertices # generate shapekey with shape_key_add and set the coordinates # https://blender.stackexchange.com/questions/111661/creating-shape-keys-using-python sk = obj.shape_key_add('Deform') sk.interpolation = 'KEY_LINEAR' for i in range(len(verts)): sk.data[i].co = verts[i].co