Blender V5.0
action_bones.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BKE_action.hh"
10
11#include "BLI_string.h"
12
13#include "DNA_action_types.h"
14#include "DNA_anim_types.h"
15#include "DNA_armature_types.h"
16
17#include "ANIM_action_legacy.hh"
18
19namespace blender::bke {
20
22 const blender::animrig::slot_handle_t slot_handle,
23 FoundFCurveCallback callback)
24{
25 auto const_callback = [&](const FCurve *fcurve, const char *bone_name) {
26 callback(const_cast<FCurve *>(fcurve), bone_name);
27 };
29 const_cast<const bAction *>(action), slot_handle, const_callback);
30}
31
33 const blender::animrig::slot_handle_t slot_handle,
35{
36 for (const FCurve *fcu : animrig::legacy::fcurves_for_action_slot(action, slot_handle)) {
37 char bone_name[MAXBONENAME];
38 if (!BLI_str_quoted_substr(fcu->rna_path, "pose.bones[", bone_name, sizeof(bone_name))) {
39 continue;
40 }
41 callback(fcu, bone_name);
42 }
43}
44
45} // namespace blender::bke
Functions for backward compatibility with the legacy Action API.
Blender kernel action and pose functionality.
bool bool BLI_str_quoted_substr(const char *__restrict str, const char *__restrict prefix, char *result, size_t result_maxncpy)
Definition string.cc:521
#define MAXBONENAME
Vector< FCurve * > fcurves_for_action_slot(bAction *action, slot_handle_t slot_handle)
decltype(::ActionSlot::handle) slot_handle_t
blender::FunctionRef< void(const FCurve *fcurve, const char *bone_name)> FoundFCurveCallbackConst
void BKE_action_find_fcurves_with_bones(bAction *action, blender::animrig::slot_handle_t slot_handle, FoundFCurveCallback callback)
blender::FunctionRef< void(FCurve *fcurve, const char *bone_name)> FoundFCurveCallback