Files
test/source/blender/animrig/intern/action_iterators.cc
Christoph Lendenfeld 0a4b5d93c5 Fix #126125: Pose Slider not working with layered actions
The issues was that the `get_item_transform_flags` iterated over the `curves`
list of the action, ignoring the new structure.

Fixed by using the `action_foreach_fcurve` and modifying that to work on legacy actions as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/126357
2024-08-15 13:35:28 +02:00

46 lines
1.1 KiB
C++

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup animrig
*/
#include "ANIM_action.hh"
#include "ANIM_action_iterators.hh"
#include "BLI_assert.h"
namespace blender::animrig {
void action_foreach_fcurve(Action &action,
slot_handle_t handle,
FunctionRef<void(FCurve &fcurve)> callback)
{
if (action.is_action_legacy()) {
LISTBASE_FOREACH (FCurve *, fcurve, &action.curves) {
callback(*fcurve);
}
}
else if (action.is_action_layered()) {
for (Layer *layer : action.layers()) {
for (Strip *strip : layer->strips()) {
if (!strip->is<KeyframeStrip>()) {
continue;
}
KeyframeStrip &key_strip = strip->as<KeyframeStrip>();
for (ChannelBag *bag : key_strip.channelbags()) {
if (bag->slot_handle != handle) {
continue;
}
for (FCurve *fcu : bag->fcurves()) {
BLI_assert(fcu != nullptr);
callback(*fcu);
}
}
}
}
}
}
} // namespace blender::animrig