1

In GUI, it's easy this operation in Object -> Rigid Body -> Bake to keyframes. How to do that in python scripts?

I tried to write some code as below:

bpy.ops.anim.keyframe_insert(type='BUILTIN_KSI_LocRot')
bpy.ops.rigidbody.objects_remove()
bpy.ops.rigidbody.bake_to_keyframes(frame_start=1, frame_end=25)

And I got:

RuntimeError: Operator bpy.ops.anim.keyframe_insert_by_name.poll() failed, context is incorrect

Any solutions?

yang Z
  • 41
  • 3

0 Answers0