From 2cabaeb4a72abea2a3535a5ca013b2b275d99c69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 23 Sep 2025 17:19:18 +0200 Subject: [PATCH] Refactor: convert rigid body "Bake to Keyframes" to current Action API Convert the code for the rigid body "Bake to Keyframes" operator from the legacy Actions API to the current API. No functional changes. This is part of #146586 Pull Request: https://projects.blender.org/blender/blender/pulls/147060 --- scripts/startup/bl_operators/rigidbody.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/startup/bl_operators/rigidbody.py b/scripts/startup/bl_operators/rigidbody.py index 718c923849d..e4e5768cdc8 100644 --- a/scripts/startup/bl_operators/rigidbody.py +++ b/scripts/startup/bl_operators/rigidbody.py @@ -8,6 +8,7 @@ from bpy.props import ( EnumProperty, IntProperty, ) +from bpy_extras import anim_utils class CopyRigidbodySettings(Operator): @@ -167,8 +168,13 @@ class BakeToKeyframes(Operator): # clean up keyframes for obj in objects: - action = obj.animation_data.action - for fcu in action.fcurves: + channelbag = anim_utils.action_get_channelbag_for_slot( + obj.animation_data.action, + obj.animation_data.action_slot, + ) + if not channelbag: + continue + for fcu in channelbag.fcurves: keyframe_points = fcu.keyframe_points i = 1 # remove unneeded keyframes