From 0b978a20e7847cfd23929860874724b1e46fbf61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 22 Sep 2025 17:31:33 +0200 Subject: [PATCH] Refactor: convert BVH importer to use the current Action API Use the current API (i.e. not the to-be-deleted-in-5.0 one) to import F-Curves from BVH files. No functional changes. This is part of #146586 Pull Request: https://projects.blender.org/blender/blender/pulls/147060 --- scripts/addons_core/io_anim_bvh/import_bvh.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/addons_core/io_anim_bvh/import_bvh.py b/scripts/addons_core/io_anim_bvh/import_bvh.py index f999eece177..cbda5e93719 100644 --- a/scripts/addons_core/io_anim_bvh/import_bvh.py +++ b/scripts/addons_core/io_anim_bvh/import_bvh.py @@ -7,6 +7,7 @@ from math import radians, ceil import bpy from bpy.app.translations import pgettext_tip as tip_ from mathutils import Vector, Euler, Matrix +from bpy_extras import anim_utils class BVH_Node: @@ -525,6 +526,7 @@ def bvh_node_dict2armature( # imported Actions while keeping Slot auto-assignment, which means that # all Actions should use the same slot name. action_slot = action.slots.new(arm_ob.id_type, "Slot") + channelbag = anim_utils.action_ensure_channelbag_for_slot(action, action_slot) arm_ob_adt.action = action arm_ob_adt.action_slot = action_slot @@ -587,7 +589,7 @@ def bvh_node_dict2armature( # For each location x, y, z. for axis_i in range(3): - curve = action.fcurves.new(data_path=data_path, index=axis_i, action_group=bvh_node.name) + curve = channelbag.fcurves.new(data_path=data_path, index=axis_i, group_name=bvh_node.name) keyframe_points = curve.keyframe_points keyframe_points.add(num_frame) @@ -631,7 +633,7 @@ def bvh_node_dict2armature( # For each euler angle x, y, z (or quaternion w, x, y, z). for axis_i in range(len(rotate[0])): - curve = action.fcurves.new(data_path=data_path, index=axis_i, action_group=bvh_node.name) + curve = channelbag.fcurves.new(data_path=data_path, index=axis_i, group_name=bvh_node.name) keyframe_points = curve.keyframe_points keyframe_points.add(num_frame) @@ -641,7 +643,7 @@ def bvh_node_dict2armature( rotate[frame_i][axis_i], ) - for cu in action.fcurves: + for cu in channelbag.fcurves: if IMPORT_LOOP: pass # 2.5 doenst have cyclic now?