import bpy scene = bpy.data.scenes[0] bpy.ops.object.mode_set(mode='OBJECT') body_obj= bpy.data.objects['metarig'] body_obj.select_set(True) ac = [a for a in bpy.data.actions if a.name == 'legs.walk_3'][0] body_obj.animation_data.action = ac bpy.ops.nla.bake(frame_start=(0), frame_end=(50), step=10, only_selected=False, visual_keying=True, clear_constraints=False, use_current_action=True, bake_types={'POSE'}) for i in range(0, 50 + 1, 10): scene.frame_set(i) for pbone in body_obj.pose.bones: if pbone.name in ["thigh.L"]: matrix_basis_q = pbone.matrix_basis.to_quaternion() print(f"pbone={pbone.name} matrix_basis_q={matrix_basis_q} frame={i}".replace("-0.000", "0.000"))