def rotate_fix_armature(arm_data):
global_matrix = Matrix.Rotation(radians(90), 4, "X")
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
#disconnect all bones for ease of global rotation
connectedBones = []
for bone in arm_data.edit_bones:
if bone.use_connect:
connectedBones.append(bone.name)
bone.use_connect = False
#rotate all the bones around their center
for bone in arm_data.edit_bones:
bone.transform(global_matrix)
#reconnect the bones
for bone in connectedBones:
arm_data.edit_bones[bone].use_connect = True
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
#Roughly scales the performer armature to match the enduser armature
#IN: perfromer_obj, enduser_obj, Blender objects whose .data is an armature.
评论列表
文章目录