Refactor: rename ChannelBag and channel_bag

We've had a bunch of inconsistency between `channel_bag` and `channelbag` in the
code base.  After discussion with @dr.sybren, we decided to standardize on
`channelbag` and also rename the camelcase `ChannelBag` to `Channelbag` to be
consistent with that.

This PR implements those changes.

Note that the reason we standardized on `channelbag` rather than `channel_bag`
is because it makes things clearer when stringing multiple terms together in
type and function names.  For example, in `channelbag_fcurves_move()` it makes
it clear that `channelbag` describes one thing, rather than `channel` and `bag`
being two separate things.

No functional changes intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/130988
This commit is contained in:
Nathan Vegdahl
2024-12-02 17:55:59 +01:00
committed by Nathan Vegdahl
parent 0a45cb3867
commit 089c3cd85c
27 changed files with 686 additions and 684 deletions

View File

@@ -768,42 +768,42 @@ class StripKeyframeData : public ::ActionStripKeyframeData {
explicit StripKeyframeData(const StripKeyframeData &other);
~StripKeyframeData();
/* ChannelBag array access. */
blender::Span<const ChannelBag *> channelbags() const;
blender::Span<ChannelBag *> channelbags();
const ChannelBag *channelbag(int64_t index) const;
ChannelBag *channelbag(int64_t index);
/* Channelbag array access. */
blender::Span<const Channelbag *> channelbags() const;
blender::Span<Channelbag *> channelbags();
const Channelbag *channelbag(int64_t index) const;
Channelbag *channelbag(int64_t index);
/**
* Find the animation channels for this slot.
*
* \return nullptr if there is none yet for this slot.
*/
const ChannelBag *channelbag_for_slot(const Slot &slot) const;
ChannelBag *channelbag_for_slot(const Slot &slot);
const ChannelBag *channelbag_for_slot(slot_handle_t slot_handle) const;
ChannelBag *channelbag_for_slot(slot_handle_t slot_handle);
const Channelbag *channelbag_for_slot(const Slot &slot) const;
Channelbag *channelbag_for_slot(const Slot &slot);
const Channelbag *channelbag_for_slot(slot_handle_t slot_handle) const;
Channelbag *channelbag_for_slot(slot_handle_t slot_handle);
/**
* Add the animation channels for this slot.
*
* Should only be called when there is no `ChannelBag` for this slot yet.
* Should only be called when there is no `Channelbag` for this slot yet.
*/
ChannelBag &channelbag_for_slot_add(const Slot &slot);
Channelbag &channelbag_for_slot_add(const Slot &slot);
/**
* Find the ChannelBag for `slot`, or if none exists, create it.
* Find the Channelbag for `slot`, or if none exists, create it.
*/
ChannelBag &channelbag_for_slot_ensure(const Slot &slot);
Channelbag &channelbag_for_slot_ensure(const Slot &slot);
/**
* Remove the ChannelBag from this slot.
* Remove the Channelbag from this slot.
*
* After this call the reference is no longer valid, as the memory will have been freed.
*
* \return true when the ChannelBag was found & removed, false if it wasn't found.
* \return true when the Channelbag was found & removed, false if it wasn't found.
*/
bool channelbag_remove(ChannelBag &channelbag_to_remove);
bool channelbag_remove(Channelbag &channelbag_to_remove);
/**
* Remove all strip data for the given slot.
@@ -813,7 +813,7 @@ class StripKeyframeData : public ::ActionStripKeyframeData {
void slot_data_remove(slot_handle_t slot_handle);
/** Return the channelbag's index, or -1 if there is none for this slot handle. */
int64_t find_channelbag_index(const ChannelBag &channelbag) const;
int64_t find_channelbag_index(const Channelbag &channelbag) const;
SingleKeyingResult keyframe_insert(Main *bmain,
const Slot &slot,
@@ -829,11 +829,11 @@ static_assert(sizeof(StripKeyframeData) == sizeof(::ActionStripKeyframeData),
/**
* Collection of F-Curves, intended for a specific Slot handle.
*/
class ChannelBag : public ::ActionChannelBag {
class Channelbag : public ::ActionChannelbag {
public:
ChannelBag() = default;
explicit ChannelBag(const ChannelBag &other);
~ChannelBag();
Channelbag() = default;
explicit Channelbag(const Channelbag &other);
~Channelbag();
/* FCurves access. */
blender::Span<const FCurve *> fcurves() const;
@@ -862,7 +862,7 @@ class ChannelBag : public ::ActionChannelBag {
FCurve &fcurve_ensure(Main *bmain, FCurveDescriptor fcurve_descriptor);
/**
* Create an F-Curve, but only if it doesn't exist yet in this ChannelBag.
* Create an F-Curve, but only if it doesn't exist yet in this Channelbag.
*
* \return the F-Curve it it was created, or nullptr if it already existed.
*
@@ -875,9 +875,9 @@ class ChannelBag : public ::ActionChannelBag {
FCurve *fcurve_create_unique(Main *bmain, FCurveDescriptor fcurve_descriptor);
/**
* Append an F-Curve to this ChannelBag.
* Append an F-Curve to this Channelbag.
*
* Ownership of the F-Curve is also transferred to the ChannelBag. The F-Curve
* Ownership of the F-Curve is also transferred to the Channelbag. The F-Curve
* will not belong to any channel group after appending.
*
* This is considered a low-level function. Things like depsgraph relations
@@ -886,7 +886,7 @@ class ChannelBag : public ::ActionChannelBag {
void fcurve_append(FCurve &fcurve);
/**
* Remove an F-Curve from the ChannelBag.
* Remove an F-Curve from the Channelbag.
*
* Additionally, if the fcurve was the last fcurve in a channel group, that
* channel group is also deleted.
@@ -901,7 +901,7 @@ class ChannelBag : public ::ActionChannelBag {
bool fcurve_remove(FCurve &fcurve_to_remove);
/**
* Remove an F-Curve from the ChannelBag, identified by its index in the array.
* Remove an F-Curve from the Channelbag, identified by its index in the array.
*
* Acts the same as fcurve_remove() except it's a bit more efficient as it
* doesn't need to find the F-Curve in the array first.
@@ -911,7 +911,7 @@ class ChannelBag : public ::ActionChannelBag {
void fcurve_remove_by_index(int64_t fcurve_array_index);
/**
* Detach an F-Curve from the ChannelBag.
* Detach an F-Curve from the Channelbag.
*
* Additionally, if the fcurve was the last fcurve in a channel group, that
* channel group is deleted.
@@ -926,7 +926,7 @@ class ChannelBag : public ::ActionChannelBag {
bool fcurve_detach(FCurve &fcurve_to_detach);
/**
* Detach an F-Curve from the ChannelBag, identified by its index in the array.
* Detach an F-Curve from the Channelbag, identified by its index in the array.
*
* Acts the same as fcurve_detach() except it's a bit more efficient as it
* doesn't need to find the F-Curve in the array first.
@@ -947,7 +947,7 @@ class ChannelBag : public ::ActionChannelBag {
void fcurve_move(FCurve &fcurve, int to_fcurve_index);
/**
* Remove all F-Curves from this ChannelBag.
* Remove all F-Curves from this Channelbag.
*/
void fcurves_clear();
@@ -981,7 +981,7 @@ class ChannelBag : public ::ActionChannelBag {
* Create a new empty channel group with the given name.
*
* The new group is added to the end of the channel group array of the
* ChannelBag.
* Channelbag.
*
* This function ensures the group has a unique name, and thus the name of the
* created group may differ from the `name` parameter.
@@ -994,7 +994,7 @@ class ChannelBag : public ::ActionChannelBag {
* Find a channel group with the given name, or if none exists create one.
*
* If a new group is created, it's added to the end of the channel group array
* of the ChannelBag.
* of the Channelbag.
*
* \return A reference to the channel group.
*/
@@ -1051,7 +1051,7 @@ class ChannelBag : public ::ActionChannelBag {
/**
* Create an F-Curve.
*
* Assumes that there is no such F-Curve yet on this ChannelBag. If it is
* Assumes that there is no such F-Curve yet on this Channelbag. If it is
* uncertain whether this is the case, use `fcurve_create_unique()` instead.
*
* \param bmain: Used to tag the dependency graph(s) for relationship
@@ -1125,13 +1125,13 @@ class ChannelBag : public ::ActionChannelBag {
void restore_channel_group_invariants();
};
static_assert(sizeof(ChannelBag) == sizeof(::ActionChannelBag),
static_assert(sizeof(Channelbag) == sizeof(::ActionChannelbag),
"DNA struct and its C++ wrapper must have the same size");
/**
* A group of channels within a ChannelBag.
* A group of channels within a Channelbag.
*
* This does *not* own the fcurves--the ChannelBag does. This just groups
* This does *not* own the fcurves--the Channelbag does. This just groups
* fcurves for organizational purposes, e.g. for use in the channel list in the
* animation editors.
*
@@ -1331,9 +1331,9 @@ Action *get_action(ID &animated_id);
*/
std::optional<std::pair<Action *, Slot *>> get_action_slot_pair(ID &animated_id);
const animrig::ChannelBag *channelbag_for_action_slot(const Action &action,
const animrig::Channelbag *channelbag_for_action_slot(const Action &action,
slot_handle_t slot_handle);
animrig::ChannelBag *channelbag_for_action_slot(Action &action, slot_handle_t slot_handle);
animrig::Channelbag *channelbag_for_action_slot(Action &action, slot_handle_t slot_handle);
/**
* Return the F-Curves for this specific slot handle.
@@ -1525,20 +1525,20 @@ void action_fcurve_move(Action &action_dst,
FCurve &fcurve);
/**
* Moves all F-Curves from one ChannelBag to the other.
* Moves all F-Curves from one Channelbag to the other.
*
* The ChannelBags do not need to be part of the same action, or even belong to
* The Channelbags do not need to be part of the same action, or even belong to
* an action at all.
*
* If the F-Curves belonged to channel groups, the group membership also carries
* over to the destination ChannelBag. If groups with the same names don't
* over to the destination Channelbag. If groups with the same names don't
* exist, they are created. \see blender::animrig::action_fcurve_detach
*
* The order of existing channel groups in the destination ChannelBag are not
* The order of existing channel groups in the destination Channelbag are not
* changed, and any new groups are placed after those in the order they appeared
* in the src group.
*/
void channelbag_fcurves_move(ChannelBag &channelbag_dst, ChannelBag &channelbag_src);
void channelbag_fcurves_move(Channelbag &channelbag_dst, Channelbag &channelbag_src);
/**
* Find an appropriate user of the given Action + Slot for keyframing purposes.
@@ -1718,11 +1718,11 @@ inline const blender::animrig::StripKeyframeData &ActionStripKeyframeData::wrap(
return *reinterpret_cast<const blender::animrig::StripKeyframeData *>(this);
}
inline blender::animrig::ChannelBag &ActionChannelBag::wrap()
inline blender::animrig::Channelbag &ActionChannelbag::wrap()
{
return *reinterpret_cast<blender::animrig::ChannelBag *>(this);
return *reinterpret_cast<blender::animrig::Channelbag *>(this);
}
inline const blender::animrig::ChannelBag &ActionChannelBag::wrap() const
inline const blender::animrig::Channelbag &ActionChannelbag::wrap() const
{
return *reinterpret_cast<const blender::animrig::ChannelBag *>(this);
return *reinterpret_cast<const blender::animrig::Channelbag *>(this);
}

View File

@@ -20,7 +20,7 @@ namespace blender::animrig {
class Action;
class Layer;
class Strip;
class ChannelBag;
class Channelbag;
} // namespace blender::animrig
namespace blender::animrig {

View File

@@ -19,20 +19,20 @@
namespace blender::animrig::legacy {
/**
* Return the ChannelBag for compatibility with the legacy Python API.
* Return the Channelbag for compatibility with the legacy Python API.
*
* \return the ChannelBag for the first slot, of the first keyframe Strip on the
* \return the Channelbag for the first slot, of the first keyframe Strip on the
* bottom layer, or nullptr if that doesn't exist.
*/
ChannelBag *channelbag_get(Action &action);
Channelbag *channelbag_get(Action &action);
/**
* Ensure a ChannelBag exists, for compatibility with the legacy Python API.
* Ensure a Channelbag exists, for compatibility with the legacy Python API.
*
* This basically is channelbag_get(action), additionally creating the necessary
* slot, layer, and keyframe strip if necessary.
*/
ChannelBag &channelbag_ensure(Action &action);
Channelbag &channelbag_ensure(Action &action);
/**
* Return all F-Curves in the Action.

View File

@@ -1624,51 +1624,51 @@ StripKeyframeData::StripKeyframeData(const StripKeyframeData &other)
{
memcpy(this, &other, sizeof(*this));
this->channelbag_array = MEM_cnew_array<ActionChannelBag *>(other.channelbag_array_num,
this->channelbag_array = MEM_cnew_array<ActionChannelbag *>(other.channelbag_array_num,
__func__);
Span<const ChannelBag *> channelbags_src = other.channelbags();
Span<const Channelbag *> channelbags_src = other.channelbags();
for (int i : channelbags_src.index_range()) {
this->channelbag_array[i] = MEM_new<animrig::ChannelBag>(__func__, *other.channelbag(i));
this->channelbag_array[i] = MEM_new<animrig::Channelbag>(__func__, *other.channelbag(i));
}
}
StripKeyframeData::~StripKeyframeData()
{
for (ChannelBag *channelbag_for_slot : this->channelbags()) {
for (Channelbag *channelbag_for_slot : this->channelbags()) {
MEM_delete(channelbag_for_slot);
}
MEM_SAFE_FREE(this->channelbag_array);
this->channelbag_array_num = 0;
}
blender::Span<const ChannelBag *> StripKeyframeData::channelbags() const
blender::Span<const Channelbag *> StripKeyframeData::channelbags() const
{
return blender::Span<ChannelBag *>{reinterpret_cast<ChannelBag **>(this->channelbag_array),
return blender::Span<Channelbag *>{reinterpret_cast<Channelbag **>(this->channelbag_array),
this->channelbag_array_num};
}
blender::Span<ChannelBag *> StripKeyframeData::channelbags()
blender::Span<Channelbag *> StripKeyframeData::channelbags()
{
return blender::Span<ChannelBag *>{reinterpret_cast<ChannelBag **>(this->channelbag_array),
return blender::Span<Channelbag *>{reinterpret_cast<Channelbag **>(this->channelbag_array),
this->channelbag_array_num};
}
const ChannelBag *StripKeyframeData::channelbag(const int64_t index) const
const Channelbag *StripKeyframeData::channelbag(const int64_t index) const
{
return &this->channelbag_array[index]->wrap();
}
ChannelBag *StripKeyframeData::channelbag(const int64_t index)
Channelbag *StripKeyframeData::channelbag(const int64_t index)
{
return &this->channelbag_array[index]->wrap();
}
const ChannelBag *StripKeyframeData::channelbag_for_slot(const slot_handle_t slot_handle) const
const Channelbag *StripKeyframeData::channelbag_for_slot(const slot_handle_t slot_handle) const
{
for (const ChannelBag *channels : this->channelbags()) {
for (const Channelbag *channels : this->channelbags()) {
if (channels->slot_handle == slot_handle) {
return channels;
}
}
return nullptr;
}
int64_t StripKeyframeData::find_channelbag_index(const ChannelBag &channelbag) const
int64_t StripKeyframeData::find_channelbag_index(const Channelbag &channelbag) const
{
for (int64_t index = 0; index < this->channelbag_array_num; index++) {
if (this->channelbag(index) == &channelbag) {
@@ -1677,51 +1677,51 @@ int64_t StripKeyframeData::find_channelbag_index(const ChannelBag &channelbag) c
}
return -1;
}
ChannelBag *StripKeyframeData::channelbag_for_slot(const slot_handle_t slot_handle)
Channelbag *StripKeyframeData::channelbag_for_slot(const slot_handle_t slot_handle)
{
const auto *const_this = const_cast<const StripKeyframeData *>(this);
const auto *const_channels = const_this->channelbag_for_slot(slot_handle);
return const_cast<ChannelBag *>(const_channels);
return const_cast<Channelbag *>(const_channels);
}
const ChannelBag *StripKeyframeData::channelbag_for_slot(const Slot &slot) const
const Channelbag *StripKeyframeData::channelbag_for_slot(const Slot &slot) const
{
return this->channelbag_for_slot(slot.handle);
}
ChannelBag *StripKeyframeData::channelbag_for_slot(const Slot &slot)
Channelbag *StripKeyframeData::channelbag_for_slot(const Slot &slot)
{
return this->channelbag_for_slot(slot.handle);
}
ChannelBag &StripKeyframeData::channelbag_for_slot_add(const Slot &slot)
Channelbag &StripKeyframeData::channelbag_for_slot_add(const Slot &slot)
{
BLI_assert_msg(channelbag_for_slot(slot) == nullptr,
"Cannot add chans-for-slot for already-registered slot");
ChannelBag &channels = MEM_new<ActionChannelBag>(__func__)->wrap();
Channelbag &channels = MEM_new<ActionChannelbag>(__func__)->wrap();
channels.slot_handle = slot.handle;
grow_array_and_append<ActionChannelBag *>(
grow_array_and_append<ActionChannelbag *>(
&this->channelbag_array, &this->channelbag_array_num, &channels);
return channels;
}
ChannelBag &StripKeyframeData::channelbag_for_slot_ensure(const Slot &slot)
Channelbag &StripKeyframeData::channelbag_for_slot_ensure(const Slot &slot)
{
ChannelBag *channel_bag = this->channelbag_for_slot(slot);
if (channel_bag != nullptr) {
return *channel_bag;
Channelbag *channelbag = this->channelbag_for_slot(slot);
if (channelbag != nullptr) {
return *channelbag;
}
return this->channelbag_for_slot_add(slot);
}
static void channelbag_ptr_destructor(ActionChannelBag **dna_channelbag_ptr)
static void channelbag_ptr_destructor(ActionChannelbag **dna_channelbag_ptr)
{
ChannelBag &channelbag = (*dna_channelbag_ptr)->wrap();
Channelbag &channelbag = (*dna_channelbag_ptr)->wrap();
MEM_delete(&channelbag);
};
bool StripKeyframeData::channelbag_remove(ChannelBag &channelbag_to_remove)
bool StripKeyframeData::channelbag_remove(Channelbag &channelbag_to_remove)
{
const int64_t channelbag_index = this->find_channelbag_index(channelbag_to_remove);
if (channelbag_index < 0) {
@@ -1739,26 +1739,26 @@ bool StripKeyframeData::channelbag_remove(ChannelBag &channelbag_to_remove)
void StripKeyframeData::slot_data_remove(const slot_handle_t slot_handle)
{
ChannelBag *channelbag = this->channelbag_for_slot(slot_handle);
Channelbag *channelbag = this->channelbag_for_slot(slot_handle);
if (!channelbag) {
return;
}
this->channelbag_remove(*channelbag);
}
const FCurve *ChannelBag::fcurve_find(const FCurveDescriptor fcurve_descriptor) const
const FCurve *Channelbag::fcurve_find(const FCurveDescriptor fcurve_descriptor) const
{
return animrig::fcurve_find(this->fcurves(), fcurve_descriptor);
}
FCurve *ChannelBag::fcurve_find(const FCurveDescriptor fcurve_descriptor)
FCurve *Channelbag::fcurve_find(const FCurveDescriptor fcurve_descriptor)
{
/* Intermediate variable needed to disambiguate const/non-const overloads. */
Span<FCurve *> fcurves = this->fcurves();
return animrig::fcurve_find(fcurves, fcurve_descriptor);
}
FCurve &ChannelBag::fcurve_ensure(Main *bmain, const FCurveDescriptor fcurve_descriptor)
FCurve &Channelbag::fcurve_ensure(Main *bmain, const FCurveDescriptor fcurve_descriptor)
{
if (FCurve *existing_fcurve = this->fcurve_find(fcurve_descriptor)) {
return *existing_fcurve;
@@ -1766,7 +1766,7 @@ FCurve &ChannelBag::fcurve_ensure(Main *bmain, const FCurveDescriptor fcurve_des
return this->fcurve_create(bmain, fcurve_descriptor);
}
FCurve *ChannelBag::fcurve_create_unique(Main *bmain, FCurveDescriptor fcurve_descriptor)
FCurve *Channelbag::fcurve_create_unique(Main *bmain, FCurveDescriptor fcurve_descriptor)
{
if (this->fcurve_find(fcurve_descriptor)) {
return nullptr;
@@ -1774,7 +1774,7 @@ FCurve *ChannelBag::fcurve_create_unique(Main *bmain, FCurveDescriptor fcurve_de
return &this->fcurve_create(bmain, fcurve_descriptor);
}
FCurve &ChannelBag::fcurve_create(Main *bmain, FCurveDescriptor fcurve_descriptor)
FCurve &Channelbag::fcurve_create(Main *bmain, FCurveDescriptor fcurve_descriptor)
{
FCurve *new_fcurve = create_fcurve_for_channel(fcurve_descriptor);
@@ -1802,7 +1802,7 @@ FCurve &ChannelBag::fcurve_create(Main *bmain, FCurveDescriptor fcurve_descripto
return *new_fcurve;
}
void ChannelBag::fcurve_append(FCurve &fcurve)
void Channelbag::fcurve_append(FCurve &fcurve)
{
/* Appended F-Curves don't belong to any group yet, so better make sure their
* group pointer reflects that. */
@@ -1816,7 +1816,7 @@ static void fcurve_ptr_destructor(FCurve **fcurve_ptr)
BKE_fcurve_free(*fcurve_ptr);
};
bool ChannelBag::fcurve_remove(FCurve &fcurve_to_remove)
bool Channelbag::fcurve_remove(FCurve &fcurve_to_remove)
{
if (!this->fcurve_detach(fcurve_to_remove)) {
return false;
@@ -1825,7 +1825,7 @@ bool ChannelBag::fcurve_remove(FCurve &fcurve_to_remove)
return true;
}
void ChannelBag::fcurve_remove_by_index(const int64_t fcurve_index)
void Channelbag::fcurve_remove_by_index(const int64_t fcurve_index)
{
/* Grab the pointer before it's detached, so we can free it after. */
FCurve *fcurve_to_remove = this->fcurve(fcurve_index);
@@ -1837,7 +1837,7 @@ void ChannelBag::fcurve_remove_by_index(const int64_t fcurve_index)
static void fcurve_ptr_noop_destructor(FCurve ** /*fcurve_ptr*/) {}
bool ChannelBag::fcurve_detach(FCurve &fcurve_to_detach)
bool Channelbag::fcurve_detach(FCurve &fcurve_to_detach)
{
const int64_t fcurve_index = this->fcurves().first_index_try(&fcurve_to_detach);
if (fcurve_index < 0) {
@@ -1847,7 +1847,7 @@ bool ChannelBag::fcurve_detach(FCurve &fcurve_to_detach)
return true;
}
void ChannelBag::fcurve_detach_by_index(const int64_t fcurve_index)
void Channelbag::fcurve_detach_by_index(const int64_t fcurve_index)
{
BLI_assert(fcurve_index >= 0);
BLI_assert(fcurve_index < this->fcurve_array_num);
@@ -1876,7 +1876,7 @@ void ChannelBag::fcurve_detach_by_index(const int64_t fcurve_index)
* depsgraph evaluation results though. */
}
void ChannelBag::fcurve_move(FCurve &fcurve, int to_fcurve_index)
void Channelbag::fcurve_move(FCurve &fcurve, int to_fcurve_index)
{
BLI_assert(to_fcurve_index >= 0 && to_fcurve_index < this->fcurves().size());
@@ -1889,7 +1889,7 @@ void ChannelBag::fcurve_move(FCurve &fcurve, int to_fcurve_index)
this->restore_channel_group_invariants();
}
void ChannelBag::fcurves_clear()
void Channelbag::fcurves_clear()
{
dna::array::clear(&this->fcurve_array, &this->fcurve_array_num, nullptr, fcurve_ptr_destructor);
@@ -1976,7 +1976,7 @@ SingleKeyingResult StripKeyframeData::keyframe_insert(Main *bmain,
fcurve = &this->channelbag_for_slot_ensure(slot).fcurve_ensure(bmain, fcurve_descriptor);
}
else {
ChannelBag *channels = this->channelbag_for_slot(slot);
Channelbag *channels = this->channelbag_for_slot(slot);
if (channels != nullptr) {
fcurve = channels->fcurve_find(fcurve_descriptor);
}
@@ -2032,9 +2032,9 @@ SingleKeyingResult StripKeyframeData::keyframe_insert(Main *bmain,
return SingleKeyingResult::SUCCESS;
}
/* ActionChannelBag implementation. */
/* ActionChannelbag implementation. */
ChannelBag::ChannelBag(const ChannelBag &other)
Channelbag::Channelbag(const Channelbag &other)
{
this->slot_handle = other.slot_handle;
@@ -2050,7 +2050,7 @@ ChannelBag::ChannelBag(const ChannelBag &other)
for (int i = 0; i < other.group_array_num; i++) {
const bActionGroup *group_src = other.group_array[i];
this->group_array[i] = static_cast<bActionGroup *>(MEM_dupallocN(group_src));
this->group_array[i]->channel_bag = this;
this->group_array[i]->channelbag = this;
}
/* BKE_fcurve_copy() resets the FCurve's group pointer. Which is good, because the groups are
@@ -2058,7 +2058,7 @@ ChannelBag::ChannelBag(const ChannelBag &other)
this->restore_channel_group_invariants();
}
ChannelBag::~ChannelBag()
Channelbag::~Channelbag()
{
for (FCurve *fcu : this->fcurves()) {
BKE_fcurve_free(fcu);
@@ -2073,43 +2073,43 @@ ChannelBag::~ChannelBag()
this->group_array_num = 0;
}
blender::Span<const FCurve *> ChannelBag::fcurves() const
blender::Span<const FCurve *> Channelbag::fcurves() const
{
return blender::Span<FCurve *>{this->fcurve_array, this->fcurve_array_num};
}
blender::Span<FCurve *> ChannelBag::fcurves()
blender::Span<FCurve *> Channelbag::fcurves()
{
return blender::Span<FCurve *>{this->fcurve_array, this->fcurve_array_num};
}
const FCurve *ChannelBag::fcurve(const int64_t index) const
const FCurve *Channelbag::fcurve(const int64_t index) const
{
return this->fcurve_array[index];
}
FCurve *ChannelBag::fcurve(const int64_t index)
FCurve *Channelbag::fcurve(const int64_t index)
{
return this->fcurve_array[index];
}
blender::Span<const bActionGroup *> ChannelBag::channel_groups() const
blender::Span<const bActionGroup *> Channelbag::channel_groups() const
{
return blender::Span<bActionGroup *>{this->group_array, this->group_array_num};
}
blender::Span<bActionGroup *> ChannelBag::channel_groups()
blender::Span<bActionGroup *> Channelbag::channel_groups()
{
return blender::Span<bActionGroup *>{this->group_array, this->group_array_num};
}
const bActionGroup *ChannelBag::channel_group(const int64_t index) const
const bActionGroup *Channelbag::channel_group(const int64_t index) const
{
BLI_assert(index < this->group_array_num);
return this->group_array[index];
}
bActionGroup *ChannelBag::channel_group(const int64_t index)
bActionGroup *Channelbag::channel_group(const int64_t index)
{
BLI_assert(index < this->group_array_num);
return this->group_array[index];
}
const bActionGroup *ChannelBag::channel_group_find(const StringRef name) const
const bActionGroup *Channelbag::channel_group_find(const StringRef name) const
{
for (const bActionGroup *group : this->channel_groups()) {
if (name == StringRef{group->name}) {
@@ -2120,7 +2120,7 @@ const bActionGroup *ChannelBag::channel_group_find(const StringRef name) const
return nullptr;
}
bActionGroup *ChannelBag::channel_group_find(const StringRef name)
bActionGroup *Channelbag::channel_group_find(const StringRef name)
{
/* Intermediate variable needed to disambiguate const/non-const overloads. */
Span<bActionGroup *> groups = this->channel_groups();
@@ -2133,7 +2133,7 @@ bActionGroup *ChannelBag::channel_group_find(const StringRef name)
return nullptr;
}
int ChannelBag::channel_group_containing_index(const int fcurve_array_index)
int Channelbag::channel_group_containing_index(const int fcurve_array_index)
{
int i = 0;
for (const bActionGroup *group : this->channel_groups()) {
@@ -2148,7 +2148,7 @@ int ChannelBag::channel_group_containing_index(const int fcurve_array_index)
return -1;
}
bActionGroup &ChannelBag::channel_group_create(StringRefNull name)
bActionGroup &Channelbag::channel_group_create(StringRefNull name)
{
bActionGroup *new_group = static_cast<bActionGroup *>(
MEM_callocN(sizeof(bActionGroup), __func__));
@@ -2163,7 +2163,7 @@ bActionGroup &ChannelBag::channel_group_create(StringRefNull name)
}
new_group->fcurve_range_start = fcurve_index;
new_group->channel_bag = this;
new_group->channelbag = this;
/* Make it selected. */
new_group->flag = AGRP_SELECTED;
@@ -2193,7 +2193,7 @@ bActionGroup &ChannelBag::channel_group_create(StringRefNull name)
return *new_group;
}
bActionGroup &ChannelBag::channel_group_ensure(StringRefNull name)
bActionGroup &Channelbag::channel_group_ensure(StringRefNull name)
{
bActionGroup *group = this->channel_group_find(name);
if (group) {
@@ -2203,7 +2203,7 @@ bActionGroup &ChannelBag::channel_group_ensure(StringRefNull name)
return this->channel_group_create(name);
}
bool ChannelBag::channel_group_remove(bActionGroup &group)
bool Channelbag::channel_group_remove(bActionGroup &group)
{
const int group_index = this->channel_groups().first_index_try(&group);
if (group_index == -1) {
@@ -2228,7 +2228,7 @@ bool ChannelBag::channel_group_remove(bActionGroup &group)
return true;
}
void ChannelBag::channel_group_move(bActionGroup &group, const int to_group_index)
void Channelbag::channel_group_move(bActionGroup &group, const int to_group_index)
{
BLI_assert(to_group_index >= 0 && to_group_index < this->channel_groups().size());
@@ -2257,7 +2257,7 @@ void ChannelBag::channel_group_move(bActionGroup &group, const int to_group_inde
this->restore_channel_group_invariants();
}
void ChannelBag::channel_group_remove_raw(const int group_index)
void Channelbag::channel_group_remove_raw(const int group_index)
{
BLI_assert(group_index >= 0 && group_index < this->channel_groups().size());
@@ -2265,7 +2265,7 @@ void ChannelBag::channel_group_remove_raw(const int group_index)
shrink_array_and_remove(&this->group_array, &this->group_array_num, group_index);
}
void ChannelBag::restore_channel_group_invariants()
void Channelbag::restore_channel_group_invariants()
{
/* Shift channel groups. */
{
@@ -2295,7 +2295,7 @@ void ChannelBag::restore_channel_group_invariants()
bool ChannelGroup::is_legacy() const
{
return this->channel_bag == nullptr;
return this->channelbag == nullptr;
}
Span<FCurve *> ChannelGroup::fcurves()
@@ -2306,8 +2306,8 @@ Span<FCurve *> ChannelGroup::fcurves()
return {};
}
return this->channel_bag->wrap().fcurves().slice(this->fcurve_range_start,
this->fcurve_range_length);
return this->channelbag->wrap().fcurves().slice(this->fcurve_range_start,
this->fcurve_range_length);
}
Span<const FCurve *> ChannelGroup::fcurves() const
@@ -2318,13 +2318,13 @@ Span<const FCurve *> ChannelGroup::fcurves() const
return {};
}
return this->channel_bag->wrap().fcurves().slice(this->fcurve_range_start,
this->fcurve_range_length);
return this->channelbag->wrap().fcurves().slice(this->fcurve_range_start,
this->fcurve_range_length);
}
/* Utility function implementations. */
const animrig::ChannelBag *channelbag_for_action_slot(const Action &action,
const animrig::Channelbag *channelbag_for_action_slot(const Action &action,
const slot_handle_t slot_handle)
{
assert_baklava_phase_1_invariants(action);
@@ -2339,7 +2339,7 @@ const animrig::ChannelBag *channelbag_for_action_slot(const Action &action,
case animrig::Strip::Type::Keyframe: {
const animrig::StripKeyframeData &strip_data = strip->data<animrig::StripKeyframeData>(
action);
const animrig::ChannelBag *bag = strip_data.channelbag_for_slot(slot_handle);
const animrig::Channelbag *bag = strip_data.channelbag_for_slot(slot_handle);
if (bag) {
return bag;
}
@@ -2351,18 +2351,18 @@ const animrig::ChannelBag *channelbag_for_action_slot(const Action &action,
return nullptr;
}
animrig::ChannelBag *channelbag_for_action_slot(Action &action, const slot_handle_t slot_handle)
animrig::Channelbag *channelbag_for_action_slot(Action &action, const slot_handle_t slot_handle)
{
const animrig::ChannelBag *const_bag = channelbag_for_action_slot(
const animrig::Channelbag *const_bag = channelbag_for_action_slot(
const_cast<const Action &>(action), slot_handle);
return const_cast<animrig::ChannelBag *>(const_bag);
return const_cast<animrig::Channelbag *>(const_bag);
}
Span<FCurve *> fcurves_for_action_slot(Action &action, const slot_handle_t slot_handle)
{
BLI_assert(action.is_action_layered());
assert_baklava_phase_1_invariants(action);
animrig::ChannelBag *bag = channelbag_for_action_slot(action, slot_handle);
animrig::Channelbag *bag = channelbag_for_action_slot(action, slot_handle);
if (!bag) {
return {};
}
@@ -2373,7 +2373,7 @@ Span<const FCurve *> fcurves_for_action_slot(const Action &action, const slot_ha
{
BLI_assert(action.is_action_layered());
assert_baklava_phase_1_invariants(action);
const animrig::ChannelBag *bag = channelbag_for_action_slot(action, slot_handle);
const animrig::Channelbag *bag = channelbag_for_action_slot(action, slot_handle);
if (!bag) {
return {};
}
@@ -2404,7 +2404,7 @@ FCurve *fcurve_find_in_action(bAction *act, FCurveDescriptor fcurve_descriptor)
StripKeyframeData &strip_data = strip->data<StripKeyframeData>(action);
for (ChannelBag *channelbag : strip_data.channelbags()) {
for (Channelbag *channelbag : strip_data.channelbags()) {
FCurve *fcu = channelbag->fcurve_find(fcurve_descriptor);
if (fcu) {
return fcu;
@@ -2433,7 +2433,7 @@ FCurve *fcurve_find_in_action_slot(bAction *act,
&act->curves, fcurve_descriptor.rna_path.c_str(), fcurve_descriptor.array_index);
}
ChannelBag *cbag = channelbag_for_action_slot(action, slot_handle);
Channelbag *cbag = channelbag_for_action_slot(action, slot_handle);
if (!cbag) {
return nullptr;
}
@@ -2661,7 +2661,7 @@ bool action_fcurve_detach(Action &action, FCurve &fcurve_to_detach)
continue;
}
StripKeyframeData &strip_data = strip->data<StripKeyframeData>(action);
for (ChannelBag *bag : strip_data.channelbags()) {
for (Channelbag *bag : strip_data.channelbags()) {
const bool is_detached = bag->fcurve_detach(fcurve_to_detach);
if (is_detached) {
return true;
@@ -2695,7 +2695,7 @@ void action_fcurve_attach(Action &action,
action.layer_keystrip_ensure();
StripKeyframeData &strip_data = action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ChannelBag &cbag = strip_data.channelbag_for_slot_ensure(*slot);
Channelbag &cbag = strip_data.channelbag_for_slot_ensure(*slot);
cbag.fcurve_append(fcurve_to_attach);
if (group_name) {
@@ -2723,7 +2723,7 @@ void action_fcurve_move(Action &action_dst,
action_fcurve_attach(action_dst, action_slot_dst, fcurve, group_name);
}
void channelbag_fcurves_move(ChannelBag &channelbag_dst, ChannelBag &channelbag_src)
void channelbag_fcurves_move(Channelbag &channelbag_dst, Channelbag &channelbag_src)
{
while (!channelbag_src.fcurves().is_empty()) {
FCurve &fcurve = *channelbag_src.fcurve(0);
@@ -2748,7 +2748,7 @@ void channelbag_fcurves_move(ChannelBag &channelbag_dst, ChannelBag &channelbag_
}
}
bool ChannelBag::fcurve_assign_to_channel_group(FCurve &fcurve, bActionGroup &to_group)
bool Channelbag::fcurve_assign_to_channel_group(FCurve &fcurve, bActionGroup &to_group)
{
if (this->channel_groups().first_index_try(&to_group) == -1) {
return false;
@@ -2785,7 +2785,7 @@ bool ChannelBag::fcurve_assign_to_channel_group(FCurve &fcurve, bActionGroup &to
return true;
}
bool ChannelBag::fcurve_ungroup(FCurve &fcurve)
bool Channelbag::fcurve_ungroup(FCurve &fcurve)
{
const int fcurve_index = this->fcurves().first_index_try(&fcurve);
if (fcurve_index == -1) {
@@ -2921,7 +2921,7 @@ Action *convert_to_layered_action(Main &bmain, const Action &legacy_action)
Layer &layer = converted_action.layer_add(legacy_action.id.name);
Strip &strip = layer.strip_add(converted_action, Strip::Type::Keyframe);
BLI_assert(strip.data<StripKeyframeData>(converted_action).channelbag_array_num == 0);
ChannelBag *bag = &strip.data<StripKeyframeData>(converted_action).channelbag_for_slot_add(slot);
Channelbag *bag = &strip.data<StripKeyframeData>(converted_action).channelbag_for_slot_add(slot);
const int fcu_count = BLI_listbase_count(&legacy_action.curves);
bag->fcurve_array = MEM_cnew_array<FCurve *>(fcu_count, "Convert to layered action");
@@ -2985,13 +2985,13 @@ void move_slot(Main &bmain, Slot &source_slot, Action &from_action, Action &to_a
clone_slot(source_slot, target_slot);
slot_identifier_ensure_unique(to_action, target_slot);
ChannelBag *channel_bag = from_strip_data.channelbag_for_slot(source_slot.handle);
BLI_assert(channel_bag != nullptr);
channel_bag->slot_handle = target_slot.handle;
grow_array_and_append<ActionChannelBag *>(
&to_strip_data.channelbag_array, &to_strip_data.channelbag_array_num, channel_bag);
int index = from_strip_data.find_channelbag_index(*channel_bag);
shrink_array_and_remove<ActionChannelBag *>(
Channelbag *channelbag = from_strip_data.channelbag_for_slot(source_slot.handle);
BLI_assert(channelbag != nullptr);
channelbag->slot_handle = target_slot.handle;
grow_array_and_append<ActionChannelbag *>(
&to_strip_data.channelbag_array, &to_strip_data.channelbag_array_num, channelbag);
int index = from_strip_data.find_channelbag_index(*channelbag);
shrink_array_and_remove<ActionChannelbag *>(
&from_strip_data.channelbag_array, &from_strip_data.channelbag_array_num, index);
/* Reassign all users of `source_slot` to the action `to_action` and the slot `target_slot`. */

View File

@@ -32,7 +32,7 @@ void foreach_fcurve_in_action(Action &action, FunctionRef<void(FCurve &fcurve)>
if (strip->type() != Strip::Type::Keyframe) {
continue;
}
for (ChannelBag *bag : strip->data<StripKeyframeData>(action).channelbags()) {
for (Channelbag *bag : strip->data<StripKeyframeData>(action).channelbags()) {
for (FCurve *fcu : bag->fcurves()) {
callback(*fcu);
}
@@ -56,7 +56,7 @@ void foreach_fcurve_in_action_slot(Action &action,
if (strip->type() != Strip::Type::Keyframe) {
continue;
}
for (ChannelBag *bag : strip->data<StripKeyframeData>(action).channelbags()) {
for (Channelbag *bag : strip->data<StripKeyframeData>(action).channelbags()) {
if (bag->slot_handle != handle) {
continue;
}

View File

@@ -24,7 +24,7 @@ static Strip *first_keyframe_strip(Action &action)
return nullptr;
}
ChannelBag *channelbag_get(Action &action)
Channelbag *channelbag_get(Action &action)
{
if (action.slots().is_empty()) {
return nullptr;
@@ -38,7 +38,7 @@ ChannelBag *channelbag_get(Action &action)
return keystrip->data<StripKeyframeData>(action).channelbag_for_slot(*action.slot(0));
}
ChannelBag &channelbag_ensure(Action &action)
Channelbag &channelbag_ensure(Action &action)
{
assert_baklava_phase_1_invariants(action);
@@ -55,7 +55,7 @@ ChannelBag &channelbag_ensure(Action &action)
action.layer_keystrip_ensure();
Strip &keystrip = *action.layer(0)->strip(0);
/* Ensure a ChannelBag. */
/* Ensure a Channelbag. */
return keystrip.data<StripKeyframeData>(action).channelbag_for_slot_ensure(*slot);
}
@@ -65,7 +65,7 @@ template<typename ActionType,
typename LayerType,
typename StripType,
typename StripKeyframeDataType,
typename ChannelBagType>
typename ChannelbagType>
static Vector<FCurveType *> fcurves_all_templated(ActionType &action)
{
/* Legacy Action. */
@@ -86,7 +86,7 @@ static Vector<FCurveType *> fcurves_all_templated(ActionType &action)
switch (strip->type()) {
case Strip::Type::Keyframe: {
StripKeyframeDataType &strip_data = strip->template data<StripKeyframeData>(action);
for (ChannelBagType *bag : strip_data.channelbags()) {
for (ChannelbagType *bag : strip_data.channelbags()) {
for (FCurveType *fcurve : bag->fcurves()) {
all_fcurves.append(fcurve);
}
@@ -103,7 +103,7 @@ Vector<FCurve *> fcurves_all(bAction *action)
if (!action) {
return {};
}
return fcurves_all_templated<Action, FCurve, Layer, Strip, StripKeyframeData, ChannelBag>(
return fcurves_all_templated<Action, FCurve, Layer, Strip, StripKeyframeData, Channelbag>(
action->wrap());
}
@@ -117,7 +117,7 @@ Vector<const FCurve *> fcurves_all(const bAction *action)
const Layer,
const Strip,
const StripKeyframeData,
const ChannelBag>(action->wrap());
const Channelbag>(action->wrap());
}
Vector<FCurve *> fcurves_first_slot(bAction *action)
@@ -143,7 +143,7 @@ template<typename ActionType,
typename LayerType,
typename StripType,
typename StripKeyframeDataType,
typename ChannelBagType>
typename ChannelbagType>
static Vector<FCurveType *> fcurves_for_action_slot_templated(ActionType &action,
const slot_handle_t slot_handle)
{
@@ -167,7 +167,7 @@ Vector<FCurve *> fcurves_for_action_slot(bAction *action, const slot_handle_t sl
Layer,
Strip,
StripKeyframeData,
ChannelBag>(action->wrap(), slot_handle);
Channelbag>(action->wrap(), slot_handle);
}
Vector<const FCurve *> fcurves_for_action_slot(const bAction *action,
const slot_handle_t slot_handle)
@@ -180,7 +180,7 @@ Vector<const FCurve *> fcurves_for_action_slot(const bAction *action,
const Layer,
const Strip,
const StripKeyframeData,
const ChannelBag>(action->wrap(), slot_handle);
const Channelbag>(action->wrap(), slot_handle);
}
Vector<FCurve *> fcurves_for_assigned_action(AnimData *adt)
@@ -238,7 +238,7 @@ Vector<bActionGroup *> channel_groups_all(bAction *action)
switch (strip->type()) {
case Strip::Type::Keyframe: {
StripKeyframeData &strip_data = strip->template data<StripKeyframeData>(action_wrap);
for (ChannelBag *bag : strip_data.channelbags()) {
for (Channelbag *bag : strip_data.channelbags()) {
all_groups.extend(bag->channel_groups());
}
}
@@ -262,7 +262,7 @@ Vector<bActionGroup *> channel_groups_for_assigned_slot(AnimData *adt)
}
/* Layered Action. */
ChannelBag *bag = channelbag_for_action_slot(action, adt->slot_handle);
Channelbag *bag = channelbag_for_action_slot(action, adt->slot_handle);
if (!bag) {
return {};
}
@@ -311,7 +311,7 @@ bool action_fcurves_remove(bAction &action,
}
/* Layered Action. */
ChannelBag *bag = channelbag_for_action_slot(action.wrap(), slot_handle);
Channelbag *bag = channelbag_for_action_slot(action.wrap(), slot_handle);
if (!bag) {
return false;
}

View File

@@ -177,8 +177,8 @@ TEST_F(ActionLegacyTest, action_fcurves_remove_layered)
action.layer_keystrip_ensure();
StripKeyframeData *strip_data = action.strip_keyframe_data()[0];
ChannelBag &bag_1 = strip_data->channelbag_for_slot_ensure(slot_1);
ChannelBag &bag_2 = strip_data->channelbag_for_slot_ensure(slot_2);
Channelbag &bag_1 = strip_data->channelbag_for_slot_ensure(slot_1);
Channelbag &bag_2 = strip_data->channelbag_for_slot_ensure(slot_2);
/* Add some F-Curves to each channelbag. */
FCurve &fcurve_loc_x = bag_1.fcurve_ensure(nullptr, {"location", 0});

View File

@@ -338,16 +338,16 @@ TEST_F(ActionLayersTest, slot_remove)
EXPECT_FALSE(action->slot_remove(slot));
}
{ /* Removing a slot should remove its ChannelBag. */
{ /* Removing a slot should remove its Channelbag. */
Slot &slot = action->slot_add();
const slot_handle_t slot_handle = slot.handle;
EXPECT_EQ(2, slot.handle);
EXPECT_EQ(2, action->last_slot_handle);
/* Create an F-Curve in a ChannelBag for the slot. */
/* Create an F-Curve in a Channelbag for the slot. */
action->layer_keystrip_ensure();
StripKeyframeData &strip_data = action->layer(0)->strip(0)->data<StripKeyframeData>(*action);
ChannelBag &channelbag = strip_data.channelbag_for_slot_ensure(slot);
Channelbag &channelbag = strip_data.channelbag_for_slot_ensure(slot);
channelbag.fcurve_create_unique(bmain, {"location", 1});
/* Remove the slot. */
@@ -357,7 +357,7 @@ TEST_F(ActionLayersTest, slot_remove)
EXPECT_EQ(0, action->slot_array_num);
/* Check that its channelbag is gone. */
ChannelBag *found_cbag = strip_data.channelbag_for_slot(slot_handle);
Channelbag *found_cbag = strip_data.channelbag_for_slot(slot_handle);
EXPECT_EQ(found_cbag, nullptr);
}
@@ -755,7 +755,7 @@ TEST_F(ActionLayersTest, KeyframeStrip__keyframe_insert)
/* Check the strip was created correctly, with the channels for the slot. */
ASSERT_EQ(1, strip_data.channelbags().size());
ChannelBag *channels = strip_data.channelbag(0);
Channelbag *channels = strip_data.channelbag(0);
EXPECT_EQ(slot.handle, channels->slot_handle);
/* Insert a second key, should insert into the same FCurve as before. */
@@ -901,7 +901,7 @@ TEST_F(ActionLayersTest, conversion_to_layered)
EXPECT_STREQ(converted->id.name, "ACACÄnimåtië_layered");
Strip *strip = converted->layer(0)->strip(0);
StripKeyframeData &strip_data = strip->data<StripKeyframeData>(*converted);
ChannelBag *bag = strip_data.channelbag(0);
Channelbag *bag = strip_data.channelbag(0);
ASSERT_EQ(bag->fcurve_array_num, 2);
ASSERT_EQ(bag->fcurve_array[0]->totvert, 2);
@@ -944,7 +944,7 @@ TEST_F(ActionLayersTest, conversion_to_layered_action_groups)
Action *converted = convert_to_layered_action(*bmain, *action);
Strip *strip = converted->layer(0)->strip(0);
StripKeyframeData &strip_data = strip->data<StripKeyframeData>(*converted);
ChannelBag *bag = strip_data.channelbag(0);
Channelbag *bag = strip_data.channelbag(0);
ASSERT_EQ(BLI_listbase_count(&converted->groups), 0);
ASSERT_EQ(bag->channel_groups().size(), 4);
@@ -1015,8 +1015,8 @@ TEST_F(ActionLayersTest, action_move_slot)
ASSERT_EQ(strip_data_1.channelbag_array_num, 1);
ASSERT_EQ(strip_data_2.channelbag_array_num, 1);
ChannelBag *bag_1 = strip_data_1.channelbag(0);
ChannelBag *bag_2 = strip_data_2.channelbag(0);
Channelbag *bag_1 = strip_data_1.channelbag(0);
Channelbag *bag_2 = strip_data_2.channelbag(0);
ASSERT_EQ(bag_1->fcurve_array_num, 2);
ASSERT_EQ(bag_2->fcurve_array_num, 2);
@@ -1066,7 +1066,7 @@ static void add_fcurve_to_action(Action &action, FCurve &fcu)
Slot &slot = action.slot_array_num > 0 ? *action.slot(0) : action.slot_add();
action.layer_keystrip_ensure();
StripKeyframeData &strip_data = action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ChannelBag &cbag = strip_data.channelbag_for_slot_ensure(slot);
Channelbag &cbag = strip_data.channelbag_for_slot_ensure(slot);
cbag.fcurve_append(fcu);
}
@@ -1164,9 +1164,9 @@ TEST_F(ActionQueryTest, BKE_action_frame_range_calc)
/*-----------------------------------------------------------*/
class ChannelBagTest : public testing::Test {
class ChannelbagTest : public testing::Test {
public:
ChannelBag *channel_bag;
Channelbag *channelbag;
static void SetUpTestSuite() {}
@@ -1174,36 +1174,36 @@ class ChannelBagTest : public testing::Test {
void SetUp() override
{
channel_bag = new ChannelBag();
channelbag = new Channelbag();
}
void TearDown() override
{
delete channel_bag;
delete channelbag;
}
};
TEST_F(ChannelBagTest, fcurve_move)
TEST_F(ChannelbagTest, fcurve_move)
{
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channel_bag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group1"});
FCurve &fcu4 = channel_bag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channelbag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group1"});
FCurve &fcu4 = channelbag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
ASSERT_EQ(5, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
bActionGroup &group0 = *channel_bag->channel_group(0);
bActionGroup &group1 = *channel_bag->channel_group(1);
bActionGroup &group0 = *channelbag->channel_group(0);
bActionGroup &group1 = *channelbag->channel_group(1);
/* Moving an fcurve to where it already is should be fine. */
channel_bag->fcurve_move(fcu0, 0);
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu1, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu3, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
channelbag->fcurve_move(fcu0, 0);
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu1, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu3, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group1, fcu2.grp);
@@ -1211,16 +1211,16 @@ TEST_F(ChannelBagTest, fcurve_move)
EXPECT_EQ(nullptr, fcu4.grp);
/* Move to first. */
channel_bag->fcurve_move(fcu4, 0);
channelbag->fcurve_move(fcu4, 0);
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(2, group0.fcurve_range_length);
EXPECT_EQ(2, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(&fcu4, channel_bag->fcurve(0));
EXPECT_EQ(&fcu0, channel_bag->fcurve(1));
EXPECT_EQ(&fcu1, channel_bag->fcurve(2));
EXPECT_EQ(&fcu2, channel_bag->fcurve(3));
EXPECT_EQ(&fcu3, channel_bag->fcurve(4));
EXPECT_EQ(&fcu4, channelbag->fcurve(0));
EXPECT_EQ(&fcu0, channelbag->fcurve(1));
EXPECT_EQ(&fcu1, channelbag->fcurve(2));
EXPECT_EQ(&fcu2, channelbag->fcurve(3));
EXPECT_EQ(&fcu3, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu4.grp);
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group1, fcu1.grp);
@@ -1228,16 +1228,16 @@ TEST_F(ChannelBagTest, fcurve_move)
EXPECT_EQ(nullptr, fcu3.grp);
/* Move to last. */
channel_bag->fcurve_move(fcu1, 4);
channelbag->fcurve_move(fcu1, 4);
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(2, group0.fcurve_range_length);
EXPECT_EQ(2, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(&fcu4, channel_bag->fcurve(0));
EXPECT_EQ(&fcu0, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu3, channel_bag->fcurve(3));
EXPECT_EQ(&fcu1, channel_bag->fcurve(4));
EXPECT_EQ(&fcu4, channelbag->fcurve(0));
EXPECT_EQ(&fcu0, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu3, channelbag->fcurve(3));
EXPECT_EQ(&fcu1, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu4.grp);
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group1, fcu2.grp);
@@ -1245,16 +1245,16 @@ TEST_F(ChannelBagTest, fcurve_move)
EXPECT_EQ(nullptr, fcu1.grp);
/* Move to middle. */
channel_bag->fcurve_move(fcu4, 2);
channelbag->fcurve_move(fcu4, 2);
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(2, group0.fcurve_range_length);
EXPECT_EQ(2, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu4, channel_bag->fcurve(2));
EXPECT_EQ(&fcu3, channel_bag->fcurve(3));
EXPECT_EQ(&fcu1, channel_bag->fcurve(4));
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu4, channelbag->fcurve(2));
EXPECT_EQ(&fcu3, channelbag->fcurve(3));
EXPECT_EQ(&fcu1, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group0, fcu2.grp);
EXPECT_EQ(&group1, fcu4.grp);
@@ -1262,70 +1262,70 @@ TEST_F(ChannelBagTest, fcurve_move)
EXPECT_EQ(nullptr, fcu1.grp);
}
TEST_F(ChannelBagTest, channel_group_create)
TEST_F(ChannelbagTest, channel_group_create)
{
ASSERT_TRUE(channel_bag->channel_groups().is_empty());
ASSERT_TRUE(channelbag->channel_groups().is_empty());
bActionGroup &group0 = channel_bag->channel_group_create("Foo");
ASSERT_EQ(channel_bag->channel_groups().size(), 1);
bActionGroup &group0 = channelbag->channel_group_create("Foo");
ASSERT_EQ(channelbag->channel_groups().size(), 1);
EXPECT_EQ(StringRef{group0.name}, StringRef{"Foo"});
EXPECT_EQ(group0.fcurve_range_start, 0);
EXPECT_EQ(group0.fcurve_range_length, 0);
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group0, channelbag->channel_group(0));
/* Set for testing purposes. Does not reflect actual fcurves in this test. */
group0.fcurve_range_length = 2;
bActionGroup &group1 = channel_bag->channel_group_create("Bar");
ASSERT_EQ(channel_bag->channel_groups().size(), 2);
bActionGroup &group1 = channelbag->channel_group_create("Bar");
ASSERT_EQ(channelbag->channel_groups().size(), 2);
EXPECT_EQ(StringRef{group1.name}, StringRef{"Bar"});
EXPECT_EQ(group1.fcurve_range_start, 2);
EXPECT_EQ(group1.fcurve_range_length, 0);
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
/* Set for testing purposes. Does not reflect actual fcurves in this test. */
group1.fcurve_range_length = 1;
bActionGroup &group2 = channel_bag->channel_group_create("Yar");
ASSERT_EQ(channel_bag->channel_groups().size(), 3);
bActionGroup &group2 = channelbag->channel_group_create("Yar");
ASSERT_EQ(channelbag->channel_groups().size(), 3);
EXPECT_EQ(StringRef{group2.name}, StringRef{"Yar"});
EXPECT_EQ(group2.fcurve_range_start, 3);
EXPECT_EQ(group2.fcurve_range_length, 0);
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
EXPECT_EQ(&group2, channel_bag->channel_group(2));
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(&group2, channelbag->channel_group(2));
}
TEST_F(ChannelBagTest, channel_group_remove)
TEST_F(ChannelbagTest, channel_group_remove)
{
bActionGroup &group0 = channel_bag->channel_group_create("Group0");
bActionGroup &group1 = channel_bag->channel_group_create("Group1");
bActionGroup &group2 = channel_bag->channel_group_create("Group2");
bActionGroup &group0 = channelbag->channel_group_create("Group0");
bActionGroup &group1 = channelbag->channel_group_create("Group1");
bActionGroup &group2 = channelbag->channel_group_create("Group2");
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "Group0"});
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "Group0"});
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "Group2"});
FCurve &fcu3 = channel_bag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "Group2"});
FCurve &fcu4 = channel_bag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "Group0"});
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "Group0"});
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "Group2"});
FCurve &fcu3 = channelbag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "Group2"});
FCurve &fcu4 = channelbag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
ASSERT_EQ(3, channel_bag->channel_groups().size());
ASSERT_EQ(5, channel_bag->fcurves().size());
ASSERT_EQ(3, channelbag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
/* Attempt to remove a group that's not in the channel bag. Shouldn't do
* anything. */
bActionGroup bogus;
EXPECT_EQ(false, channel_bag->channel_group_remove(bogus));
ASSERT_EQ(3, channel_bag->channel_groups().size());
ASSERT_EQ(5, channel_bag->fcurves().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
EXPECT_EQ(&group2, channel_bag->channel_group(2));
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu1, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu3, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(false, channelbag->channel_group_remove(bogus));
ASSERT_EQ(3, channelbag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(&group2, channelbag->channel_group(2));
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu1, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu3, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group2, fcu2.grp);
@@ -1333,16 +1333,16 @@ TEST_F(ChannelBagTest, channel_group_remove)
EXPECT_EQ(nullptr, fcu4.grp);
/* Removing an empty group shouldn't affect the fcurves at all. */
EXPECT_EQ(true, channel_bag->channel_group_remove(group1));
ASSERT_EQ(2, channel_bag->channel_groups().size());
ASSERT_EQ(5, channel_bag->fcurves().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group2, channel_bag->channel_group(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu1, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu3, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(true, channelbag->channel_group_remove(group1));
ASSERT_EQ(2, channelbag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group2, channelbag->channel_group(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu1, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu3, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group2, fcu2.grp);
@@ -1351,15 +1351,15 @@ TEST_F(ChannelBagTest, channel_group_remove)
/* Removing a group that's not at the end of the group array should move its
* fcurves to be just after the grouped fcurves. */
EXPECT_EQ(true, channel_bag->channel_group_remove(group0));
ASSERT_EQ(1, channel_bag->channel_groups().size());
ASSERT_EQ(5, channel_bag->fcurves().size());
EXPECT_EQ(&group2, channel_bag->channel_group(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(0));
EXPECT_EQ(&fcu3, channel_bag->fcurve(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(2));
EXPECT_EQ(&fcu1, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(true, channelbag->channel_group_remove(group0));
ASSERT_EQ(1, channelbag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
EXPECT_EQ(&group2, channelbag->channel_group(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(0));
EXPECT_EQ(&fcu3, channelbag->fcurve(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(2));
EXPECT_EQ(&fcu1, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_EQ(nullptr, fcu1.grp);
EXPECT_EQ(&group2, fcu2.grp);
@@ -1368,14 +1368,14 @@ TEST_F(ChannelBagTest, channel_group_remove)
/* Removing a group at the end of the group array shouldn't move its
* fcurves. */
EXPECT_EQ(true, channel_bag->channel_group_remove(group2));
ASSERT_EQ(0, channel_bag->channel_groups().size());
ASSERT_EQ(5, channel_bag->fcurves().size());
EXPECT_EQ(&fcu2, channel_bag->fcurve(0));
EXPECT_EQ(&fcu3, channel_bag->fcurve(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(2));
EXPECT_EQ(&fcu1, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(true, channelbag->channel_group_remove(group2));
ASSERT_EQ(0, channelbag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
EXPECT_EQ(&fcu2, channelbag->fcurve(0));
EXPECT_EQ(&fcu3, channelbag->fcurve(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(2));
EXPECT_EQ(&fcu1, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_EQ(nullptr, fcu1.grp);
EXPECT_EQ(nullptr, fcu2.grp);
@@ -1383,63 +1383,63 @@ TEST_F(ChannelBagTest, channel_group_remove)
EXPECT_EQ(nullptr, fcu4.grp);
}
TEST_F(ChannelBagTest, channel_group_find)
TEST_F(ChannelbagTest, channel_group_find)
{
bActionGroup &group0a = channel_bag->channel_group_create("Foo");
bActionGroup &group1a = channel_bag->channel_group_create("Bar");
bActionGroup &group2a = channel_bag->channel_group_create("Yar");
bActionGroup &group0a = channelbag->channel_group_create("Foo");
bActionGroup &group1a = channelbag->channel_group_create("Bar");
bActionGroup &group2a = channelbag->channel_group_create("Yar");
bActionGroup *group0b = channel_bag->channel_group_find("Foo");
bActionGroup *group1b = channel_bag->channel_group_find("Bar");
bActionGroup *group2b = channel_bag->channel_group_find("Yar");
bActionGroup *group0b = channelbag->channel_group_find("Foo");
bActionGroup *group1b = channelbag->channel_group_find("Bar");
bActionGroup *group2b = channelbag->channel_group_find("Yar");
EXPECT_EQ(&group0a, group0b);
EXPECT_EQ(&group1a, group1b);
EXPECT_EQ(&group2a, group2b);
EXPECT_EQ(nullptr, channel_bag->channel_group_find("Wat"));
EXPECT_EQ(nullptr, channelbag->channel_group_find("Wat"));
}
TEST_F(ChannelBagTest, channel_group_ensure)
TEST_F(ChannelbagTest, channel_group_ensure)
{
bActionGroup &group0 = channel_bag->channel_group_create("Foo");
bActionGroup &group1 = channel_bag->channel_group_create("Bar");
EXPECT_EQ(channel_bag->channel_groups().size(), 2);
bActionGroup &group0 = channelbag->channel_group_create("Foo");
bActionGroup &group1 = channelbag->channel_group_create("Bar");
EXPECT_EQ(channelbag->channel_groups().size(), 2);
EXPECT_EQ(&group0, &channel_bag->channel_group_ensure("Foo"));
EXPECT_EQ(channel_bag->channel_groups().size(), 2);
EXPECT_EQ(&group0, &channelbag->channel_group_ensure("Foo"));
EXPECT_EQ(channelbag->channel_groups().size(), 2);
EXPECT_EQ(&group1, &channel_bag->channel_group_ensure("Bar"));
EXPECT_EQ(channel_bag->channel_groups().size(), 2);
EXPECT_EQ(&group1, &channelbag->channel_group_ensure("Bar"));
EXPECT_EQ(channelbag->channel_groups().size(), 2);
bActionGroup &group2 = channel_bag->channel_group_ensure("Yar");
ASSERT_EQ(channel_bag->channel_groups().size(), 3);
EXPECT_EQ(&group2, channel_bag->channel_group(2));
bActionGroup &group2 = channelbag->channel_group_ensure("Yar");
ASSERT_EQ(channelbag->channel_groups().size(), 3);
EXPECT_EQ(&group2, channelbag->channel_group(2));
}
TEST_F(ChannelBagTest, channel_group_fcurve_creation)
TEST_F(ChannelbagTest, channel_group_fcurve_creation)
{
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, std::nullopt});
EXPECT_EQ(1, channel_bag->fcurves().size());
EXPECT_TRUE(channel_bag->channel_groups().is_empty());
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, std::nullopt});
EXPECT_EQ(1, channelbag->fcurves().size());
EXPECT_TRUE(channelbag->channel_groups().is_empty());
/* If an fcurve already exists, then ensuring it with a channel group in the
* fcurve descriptor should NOT add it that group, nor should the group be
* created if it doesn't already exist. */
channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
EXPECT_EQ(1, channel_bag->fcurves().size());
channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
EXPECT_EQ(1, channelbag->fcurves().size());
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_TRUE(channel_bag->channel_groups().is_empty());
EXPECT_TRUE(channelbag->channel_groups().is_empty());
/* Creating a new fcurve with a channel group in the fcurve descriptor should
* create the group and put the fcurve in it. This also implies that the
* fcurve will be added before any non-grouped fcurves in the array. */
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
ASSERT_EQ(2, channel_bag->fcurves().size());
ASSERT_EQ(1, channel_bag->channel_groups().size());
bActionGroup &group0 = *channel_bag->channel_group(0);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu0, channel_bag->fcurve(1));
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
ASSERT_EQ(2, channelbag->fcurves().size());
ASSERT_EQ(1, channelbag->channel_groups().size());
bActionGroup &group0 = *channelbag->channel_group(0);
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu0, channelbag->fcurve(1));
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_EQ(0, group0.fcurve_range_start);
@@ -1449,14 +1449,14 @@ TEST_F(ChannelBagTest, channel_group_fcurve_creation)
* should create the group and put the fcurve in it. This also implies that
* the fcurve will be added before non-grouped fcurves, but after other
* grouped ones. */
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
ASSERT_EQ(3, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
bActionGroup &group1 = *channel_bag->channel_group(1);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(2));
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
ASSERT_EQ(3, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
bActionGroup &group1 = *channelbag->channel_group(1);
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(2));
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(nullptr, fcu0.grp);
@@ -1467,15 +1467,15 @@ TEST_F(ChannelBagTest, channel_group_fcurve_creation)
/* Creating a new fcurve with the first channel group again should put it at
* the end of that group. */
FCurve &fcu3 = channel_bag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group0"});
ASSERT_EQ(4, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu3, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu0, channel_bag->fcurve(3));
FCurve &fcu3 = channelbag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group0"});
ASSERT_EQ(4, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu3, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu0, channelbag->fcurve(3));
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group0, fcu3.grp);
EXPECT_EQ(&group1, fcu2.grp);
@@ -1487,16 +1487,16 @@ TEST_F(ChannelBagTest, channel_group_fcurve_creation)
/* Finally, creating a new fcurve with the second channel group again should
* also put it at the end of that group. */
FCurve &fcu4 = channel_bag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, "group1"});
ASSERT_EQ(5, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu3, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu4, channel_bag->fcurve(3));
EXPECT_EQ(&fcu0, channel_bag->fcurve(4));
FCurve &fcu4 = channelbag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, "group1"});
ASSERT_EQ(5, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu3, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu4, channelbag->fcurve(3));
EXPECT_EQ(&fcu0, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group0, fcu3.grp);
EXPECT_EQ(&group1, fcu2.grp);
@@ -1508,19 +1508,19 @@ TEST_F(ChannelBagTest, channel_group_fcurve_creation)
EXPECT_EQ(2, group1.fcurve_range_length);
}
TEST_F(ChannelBagTest, channel_group_fcurve_removal)
TEST_F(ChannelbagTest, channel_group_fcurve_removal)
{
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channel_bag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group1"});
FCurve &fcu4 = channel_bag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channelbag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group1"});
FCurve &fcu4 = channelbag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
ASSERT_EQ(5, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
bActionGroup &group0 = *channel_bag->channel_group(0);
bActionGroup &group1 = *channel_bag->channel_group(1);
bActionGroup &group0 = *channelbag->channel_group(0);
bActionGroup &group1 = *channelbag->channel_group(1);
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(2, group0.fcurve_range_length);
@@ -1532,11 +1532,11 @@ TEST_F(ChannelBagTest, channel_group_fcurve_removal)
EXPECT_EQ(&group1, fcu3.grp);
EXPECT_EQ(nullptr, fcu4.grp);
channel_bag->fcurve_remove(fcu3);
ASSERT_EQ(4, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
channelbag->fcurve_remove(fcu3);
ASSERT_EQ(4, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(2, group0.fcurve_range_length);
EXPECT_EQ(2, group1.fcurve_range_start);
@@ -1546,11 +1546,11 @@ TEST_F(ChannelBagTest, channel_group_fcurve_removal)
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(nullptr, fcu4.grp);
channel_bag->fcurve_remove(fcu0);
ASSERT_EQ(3, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
channelbag->fcurve_remove(fcu0);
ASSERT_EQ(3, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
@@ -1559,100 +1559,100 @@ TEST_F(ChannelBagTest, channel_group_fcurve_removal)
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(nullptr, fcu4.grp);
channel_bag->fcurve_remove(fcu1);
ASSERT_EQ(2, channel_bag->fcurves().size());
ASSERT_EQ(1, channel_bag->channel_groups().size());
EXPECT_EQ(&group1, channel_bag->channel_group(0));
channelbag->fcurve_remove(fcu1);
ASSERT_EQ(2, channelbag->fcurves().size());
ASSERT_EQ(1, channelbag->channel_groups().size());
EXPECT_EQ(&group1, channelbag->channel_group(0));
EXPECT_EQ(0, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(nullptr, fcu4.grp);
channel_bag->fcurve_remove(fcu4);
ASSERT_EQ(1, channel_bag->fcurves().size());
ASSERT_EQ(1, channel_bag->channel_groups().size());
EXPECT_EQ(&group1, channel_bag->channel_group(0));
channelbag->fcurve_remove(fcu4);
ASSERT_EQ(1, channelbag->fcurves().size());
ASSERT_EQ(1, channelbag->channel_groups().size());
EXPECT_EQ(&group1, channelbag->channel_group(0));
EXPECT_EQ(0, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
EXPECT_EQ(&group1, fcu2.grp);
channel_bag->fcurve_remove(fcu2);
ASSERT_EQ(0, channel_bag->fcurves().size());
ASSERT_EQ(0, channel_bag->channel_groups().size());
channelbag->fcurve_remove(fcu2);
ASSERT_EQ(0, channelbag->fcurves().size());
ASSERT_EQ(0, channelbag->channel_groups().size());
}
TEST_F(ChannelBagTest, channel_group_move)
TEST_F(ChannelbagTest, channel_group_move)
{
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group1"});
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channel_bag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group2"});
FCurve &fcu4 = channel_bag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group1"});
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channelbag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group2"});
FCurve &fcu4 = channelbag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
ASSERT_EQ(5, channel_bag->fcurves().size());
ASSERT_EQ(3, channel_bag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
ASSERT_EQ(3, channelbag->channel_groups().size());
bActionGroup &group0 = *channel_bag->channel_group(0);
bActionGroup &group1 = *channel_bag->channel_group(1);
bActionGroup &group2 = *channel_bag->channel_group(2);
bActionGroup &group0 = *channelbag->channel_group(0);
bActionGroup &group1 = *channelbag->channel_group(1);
bActionGroup &group2 = *channelbag->channel_group(2);
channel_bag->channel_group_move(group0, 2);
EXPECT_EQ(&group1, channel_bag->channel_group(0));
EXPECT_EQ(&group2, channel_bag->channel_group(1));
EXPECT_EQ(&group0, channel_bag->channel_group(2));
channelbag->channel_group_move(group0, 2);
EXPECT_EQ(&group1, channelbag->channel_group(0));
EXPECT_EQ(&group2, channelbag->channel_group(1));
EXPECT_EQ(&group0, channelbag->channel_group(2));
EXPECT_EQ(0, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(2, group2.fcurve_range_start);
EXPECT_EQ(1, group2.fcurve_range_length);
EXPECT_EQ(3, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu3, channel_bag->fcurve(2));
EXPECT_EQ(&fcu0, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu3, channelbag->fcurve(2));
EXPECT_EQ(&fcu0, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(&group1, fcu1.grp);
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(&group2, fcu3.grp);
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(nullptr, fcu4.grp);
channel_bag->channel_group_move(group1, 1);
EXPECT_EQ(&group2, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
EXPECT_EQ(&group0, channel_bag->channel_group(2));
channelbag->channel_group_move(group1, 1);
EXPECT_EQ(&group2, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(&group0, channelbag->channel_group(2));
EXPECT_EQ(0, group2.fcurve_range_start);
EXPECT_EQ(1, group2.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(3, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(&fcu3, channel_bag->fcurve(0));
EXPECT_EQ(&fcu1, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
EXPECT_EQ(&fcu0, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(&fcu3, channelbag->fcurve(0));
EXPECT_EQ(&fcu1, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(&fcu0, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(&group2, fcu3.grp);
EXPECT_EQ(&group1, fcu1.grp);
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(nullptr, fcu4.grp);
channel_bag->channel_group_move(group0, 0);
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group2, channel_bag->channel_group(1));
EXPECT_EQ(&group1, channel_bag->channel_group(2));
channelbag->channel_group_move(group0, 0);
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group2, channelbag->channel_group(1));
EXPECT_EQ(&group1, channelbag->channel_group(2));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group2.fcurve_range_start);
EXPECT_EQ(1, group2.fcurve_range_length);
EXPECT_EQ(2, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu3, channel_bag->fcurve(1));
EXPECT_EQ(&fcu1, channel_bag->fcurve(2));
EXPECT_EQ(&fcu2, channel_bag->fcurve(3));
EXPECT_EQ(&fcu4, channel_bag->fcurve(4));
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu3, channelbag->fcurve(1));
EXPECT_EQ(&fcu1, channelbag->fcurve(2));
EXPECT_EQ(&fcu2, channelbag->fcurve(3));
EXPECT_EQ(&fcu4, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu0.grp);
EXPECT_EQ(&group2, fcu3.grp);
EXPECT_EQ(&group1, fcu1.grp);
@@ -1660,150 +1660,150 @@ TEST_F(ChannelBagTest, channel_group_move)
EXPECT_EQ(nullptr, fcu4.grp);
}
TEST_F(ChannelBagTest, channel_group_move_fcurve_into)
TEST_F(ChannelbagTest, channel_group_move_fcurve_into)
{
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, std::nullopt});
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, std::nullopt});
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, std::nullopt});
bActionGroup &group0 = channel_bag->channel_group_create("group0");
bActionGroup &group1 = channel_bag->channel_group_create("group1");
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, std::nullopt});
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, std::nullopt});
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, std::nullopt});
bActionGroup &group0 = channelbag->channel_group_create("group0");
bActionGroup &group1 = channelbag->channel_group_create("group1");
ASSERT_EQ(3, channel_bag->fcurves().size());
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu1, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
ASSERT_EQ(2, channel_bag->channel_groups().size());
EXPECT_EQ(&group0, channel_bag->channel_group(0));
EXPECT_EQ(&group1, channel_bag->channel_group(1));
ASSERT_EQ(3, channelbag->fcurves().size());
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu1, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
ASSERT_EQ(2, channelbag->channel_groups().size());
EXPECT_EQ(&group0, channelbag->channel_group(0));
EXPECT_EQ(&group1, channelbag->channel_group(1));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(0, group0.fcurve_range_length);
EXPECT_EQ(0, group1.fcurve_range_start);
EXPECT_EQ(0, group1.fcurve_range_length);
channel_bag->fcurve_assign_to_channel_group(fcu2, group1);
EXPECT_EQ(&fcu2, channel_bag->fcurve(0));
EXPECT_EQ(&fcu0, channel_bag->fcurve(1));
EXPECT_EQ(&fcu1, channel_bag->fcurve(2));
channelbag->fcurve_assign_to_channel_group(fcu2, group1);
EXPECT_EQ(&fcu2, channelbag->fcurve(0));
EXPECT_EQ(&fcu0, channelbag->fcurve(1));
EXPECT_EQ(&fcu1, channelbag->fcurve(2));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(0, group0.fcurve_range_length);
EXPECT_EQ(0, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
channel_bag->fcurve_assign_to_channel_group(fcu1, group0);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(2));
channelbag->fcurve_assign_to_channel_group(fcu1, group0);
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(2));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
channel_bag->fcurve_assign_to_channel_group(fcu0, group1);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(2));
channelbag->fcurve_assign_to_channel_group(fcu0, group1);
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(2));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
channel_bag->fcurve_assign_to_channel_group(fcu0, group0);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu0, channel_bag->fcurve(1));
EXPECT_EQ(&fcu2, channel_bag->fcurve(2));
channelbag->fcurve_assign_to_channel_group(fcu0, group0);
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu0, channelbag->fcurve(1));
EXPECT_EQ(&fcu2, channelbag->fcurve(2));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(2, group0.fcurve_range_length);
EXPECT_EQ(2, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
channel_bag->fcurve_assign_to_channel_group(fcu1, group1);
EXPECT_EQ(&fcu0, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu1, channel_bag->fcurve(2));
channelbag->fcurve_assign_to_channel_group(fcu1, group1);
EXPECT_EQ(&fcu0, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu1, channelbag->fcurve(2));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
}
TEST_F(ChannelBagTest, channel_group_fcurve_ungroup)
TEST_F(ChannelbagTest, channel_group_fcurve_ungroup)
{
FCurve &fcu0 = channel_bag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channel_bag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
FCurve &fcu2 = channel_bag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channel_bag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group1"});
FCurve &fcu4 = channel_bag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
FCurve &fcu0 = channelbag->fcurve_ensure(nullptr, {"fcu0", 0, std::nullopt, "group0"});
FCurve &fcu1 = channelbag->fcurve_ensure(nullptr, {"fcu1", 0, std::nullopt, "group0"});
FCurve &fcu2 = channelbag->fcurve_ensure(nullptr, {"fcu2", 0, std::nullopt, "group1"});
FCurve &fcu3 = channelbag->fcurve_ensure(nullptr, {"fcu3", 0, std::nullopt, "group1"});
FCurve &fcu4 = channelbag->fcurve_ensure(nullptr, {"fcu4", 0, std::nullopt, std::nullopt});
ASSERT_EQ(5, channel_bag->fcurves().size());
ASSERT_EQ(2, channel_bag->channel_groups().size());
ASSERT_EQ(5, channelbag->fcurves().size());
ASSERT_EQ(2, channelbag->channel_groups().size());
bActionGroup &group0 = *channel_bag->channel_group(0);
bActionGroup &group1 = *channel_bag->channel_group(1);
bActionGroup &group0 = *channelbag->channel_group(0);
bActionGroup &group1 = *channelbag->channel_group(1);
/* Attempting to ungroup an fcurve that's not in the channel bag should fail. */
FCurve bogus = {};
EXPECT_FALSE(channel_bag->fcurve_ungroup(bogus));
EXPECT_FALSE(channelbag->fcurve_ungroup(bogus));
/* Attempting to ungroup an fcurve that's already ungrouped is fine. */
EXPECT_TRUE(channel_bag->fcurve_ungroup(fcu4));
EXPECT_TRUE(channelbag->fcurve_ungroup(fcu4));
/* Ungroup each fcurve until all are ungrouped. */
EXPECT_TRUE(channel_bag->fcurve_ungroup(fcu0));
EXPECT_TRUE(channelbag->fcurve_ungroup(fcu0));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
EXPECT_EQ(2, group1.fcurve_range_length);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu3, channel_bag->fcurve(2));
EXPECT_EQ(&fcu4, channel_bag->fcurve(3));
EXPECT_EQ(&fcu0, channel_bag->fcurve(4));
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu3, channelbag->fcurve(2));
EXPECT_EQ(&fcu4, channelbag->fcurve(3));
EXPECT_EQ(&fcu0, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(&group1, fcu3.grp);
EXPECT_EQ(nullptr, fcu4.grp);
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_TRUE(channel_bag->fcurve_ungroup(fcu3));
EXPECT_TRUE(channelbag->fcurve_ungroup(fcu3));
EXPECT_EQ(0, group0.fcurve_range_start);
EXPECT_EQ(1, group0.fcurve_range_length);
EXPECT_EQ(1, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
EXPECT_EQ(&fcu1, channel_bag->fcurve(0));
EXPECT_EQ(&fcu2, channel_bag->fcurve(1));
EXPECT_EQ(&fcu4, channel_bag->fcurve(2));
EXPECT_EQ(&fcu0, channel_bag->fcurve(3));
EXPECT_EQ(&fcu3, channel_bag->fcurve(4));
EXPECT_EQ(&fcu1, channelbag->fcurve(0));
EXPECT_EQ(&fcu2, channelbag->fcurve(1));
EXPECT_EQ(&fcu4, channelbag->fcurve(2));
EXPECT_EQ(&fcu0, channelbag->fcurve(3));
EXPECT_EQ(&fcu3, channelbag->fcurve(4));
EXPECT_EQ(&group0, fcu1.grp);
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(nullptr, fcu4.grp);
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_EQ(nullptr, fcu3.grp);
EXPECT_TRUE(channel_bag->fcurve_ungroup(fcu1));
EXPECT_EQ(1, channel_bag->channel_groups().size());
EXPECT_EQ(&group1, channel_bag->channel_group(0));
EXPECT_TRUE(channelbag->fcurve_ungroup(fcu1));
EXPECT_EQ(1, channelbag->channel_groups().size());
EXPECT_EQ(&group1, channelbag->channel_group(0));
EXPECT_EQ(0, group1.fcurve_range_start);
EXPECT_EQ(1, group1.fcurve_range_length);
EXPECT_EQ(&fcu2, channel_bag->fcurve(0));
EXPECT_EQ(&fcu4, channel_bag->fcurve(1));
EXPECT_EQ(&fcu0, channel_bag->fcurve(2));
EXPECT_EQ(&fcu3, channel_bag->fcurve(3));
EXPECT_EQ(&fcu1, channel_bag->fcurve(4));
EXPECT_EQ(&fcu2, channelbag->fcurve(0));
EXPECT_EQ(&fcu4, channelbag->fcurve(1));
EXPECT_EQ(&fcu0, channelbag->fcurve(2));
EXPECT_EQ(&fcu3, channelbag->fcurve(3));
EXPECT_EQ(&fcu1, channelbag->fcurve(4));
EXPECT_EQ(&group1, fcu2.grp);
EXPECT_EQ(nullptr, fcu4.grp);
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_EQ(nullptr, fcu3.grp);
EXPECT_EQ(nullptr, fcu1.grp);
EXPECT_TRUE(channel_bag->fcurve_ungroup(fcu2));
EXPECT_EQ(0, channel_bag->channel_groups().size());
EXPECT_EQ(&fcu4, channel_bag->fcurve(0));
EXPECT_EQ(&fcu0, channel_bag->fcurve(1));
EXPECT_EQ(&fcu3, channel_bag->fcurve(2));
EXPECT_EQ(&fcu1, channel_bag->fcurve(3));
EXPECT_EQ(&fcu2, channel_bag->fcurve(4));
EXPECT_TRUE(channelbag->fcurve_ungroup(fcu2));
EXPECT_EQ(0, channelbag->channel_groups().size());
EXPECT_EQ(&fcu4, channelbag->fcurve(0));
EXPECT_EQ(&fcu0, channelbag->fcurve(1));
EXPECT_EQ(&fcu3, channelbag->fcurve(2));
EXPECT_EQ(&fcu1, channelbag->fcurve(3));
EXPECT_EQ(&fcu2, channelbag->fcurve(4));
EXPECT_EQ(nullptr, fcu4.grp);
EXPECT_EQ(nullptr, fcu0.grp);
EXPECT_EQ(nullptr, fcu3.grp);
@@ -1891,7 +1891,7 @@ TEST_F(ActionFCurveMoveTest, test_fcurve_move_layered)
action_src.layer_keystrip_ensure();
StripKeyframeData &strip_data_src = action_src.layer(0)->strip(0)->data<StripKeyframeData>(
action_src);
ChannelBag &cbag_src = strip_data_src.channelbag_for_slot_ensure(slot_src);
Channelbag &cbag_src = strip_data_src.channelbag_for_slot_ensure(slot_src);
cbag_src.fcurve_ensure(this->bmain, {"source_prop", 0});
FCurve &fcurve_to_move = cbag_src.fcurve_ensure(this->bmain, {"source_prop", 2});
@@ -1903,7 +1903,7 @@ TEST_F(ActionFCurveMoveTest, test_fcurve_move_layered)
action_dst.layer_keystrip_ensure();
StripKeyframeData &strip_data_dst = action_dst.layer(0)->strip(0)->data<StripKeyframeData>(
action_dst);
ChannelBag &cbag_dst = strip_data_dst.channelbag_for_slot_ensure(slot_dst);
Channelbag &cbag_dst = strip_data_dst.channelbag_for_slot_ensure(slot_dst);
cbag_dst.fcurve_ensure(this->bmain, {"dest_prop", 0});

View File

@@ -358,7 +358,7 @@ const FCurve *fcurve_find_by_rna_path(const AnimData &adt,
switch (strip->type()) {
case Strip::Type::Keyframe: {
const StripKeyframeData &strip_data = strip->data<StripKeyframeData>(action);
const ChannelBag *channelbag_for_slot = strip_data.channelbag_for_slot(*slot);
const Channelbag *channelbag_for_slot = strip_data.channelbag_for_slot(*slot);
if (!channelbag_for_slot) {
continue;
}

View File

@@ -140,7 +140,7 @@ static EvaluationResult evaluate_keyframe_data(PointerRNA &animated_id_ptr,
const slot_handle_t slot_handle,
const AnimationEvalContext &offset_eval_context)
{
ChannelBag *channelbag_for_slot = strip_data.channelbag_for_slot(slot_handle);
Channelbag *channelbag_for_slot = strip_data.channelbag_for_slot(slot_handle);
if (!channelbag_for_slot) {
return {};
}

View File

@@ -220,12 +220,12 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__non_array_property)
StripKeyframeData *strip_data = &strip->data<StripKeyframeData>(action);
/* We have a channel bag for the slot. */
ChannelBag *channel_bag = strip_data->channelbag_for_slot(*slot);
ASSERT_NE(nullptr, channel_bag);
Channelbag *channelbag = strip_data->channelbag_for_slot(*slot);
ASSERT_NE(nullptr, channelbag);
/* The fcurves in the channel bag are what we expect. */
EXPECT_EQ(1, channel_bag->fcurves().size());
const FCurve *fcurve = channel_bag->fcurve_find({"empty_display_size", 0});
EXPECT_EQ(1, channelbag->fcurves().size());
const FCurve *fcurve = channelbag->fcurve_find({"empty_display_size", 0});
ASSERT_NE(nullptr, fcurve);
ASSERT_NE(nullptr, fcurve->bezt);
EXPECT_EQ(1, fcurve->totvert);
@@ -454,10 +454,10 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__single_element)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
EXPECT_EQ(1, channel_bag->fcurves().size());
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 0}));
EXPECT_EQ(1, channelbag->fcurves().size());
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 0}));
}
/* Keying all elements of an array property. */
@@ -483,12 +483,12 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__all_elements)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
EXPECT_EQ(3, channel_bag->fcurves().size());
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 0}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 1}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 2}));
EXPECT_EQ(3, channelbag->fcurves().size());
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 0}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 1}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 2}));
}
/* Keying a pose bone from its own RNA pointer. */
@@ -517,10 +517,10 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__pose_bone_rna_pointer)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
EXPECT_EQ(1, channel_bag->fcurves().size());
EXPECT_NE(nullptr, channel_bag->fcurve_find({"pose.bones[\"Bone\"].rotation_euler", 0}));
EXPECT_EQ(1, channelbag->fcurves().size());
EXPECT_NE(nullptr, channelbag->fcurve_find({"pose.bones[\"Bone\"].rotation_euler", 0}));
}
/* Keying a pose bone from its owning ID's RNA pointer. */
@@ -547,10 +547,10 @@ TEST_F(KeyframingTest, insert_keyframes__pose_bone_owner_id_pointer)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
EXPECT_EQ(1, channel_bag->fcurves().size());
EXPECT_NE(nullptr, channel_bag->fcurve_find({"pose.bones[\"Bone\"].rotation_euler", 0}));
EXPECT_EQ(1, channelbag->fcurves().size());
EXPECT_NE(nullptr, channelbag->fcurve_find({"pose.bones[\"Bone\"].rotation_euler", 0}));
}
/* Keying multiple elements of multiple properties at once. */
@@ -581,15 +581,15 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__multiple_properties)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
EXPECT_EQ(6, channel_bag->fcurves().size());
EXPECT_NE(nullptr, channel_bag->fcurve_find({"empty_display_size", 0}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"location", 0}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"location", 1}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"location", 2}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 0}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 2}));
EXPECT_EQ(6, channelbag->fcurves().size());
EXPECT_NE(nullptr, channelbag->fcurve_find({"empty_display_size", 0}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"location", 0}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"location", 1}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"location", 2}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 0}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 2}));
}
/* Keying more than one ID on the same action. */
@@ -626,8 +626,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__multiple_ids)
/* We have a single channel bag, and it's for the first object's slot. */
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag_1 = strip_data->channelbag_for_slot(*slot_1);
ASSERT_NE(nullptr, channel_bag_1);
Channelbag *channelbag_1 = strip_data->channelbag_for_slot(*slot_1);
ASSERT_NE(nullptr, channelbag_1);
/* Assign the action to the second object, with no slot. */
ASSERT_TRUE(assign_action(&action, armature_object->id));
@@ -652,8 +652,8 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__multiple_ids)
EXPECT_STREQ(armature_object->adt->last_slot_identifier, slot_2->identifier);
ASSERT_EQ(2, strip_data->channelbags().size());
ChannelBag *channel_bag_2 = strip_data->channelbag_for_slot(*slot_2);
ASSERT_NE(nullptr, channel_bag_2);
Channelbag *channelbag_2 = strip_data->channelbag_for_slot(*slot_2);
ASSERT_NE(nullptr, channelbag_2);
}
/* Keying an object with an already-existing legacy action should do legacy
@@ -742,7 +742,7 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_available)
EXPECT_EQ(2, result_2.get_count(SingleKeyingResult::SUCCESS));
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
/* Second attempt should succeed with two keys, because two of the elements
* now have fcurves. */
@@ -756,9 +756,9 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_available)
INSERTKEY_AVAILABLE);
EXPECT_EQ(2, result_3.get_count(SingleKeyingResult::SUCCESS));
EXPECT_EQ(2, channel_bag->fcurves().size());
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 0}));
EXPECT_NE(nullptr, channel_bag->fcurve_find({"rotation_euler", 2}));
EXPECT_EQ(2, channelbag->fcurves().size());
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 0}));
EXPECT_NE(nullptr, channelbag->fcurve_find({"rotation_euler", 2}));
}
/* Keying with the "Only Replace" flag. */
@@ -802,11 +802,11 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
ASSERT_EQ(2, channel_bag->fcurves().size());
const FCurve *fcurve_x = channel_bag->fcurve_find({"rotation_euler", 0});
const FCurve *fcurve_z = channel_bag->fcurve_find({"rotation_euler", 2});
ASSERT_EQ(2, channelbag->fcurves().size());
const FCurve *fcurve_x = channelbag->fcurve_find({"rotation_euler", 0});
const FCurve *fcurve_z = channelbag->fcurve_find({"rotation_euler", 2});
EXPECT_EQ(1, fcurve_x->totvert);
EXPECT_EQ(1, fcurve_z->totvert);
EXPECT_EQ(1.0, fcurve_x->bezt[0].vec[1][0]);
@@ -828,7 +828,7 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
BEZT_KEYTYPE_KEYFRAME,
INSERTKEY_REPLACE);
EXPECT_EQ(0, result_3.get_count(SingleKeyingResult::SUCCESS));
EXPECT_EQ(2, channel_bag->fcurves().size());
EXPECT_EQ(2, channelbag->fcurves().size());
EXPECT_EQ(1, fcurve_x->totvert);
EXPECT_EQ(1, fcurve_z->totvert);
EXPECT_EQ(1.0, fcurve_x->bezt[0].vec[1][0]);
@@ -847,7 +847,7 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_replace)
BEZT_KEYTYPE_KEYFRAME,
INSERTKEY_REPLACE);
EXPECT_EQ(2, result_4.get_count(SingleKeyingResult::SUCCESS));
EXPECT_EQ(2, channel_bag->fcurves().size());
EXPECT_EQ(2, channelbag->fcurves().size());
EXPECT_EQ(1, fcurve_x->totvert);
EXPECT_EQ(1, fcurve_z->totvert);
EXPECT_EQ(1.0, fcurve_x->bezt[0].vec[1][0]);
@@ -879,12 +879,12 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_needed)
ASSERT_EQ(1, action.layer(0)->strips().size());
StripKeyframeData *strip_data = &action.layer(0)->strip(0)->data<StripKeyframeData>(action);
ASSERT_EQ(1, strip_data->channelbags().size());
ChannelBag *channel_bag = strip_data->channelbag(0);
Channelbag *channelbag = strip_data->channelbag(0);
ASSERT_EQ(3, channel_bag->fcurves().size());
const FCurve *fcurve_x = channel_bag->fcurve_find({"rotation_euler", 0});
const FCurve *fcurve_y = channel_bag->fcurve_find({"rotation_euler", 1});
const FCurve *fcurve_z = channel_bag->fcurve_find({"rotation_euler", 2});
ASSERT_EQ(3, channelbag->fcurves().size());
const FCurve *fcurve_x = channelbag->fcurve_find({"rotation_euler", 0});
const FCurve *fcurve_y = channelbag->fcurve_find({"rotation_euler", 1});
const FCurve *fcurve_z = channelbag->fcurve_find({"rotation_euler", 2});
EXPECT_EQ(1, fcurve_x->totvert);
EXPECT_EQ(1, fcurve_y->totvert);
EXPECT_EQ(1, fcurve_z->totvert);
@@ -900,7 +900,7 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_needed)
BEZT_KEYTYPE_KEYFRAME,
INSERTKEY_NEEDED);
EXPECT_EQ(0, result_2.get_count(SingleKeyingResult::SUCCESS));
EXPECT_EQ(3, channel_bag->fcurves().size());
EXPECT_EQ(3, channelbag->fcurves().size());
EXPECT_EQ(1, fcurve_x->totvert);
EXPECT_EQ(1, fcurve_y->totvert);
EXPECT_EQ(1, fcurve_z->totvert);
@@ -919,7 +919,7 @@ TEST_F(KeyframingTest, insert_keyframes__layered_action__only_needed)
INSERTKEY_NEEDED);
EXPECT_EQ(2, result_3.get_count(SingleKeyingResult::SUCCESS));
EXPECT_EQ(3, channel_bag->fcurves().size());
EXPECT_EQ(3, channelbag->fcurves().size());
EXPECT_EQ(2, fcurve_x->totvert);
EXPECT_EQ(1, fcurve_y->totvert);
EXPECT_EQ(2, fcurve_z->totvert);

View File

@@ -310,9 +310,9 @@ static void action_foreach_id(ID *id, LibraryForeachIDData *data)
}
}
static void write_channelbag(BlendWriter *writer, animrig::ChannelBag &channelbag)
static void write_channelbag(BlendWriter *writer, animrig::Channelbag &channelbag)
{
BLO_write_struct(writer, ActionChannelBag, &channelbag);
BLO_write_struct(writer, ActionChannelbag, &channelbag);
Span<bActionGroup *> groups = channelbag.channel_groups();
BLO_write_pointer_array(writer, groups.size(), groups.data());
@@ -336,7 +336,7 @@ static void write_strip_keyframe_data(BlendWriter *writer,
auto channelbags = strip_keyframe_data.channelbags();
BLO_write_pointer_array(writer, channelbags.size(), channelbags.data());
for (animrig::ChannelBag *channelbag : channelbags) {
for (animrig::Channelbag *channelbag : channelbags) {
write_channelbag(writer, *channelbag);
}
}
@@ -508,7 +508,7 @@ static void action_blend_write(BlendWriter *writer, ID *id, const void *id_addre
* forward-compat legacy data is also written, and vice-versa. Both have
* pointers to each other that won't resolve properly when loaded in older
* Blender versions if only one is written. */
animrig::ChannelBag *bag = channelbag_for_action_slot(action, first_slot.handle);
animrig::Channelbag *bag = channelbag_for_action_slot(action, first_slot.handle);
if (bag) {
action_blend_write_make_legacy_fcurves_listbase(action.curves, bag->fcurves());
action_blend_write_make_legacy_channel_groups_listbase(action.groups, bag->channel_groups());
@@ -553,13 +553,13 @@ static void action_blend_write(BlendWriter *writer, ID *id, const void *id_addre
BKE_previewimg_blend_write(writer, action.preview);
}
static void read_channelbag(BlendDataReader *reader, animrig::ChannelBag &channelbag)
static void read_channelbag(BlendDataReader *reader, animrig::Channelbag &channelbag)
{
BLO_read_pointer_array(
reader, channelbag.group_array_num, reinterpret_cast<void **>(&channelbag.group_array));
for (int i = 0; i < channelbag.group_array_num; i++) {
BLO_read_struct(reader, bActionGroup, &channelbag.group_array[i]);
channelbag.group_array[i]->channel_bag = &channelbag;
channelbag.group_array[i]->channelbag = &channelbag;
/* Clear the legacy channels #ListBase, since it will have been set for some
* groups for forward compatibility.
@@ -590,8 +590,8 @@ static void read_strip_keyframe_data(BlendDataReader *reader,
reinterpret_cast<void **>(&strip_keyframe_data.channelbag_array));
for (int i = 0; i < strip_keyframe_data.channelbag_array_num; i++) {
BLO_read_struct(reader, ActionChannelBag, &strip_keyframe_data.channelbag_array[i]);
ActionChannelBag *channelbag = strip_keyframe_data.channelbag_array[i];
BLO_read_struct(reader, ActionChannelbag, &strip_keyframe_data.channelbag_array[i]);
ActionChannelbag *channelbag = strip_keyframe_data.channelbag_array[i];
read_channelbag(reader, channelbag->wrap());
}
}
@@ -780,7 +780,7 @@ bAction *BKE_action_add(Main *bmain, const char name[])
bActionGroup *get_active_actiongroup(bAction *act)
{
/* TODO: move this logic to the animrig::ChannelBag struct and unify with code
/* TODO: move this logic to the animrig::Channelbag struct and unify with code
* that uses direct access to the flags. */
for (bActionGroup *agrp : animrig::legacy::channel_groups_all(act)) {
if (agrp->flag & AGRP_ACTIVE) {
@@ -792,7 +792,7 @@ bActionGroup *get_active_actiongroup(bAction *act)
void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
{
/* TODO: move this logic to the animrig::ChannelBag struct and unify with code
/* TODO: move this logic to the animrig::Channelbag struct and unify with code
* that uses direct access to the flags. */
for (bActionGroup *grp : animrig::legacy::channel_groups_all(act)) {
if ((grp == agrp) && (select)) {
@@ -1913,7 +1913,7 @@ void what_does_obaction(Object *ob,
/* Find the named channel group. */
Action &action = act->wrap();
if (action.is_action_layered()) {
ChannelBag *cbag = channelbag_for_action_slot(action, action_slot_handle);
Channelbag *cbag = channelbag_for_action_slot(action, action_slot_handle);
agrp = cbag ? cbag->channel_group_find(groupname) : nullptr;
}
else {

View File

@@ -136,7 +136,7 @@ static void convert_action_in_place(blender::animrig::Action &action)
Layer &layer = action.layer_add("Layer");
blender::animrig::Strip &strip = layer.strip_add(action,
blender::animrig::Strip::Type::Keyframe);
ChannelBag &bag = strip.data<StripKeyframeData>(action).channelbag_for_slot_ensure(slot);
Channelbag &bag = strip.data<StripKeyframeData>(action).channelbag_for_slot_ensure(slot);
const int fcu_count = BLI_listbase_count(&action.curves);
const int group_count = BLI_listbase_count(&action.groups);
bag.fcurve_array = MEM_cnew_array<FCurve *>(fcu_count, "Action versioning - fcurves");
@@ -149,7 +149,7 @@ static void convert_action_in_place(blender::animrig::Action &action)
LISTBASE_FOREACH_INDEX (bActionGroup *, group, &action.groups, group_index) {
bag.group_array[group_index] = group;
group->channel_bag = &bag;
group->channelbag = &bag;
group->fcurve_range_start = fcurve_index;
LISTBASE_FOREACH (FCurve *, fcu, &group->channels) {

View File

@@ -1707,7 +1707,7 @@ void DepsgraphRelationBuilder::build_animdata_action_targets(ID *id,
switch (strip->type()) {
case animrig::Strip::Type::Keyframe: {
animrig::StripKeyframeData &strip_data = strip->data<animrig::StripKeyframeData>(action);
animrig::ChannelBag *channels = strip_data.channelbag_for_slot(*slot);
animrig::Channelbag *channels = strip_data.channelbag_for_slot(*slot);
if (channels == nullptr) {
/* Go to next strip. */
break;

View File

@@ -1689,10 +1689,10 @@ static void join_groups_action_temp(bAction *act)
* `mode`.
*
* NOTE: the current implementation has quadratic performance with respect to
* the number of groups in a `ChannelBag`, due to both `Span::first_index_try()`
* and `ChannelBag::channel_group_move()` having linear performance. If this
* the number of groups in a `Channelbag`, due to both `Span::first_index_try()`
* and `Channelbag::channel_group_move()` having linear performance. If this
* becomes a performance bottleneck in practice, we can create a dedicated
* method on `ChannelBag` for collectively moving a non-contiguous set of
* method on `Channelbag` for collectively moving a non-contiguous set of
* channel groups that works in linear time.
*
* TODO: there's a fair amount of apparent repetition in this code and the code
@@ -1722,7 +1722,7 @@ static void rearrange_layered_action_channel_groups(bAnimContext *ac,
if (!SEL_AGRP(group)) {
continue;
}
blender::animrig::ChannelBag &bag = group->channel_bag->wrap();
blender::animrig::Channelbag &bag = group->channelbag->wrap();
const int group_index = bag.channel_groups().first_index_try(group);
const int to_index = group_index - 1;
BLI_assert(group_index >= 0);
@@ -1747,7 +1747,7 @@ static void rearrange_layered_action_channel_groups(bAnimContext *ac,
if (!SEL_AGRP(group)) {
continue;
}
blender::animrig::ChannelBag &bag = group->channel_bag->wrap();
blender::animrig::Channelbag &bag = group->channelbag->wrap();
bag.channel_group_move(*group, 0);
}
break;
@@ -1760,7 +1760,7 @@ static void rearrange_layered_action_channel_groups(bAnimContext *ac,
if (!SEL_AGRP(group)) {
continue;
}
blender::animrig::ChannelBag &bag = group->channel_bag->wrap();
blender::animrig::Channelbag &bag = group->channelbag->wrap();
const int group_index = bag.channel_groups().first_index_try(group);
const int to_index = group_index + 1;
BLI_assert(group_index >= 0);
@@ -1785,7 +1785,7 @@ static void rearrange_layered_action_channel_groups(bAnimContext *ac,
if (!SEL_AGRP(group)) {
continue;
}
blender::animrig::ChannelBag &bag = group->channel_bag->wrap();
blender::animrig::Channelbag &bag = group->channelbag->wrap();
bag.channel_group_move(*group, bag.channel_groups().size() - 1);
}
break;
@@ -1799,10 +1799,10 @@ static void rearrange_layered_action_channel_groups(bAnimContext *ac,
* Move selected, visible fcurves in the channel list according to `mode`.
*
* NOTE: the current implementation has quadratic performance with respect to
* the number of fcurves in a `ChannelBag`, due to both
* `Span::first_index_try()` and `ChannelBag::fcurve_move()` having linear
* the number of fcurves in a `Channelbag`, due to both
* `Span::first_index_try()` and `Channelbag::fcurve_move()` having linear
* performance. If this becomes a performance bottleneck in practice, we can
* create a dedicated method on `ChannelBag` for collectively moving a
* create a dedicated method on `Channelbag` for collectively moving a
* non-contiguous set of fcurves that works in linear time.
*
* TODO: there's a fair amount of apparent repetition in this code and the code
@@ -1838,12 +1838,12 @@ static void rearrange_layered_action_fcurves(bAnimContext *ac,
return *fcurve->grp;
}
blender::animrig::ChannelBag *bag = channelbag_for_action_slot(action,
blender::animrig::Channelbag *bag = channelbag_for_action_slot(action,
fcurve_ale->slot_handle);
BLI_assert(bag != nullptr);
bActionGroup group = {};
group.channel_bag = bag;
group.channelbag = bag;
group.fcurve_range_start = 0;
if (!bag->channel_groups().is_empty()) {
bActionGroup *last_group = bag->channel_groups().last();
@@ -1874,7 +1874,7 @@ static void rearrange_layered_action_fcurves(bAnimContext *ac,
continue;
}
blender::animrig::ChannelBag &bag = group.channel_bag->wrap();
blender::animrig::Channelbag &bag = group.channelbag->wrap();
const int fcurve_index = bag.fcurves().first_index_try(fcurve);
const int to_index = fcurve_index - 1;
@@ -1901,7 +1901,7 @@ static void rearrange_layered_action_fcurves(bAnimContext *ac,
continue;
}
blender::animrig::ChannelBag &bag = group.channel_bag->wrap();
blender::animrig::Channelbag &bag = group.channelbag->wrap();
bag.fcurve_move(*fcurve, group.fcurve_range_start);
}
return;
@@ -1917,7 +1917,7 @@ static void rearrange_layered_action_fcurves(bAnimContext *ac,
continue;
}
blender::animrig::ChannelBag &bag = group.channel_bag->wrap();
blender::animrig::Channelbag &bag = group.channelbag->wrap();
const int fcurve_index = bag.fcurves().first_index_try(fcurve);
const int to_index = fcurve_index + 1;
@@ -1946,7 +1946,7 @@ static void rearrange_layered_action_fcurves(bAnimContext *ac,
continue;
}
blender::animrig::ChannelBag &bag = group.channel_bag->wrap();
blender::animrig::Channelbag &bag = group.channelbag->wrap();
bag.fcurve_move(*fcurve, group.fcurve_range_start + group.fcurve_range_length - 1);
}
return;
@@ -2396,11 +2396,11 @@ static void animchannels_group_channels(bAnimContext *ac,
* each fcurve individually (each of which is an O(N) operation), but it's
* also the simplest thing we can do given the data we have. In the future we
* can do something smarter, particularly if it becomes a performance issue. */
blender::animrig::ChannelBag *last_channelbag = nullptr;
blender::animrig::Channelbag *last_channelbag = nullptr;
bActionGroup *group = nullptr;
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
FCurve *fcu = (FCurve *)ale->data;
blender::animrig::ChannelBag *channelbag = channelbag_for_action_slot(act->wrap(),
blender::animrig::Channelbag *channelbag = channelbag_for_action_slot(act->wrap(),
ale->slot_handle);
if (channelbag != last_channelbag) {
@@ -2534,7 +2534,7 @@ static int animchannels_ungroup_exec(bContext *C, wmOperator * /*op*/)
}
/* Layered action. */
fcu->grp->channel_bag->wrap().fcurve_ungroup(*fcu);
fcu->grp->channelbag->wrap().fcurve_ungroup(*fcu);
}
/* cleanup */
@@ -2673,7 +2673,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator * /*op*/)
* along with the group. This difference in behavior is replicated
* from legacy actions. */
blender::animrig::ChannelBag &channel_bag = agrp->channel_bag->wrap();
blender::animrig::Channelbag &channelbag = agrp->channelbag->wrap();
/* Remove all the fcurves in the group, which also automatically
* deletes the group when the last fcurve is deleted. Since the group
@@ -2683,7 +2683,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator * /*op*/)
const int fcurve_range_start = agrp->fcurve_range_start;
const int fcurve_range_length = agrp->fcurve_range_length;
for (int i = 0; i < fcurve_range_length; i++) {
channel_bag.fcurve_remove(*channel_bag.fcurve(fcurve_range_start));
channelbag.fcurve_remove(*channelbag.fcurve(fcurve_range_start));
}
DEG_id_tag_update_ex(CTX_data_main(C), &adt->action->id, ID_RECALC_ANIMATION);

View File

@@ -1512,7 +1512,7 @@ static size_t animfilter_act_group(bAnimContext *ac,
ac, &tmp_data, first_fcu, ANIMTYPE_FCURVE, filter_mode, agrp, owner_id, &act->id);
}
else {
BLI_assert(agrp->channel_bag != nullptr);
BLI_assert(agrp->channelbag != nullptr);
Span<FCurve *> fcurves = agrp->wrap().fcurves();
tmp_items += animfilter_fcurves_span(
ac, &tmp_data, fcurves, slot_handle, filter_mode, owner_id, &act->id);
@@ -1594,8 +1594,8 @@ static size_t animfilter_action_slot(bAnimContext *ac,
const bool visible_only = (filter_mode & ANIMFILTER_LIST_VISIBLE);
const bool expansion_is_ok = !visible_only || !show_slot_channel || slot.is_expanded();
animrig::ChannelBag *channel_bag = animrig::channelbag_for_action_slot(action, slot.handle);
if (channel_bag == nullptr) {
animrig::Channelbag *channelbag = animrig::channelbag_for_action_slot(action, slot.handle);
if (channelbag == nullptr) {
return items;
}
@@ -1604,7 +1604,7 @@ static size_t animfilter_action_slot(bAnimContext *ac,
}
/* Add channel groups and their member channels. */
for (bActionGroup *group : channel_bag->channel_groups()) {
for (bActionGroup *group : channelbag->channel_groups()) {
items += animfilter_act_group(
ac, anim_data, &action, slot.handle, group, filter_mode, animated_id);
}
@@ -1612,13 +1612,13 @@ static size_t animfilter_action_slot(bAnimContext *ac,
/* Add ungrouped channels. */
if (!show_active_group_only) {
int first_ungrouped_fcurve_index = 0;
if (!channel_bag->channel_groups().is_empty()) {
const bActionGroup *last_group = channel_bag->channel_groups().last();
if (!channelbag->channel_groups().is_empty()) {
const bActionGroup *last_group = channelbag->channel_groups().last();
first_ungrouped_fcurve_index = last_group->fcurve_range_start +
last_group->fcurve_range_length;
}
Span<FCurve *> fcurves = channel_bag->fcurves().drop_front(first_ungrouped_fcurve_index);
Span<FCurve *> fcurves = channelbag->fcurves().drop_front(first_ungrouped_fcurve_index);
items += animfilter_fcurves_span(
ac, anim_data, fcurves, slot.handle, filter_mode, animated_id, &action.id);
}

View File

@@ -92,10 +92,10 @@ TEST_F(ActionFilterTest, slots_expanded_or_not)
SingleKeyingResult::SUCCESS,
strip_data.keyframe_insert(bmain, slot_suzanne, {"location", 1}, {1.0f, 0.25f}, settings));
ChannelBag *cube_channel_bag = strip_data.channelbag_for_slot(slot_cube);
ASSERT_NE(nullptr, cube_channel_bag);
FCurve *fcu_cube_loc_x = cube_channel_bag->fcurve_find({"location", 0});
FCurve *fcu_cube_loc_y = cube_channel_bag->fcurve_find({"location", 1});
Channelbag *cube_channelbag = strip_data.channelbag_for_slot(slot_cube);
ASSERT_NE(nullptr, cube_channelbag);
FCurve *fcu_cube_loc_x = cube_channelbag->fcurve_find({"location", 0});
FCurve *fcu_cube_loc_y = cube_channelbag->fcurve_find({"location", 1});
ASSERT_NE(nullptr, fcu_cube_loc_x);
ASSERT_NE(nullptr, fcu_cube_loc_y);
@@ -249,11 +249,11 @@ TEST_F(ActionFilterTest, layered_action_active_fcurves)
/* Set one F-Curve as the active one, and the other as inactive. The latter is necessary because
* by default the first curve is automatically marked active, but that's too trivial a test case
* (it's too easy to mistakenly just return the first-seen F-Curve). */
ChannelBag *cube_channel_bag = strip_data.channelbag_for_slot(slot_cube);
ASSERT_NE(nullptr, cube_channel_bag);
FCurve *fcurve_active = cube_channel_bag->fcurve_find({"location", 1});
Channelbag *cube_channelbag = strip_data.channelbag_for_slot(slot_cube);
ASSERT_NE(nullptr, cube_channelbag);
FCurve *fcurve_active = cube_channelbag->fcurve_find({"location", 1});
fcurve_active->flag |= FCURVE_ACTIVE;
FCurve *fcurve_other = cube_channel_bag->fcurve_find({"location", 0});
FCurve *fcurve_other = cube_channelbag->fcurve_find({"location", 0});
fcurve_other->flag &= ~FCURVE_ACTIVE;
/* Mock an bAnimContext for the Action editor. */

View File

@@ -167,9 +167,9 @@ static short agrp_keyframes_loop(KeyframeEditData *ked,
}
/* Layered actions. */
animrig::ChannelBag &channel_bag = agrp->channel_bag->wrap();
Span<FCurve *> fcurves = channel_bag.fcurves().slice(agrp->fcurve_range_start,
agrp->fcurve_range_length);
animrig::Channelbag &channelbag = agrp->channelbag->wrap();
Span<FCurve *> fcurves = channelbag.fcurves().slice(agrp->fcurve_range_start,
agrp->fcurve_range_length);
for (FCurve *fcurve : fcurves) {
if (ANIM_fcurve_keyframes_loop(ked, fcurve, key_ok, key_cb, fcu_cb)) {
return 1;

View File

@@ -1236,9 +1236,9 @@ void action_group_to_keylist(AnimData *adt,
}
/* Layered actions. */
animrig::ChannelBag &channel_bag = agrp->channel_bag->wrap();
Span<FCurve *> fcurves = channel_bag.fcurves().slice(agrp->fcurve_range_start,
agrp->fcurve_range_length);
animrig::Channelbag &channelbag = agrp->channelbag->wrap();
Span<FCurve *> fcurves = channelbag.fcurves().slice(agrp->fcurve_range_start,
agrp->fcurve_range_length);
for (FCurve *fcurve : fcurves) {
fcurve_to_keylist(adt, fcurve, keylist, saction_flag, range, true);
}

View File

@@ -509,7 +509,7 @@ static void update_duplicate_action_constraint_settings(
bAction *act = (bAction *)act_con->act;
if (act) {
blender::animrig::Action &action = act->wrap();
blender::animrig::ChannelBag *cbag = blender::animrig::channelbag_for_action_slot(
blender::animrig::Channelbag *cbag = blender::animrig::channelbag_for_action_slot(
action, act_con->action_slot_handle);
/* Create a copy and mirror the animation */

View File

@@ -46,7 +46,7 @@ typedef struct GPUVertBufHandle GPUVertBufHandle;
struct ActionLayer;
struct ActionSlot;
struct ActionStrip;
struct ActionChannelBag;
struct ActionChannelbag;
/* Declarations of the C++ wrappers. */
#ifdef __cplusplus
@@ -54,7 +54,7 @@ namespace blender::animrig {
class Action;
class Slot;
class SlotRuntime;
class ChannelBag;
class Channelbag;
class ChannelGroup;
class Layer;
class Strip;
@@ -687,7 +687,7 @@ typedef struct bActionGroup {
/**
* Span of channels in this group for layered actions.
*
* This specifies that span as a range of items in a ChannelBag's fcurve
* This specifies that span as a range of items in a Channelbag's fcurve
* array.
*
* Note that empty groups (`fcurve_range_length == 0`) are allowed, and they
@@ -700,12 +700,12 @@ typedef struct bActionGroup {
int fcurve_range_length;
/**
* For layered actions: the ChannelBag this group belongs to.
* For layered actions: the Channelbag this group belongs to.
*
* This is needed in the keyframe drawing code, etc., to give direct access to
* the fcurves in this group.
*/
struct ActionChannelBag *channel_bag;
struct ActionChannelbag *channelbag;
/** Settings for this action-group. */
int flag;
@@ -1262,7 +1262,7 @@ typedef struct ActionStrip {
* \see #blender::animrig::StripKeyframeData
*/
typedef struct ActionStripKeyframeData {
struct ActionChannelBag **channelbag_array;
struct ActionChannelbag **channelbag_array;
int channelbag_array_num;
uint8_t _pad[4];
@@ -1274,9 +1274,9 @@ typedef struct ActionStripKeyframeData {
} ActionStripKeyframeData;
/**
* \see #blender::animrig::ChannelBag
* \see #blender::animrig::Channelbag
*/
typedef struct ActionChannelBag {
typedef struct ActionChannelbag {
int32_t slot_handle;
/* Channel groups. These index into the `fcurve_array` below to specify group
@@ -1304,16 +1304,16 @@ typedef struct ActionChannelBag {
/* TODO: Design & implement a way to integrate other channel types as well,
* and still have them map to a certain slot */
#ifdef __cplusplus
blender::animrig::ChannelBag &wrap();
const blender::animrig::ChannelBag &wrap() const;
blender::animrig::Channelbag &wrap();
const blender::animrig::Channelbag &wrap() const;
#endif
} ActionChannelBag;
} ActionChannelbag;
#ifdef __cplusplus
/* Some static assertions that things that should have the same type actually do. */
static_assert(std::is_same_v<decltype(ActionSlot::handle), decltype(bAction::last_slot_handle)>);
static_assert(
std::is_same_v<decltype(ActionSlot::handle), decltype(ActionChannelBag::slot_handle)>);
std::is_same_v<decltype(ActionSlot::handle), decltype(ActionChannelbag::slot_handle)>);
static_assert(
std::is_same_v<decltype(ActionSlot::handle), decltype(SpaceAction::action_slot_handle)>);
#endif

View File

@@ -42,6 +42,7 @@
/* NOTE: Keep sorted! */
DNA_STRUCT_RENAME(ActionChannelBag, ActionChannelbag)
DNA_STRUCT_RENAME(Lamp, Light)
DNA_STRUCT_RENAME(SeqRetimingHandle, SeqRetimingKey)
DNA_STRUCT_RENAME(SpaceButs, SpaceProperties)
@@ -51,6 +52,7 @@ DNA_STRUCT_RENAME_MEMBER(ActionSlot, name, identifier)
DNA_STRUCT_RENAME_MEMBER(AnimData, slot_name, last_slot_identifier)
DNA_STRUCT_RENAME_MEMBER(AnimData, tmp_slot_name, tmp_last_slot_identifier)
DNA_STRUCT_RENAME_MEMBER(bActionConstraint, action_slot_name, last_slot_identifier)
DNA_STRUCT_RENAME_MEMBER(bActionGroup, channel_bag, channelbag)
DNA_STRUCT_RENAME_MEMBER(BPoint, alfa, tilt)
DNA_STRUCT_RENAME_MEMBER(BezTriple, alfa, tilt)
DNA_STRUCT_RENAME_MEMBER(Bone, curveInX, curve_in_x)

View File

@@ -136,9 +136,9 @@ static void rna_Action_tag_animupdate(Main *, Scene *, PointerRNA *ptr)
DEG_id_tag_update(&action.id, ID_RECALC_ANIMATION);
}
static animrig::ChannelBag &rna_data_channelbag(const PointerRNA *ptr)
static animrig::Channelbag &rna_data_channelbag(const PointerRNA *ptr)
{
return reinterpret_cast<ActionChannelBag *>(ptr->data)->wrap();
return reinterpret_cast<ActionChannelbag *>(ptr->data)->wrap();
}
template<typename T>
@@ -499,7 +499,7 @@ static int rna_iterator_keyframestrip_channelbags_length(PointerRNA *ptr)
return strip.data<animrig::StripKeyframeData>(action).channelbags().size();
}
static ActionChannelBag *rna_ChannelBags_new(ID *dna_action_id,
static ActionChannelbag *rna_Channelbags_new(ID *dna_action_id,
ActionStrip *dna_strip,
bContext *C,
ReportList *reports,
@@ -515,7 +515,7 @@ static ActionChannelBag *rna_ChannelBags_new(ID *dna_action_id,
return nullptr;
}
animrig::ChannelBag &channelbag = strip_data.channelbag_for_slot_add(slot);
animrig::Channelbag &channelbag = strip_data.channelbag_for_slot_add(slot);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, nullptr);
/* No need to tag the depsgraph, as there is no new animation yet. */
@@ -523,7 +523,7 @@ static ActionChannelBag *rna_ChannelBags_new(ID *dna_action_id,
return &channelbag;
}
static void rna_ChannelBags_remove(ID *dna_action_id,
static void rna_Channelbags_remove(ID *dna_action_id,
ActionStrip *dna_strip,
bContext *C,
ReportList *reports,
@@ -532,7 +532,7 @@ static void rna_ChannelBags_remove(ID *dna_action_id,
animrig::Action &action = reinterpret_cast<bAction *>(dna_action_id)->wrap();
animrig::StripKeyframeData &strip_data = dna_strip->wrap().data<animrig::StripKeyframeData>(
action);
animrig::ChannelBag &channelbag = rna_data_channelbag(channelbag_ptr);
animrig::Channelbag &channelbag = rna_data_channelbag(channelbag_ptr);
if (!strip_data.channelbag_remove(channelbag)) {
BKE_report(reports, RPT_ERROR, "This channelbag does not belong to this strip");
@@ -576,10 +576,10 @@ static bool rna_ActionStrip_key_insert(ID *dna_action_id,
return ok;
}
static std::optional<std::string> rna_ChannelBag_path(const PointerRNA *ptr)
static std::optional<std::string> rna_Channelbag_path(const PointerRNA *ptr)
{
animrig::Action &action = rna_action(ptr);
animrig::ChannelBag &cbag_to_find = rna_data_channelbag(ptr);
animrig::Channelbag &cbag_to_find = rna_data_channelbag(ptr);
for (animrig::Layer *layer : action.layers()) {
for (int64_t strip_index : layer->strips().index_range()) {
@@ -605,20 +605,20 @@ static std::optional<std::string> rna_ChannelBag_path(const PointerRNA *ptr)
return std::nullopt;
}
static void rna_iterator_ChannelBag_fcurves_begin(CollectionPropertyIterator *iter,
static void rna_iterator_Channelbag_fcurves_begin(CollectionPropertyIterator *iter,
PointerRNA *ptr)
{
animrig::ChannelBag &bag = rna_data_channelbag(ptr);
animrig::Channelbag &bag = rna_data_channelbag(ptr);
rna_iterator_array_begin(iter, bag.fcurves());
}
static int rna_iterator_ChannelBag_fcurves_length(PointerRNA *ptr)
static int rna_iterator_Channelbag_fcurves_length(PointerRNA *ptr)
{
animrig::ChannelBag &bag = rna_data_channelbag(ptr);
animrig::Channelbag &bag = rna_data_channelbag(ptr);
return bag.fcurves().size();
}
static FCurve *rna_ChannelBag_fcurve_new(ActionChannelBag *dna_channelbag,
static FCurve *rna_Channelbag_fcurve_new(ActionChannelbag *dna_channelbag,
Main *bmain,
ReportList *reports,
const char *data_path,
@@ -630,7 +630,7 @@ static FCurve *rna_ChannelBag_fcurve_new(ActionChannelBag *dna_channelbag,
return nullptr;
}
animrig::ChannelBag &self = dna_channelbag->wrap();
animrig::Channelbag &self = dna_channelbag->wrap();
FCurve *fcurve = self.fcurve_create_unique(bmain, {data_path, index});
if (!fcurve) {
BKE_reportf(reports,
@@ -643,7 +643,7 @@ static FCurve *rna_ChannelBag_fcurve_new(ActionChannelBag *dna_channelbag,
return fcurve;
}
static FCurve *rna_ChannelBag_fcurve_find(ActionChannelBag *dna_channelbag,
static FCurve *rna_Channelbag_fcurve_find(ActionChannelbag *dna_channelbag,
ReportList *reports,
const char *data_path,
const int index)
@@ -653,17 +653,17 @@ static FCurve *rna_ChannelBag_fcurve_find(ActionChannelBag *dna_channelbag,
return nullptr;
}
animrig::ChannelBag &self = dna_channelbag->wrap();
animrig::Channelbag &self = dna_channelbag->wrap();
return self.fcurve_find({data_path, index});
}
static void rna_ChannelBag_fcurve_remove(ID *dna_action_id,
ActionChannelBag *dna_channelbag,
static void rna_Channelbag_fcurve_remove(ID *dna_action_id,
ActionChannelbag *dna_channelbag,
bContext *C,
ReportList *reports,
PointerRNA *fcurve_ptr)
{
animrig::ChannelBag &self = dna_channelbag->wrap();
animrig::Channelbag &self = dna_channelbag->wrap();
FCurve *fcurve = static_cast<FCurve *>(fcurve_ptr->data);
if (!self.fcurve_remove(*fcurve)) {
@@ -675,8 +675,8 @@ static void rna_ChannelBag_fcurve_remove(ID *dna_action_id,
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
}
static void rna_ChannelBag_fcurve_clear(ID *dna_action_id,
ActionChannelBag *dna_channelbag,
static void rna_Channelbag_fcurve_clear(ID *dna_action_id,
ActionChannelbag *dna_channelbag,
bContext *C)
{
dna_channelbag->wrap().fcurves_clear();
@@ -684,31 +684,31 @@ static void rna_ChannelBag_fcurve_clear(ID *dna_action_id,
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
}
static void rna_iterator_ChannelBag_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
static void rna_iterator_Channelbag_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
animrig::ChannelBag &bag = rna_data_channelbag(ptr);
animrig::Channelbag &bag = rna_data_channelbag(ptr);
rna_iterator_array_begin(iter, bag.channel_groups());
}
static int rna_iterator_ChannelBag_groups_length(PointerRNA *ptr)
static int rna_iterator_Channelbag_groups_length(PointerRNA *ptr)
{
animrig::ChannelBag &bag = rna_data_channelbag(ptr);
animrig::Channelbag &bag = rna_data_channelbag(ptr);
return bag.channel_groups().size();
}
static bActionGroup *rna_ChannelBag_group_new(ActionChannelBag *dna_channelbag, const char *name)
static bActionGroup *rna_Channelbag_group_new(ActionChannelbag *dna_channelbag, const char *name)
{
BLI_assert(name != nullptr);
animrig::ChannelBag &self = dna_channelbag->wrap();
animrig::Channelbag &self = dna_channelbag->wrap();
return &self.channel_group_create(name);
}
static void rna_ChannelBag_group_remove(ActionChannelBag *dna_channelbag,
static void rna_Channelbag_group_remove(ActionChannelbag *dna_channelbag,
ReportList *reports,
PointerRNA *agrp_ptr)
{
animrig::ChannelBag &self = dna_channelbag->wrap();
animrig::Channelbag &self = dna_channelbag->wrap();
bActionGroup *agrp = static_cast<bActionGroup *>(agrp_ptr->data);
@@ -724,7 +724,7 @@ static void rna_ChannelBag_group_remove(ActionChannelBag *dna_channelbag,
WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
}
static ActionChannelBag *rna_ActionStrip_channels(ID *dna_action_id,
static ActionChannelbag *rna_ActionStrip_channels(ID *dna_action_id,
ActionStrip *self,
const animrig::slot_handle_t slot_handle)
{
@@ -779,7 +779,7 @@ static void rna_ActionGroup_channels_begin(CollectionPropertyIterator *iter, Poi
}
/* Group from a layered action. */
animrig::ChannelBag &cbag = group->channel_bag->wrap();
animrig::Channelbag &cbag = group->channelbag->wrap();
custom_iter->tag = ActionGroupChannelsIterator::ARRAY;
custom_iter->array.ptr = reinterpret_cast<char *>(cbag.fcurve_array + group->fcurve_range_start);
@@ -863,7 +863,7 @@ static void rna_iterator_Action_groups_begin(CollectionPropertyIterator *iter, P
animrig::Action &action = rna_action(ptr);
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
return;
}
@@ -910,7 +910,7 @@ static int rna_iterator_Action_groups_length(PointerRNA *ptr)
{
animrig::Action &action = rna_action(ptr);
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
return 0;
}
@@ -925,7 +925,7 @@ static bActionGroup *rna_Action_groups_new(bAction *act, const char name[])
animrig::Action &action = act->wrap();
if (use_backward_compatible_api(action)) {
animrig::ChannelBag &channelbag = animrig::legacy::channelbag_ensure(action);
animrig::Channelbag &channelbag = animrig::legacy::channelbag_ensure(action);
group = &channelbag.channel_group_create(name);
}
else {
@@ -949,7 +949,7 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, PointerR
animrig::Action &action = act->wrap();
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag || !channelbag->channel_group_remove(*agrp)) {
BKE_reportf(reports,
RPT_ERROR,
@@ -1000,7 +1000,7 @@ static void rna_iterator_Action_fcurves_begin(CollectionPropertyIterator *iter,
animrig::Action &action = rna_action(ptr);
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
return;
}
@@ -1047,7 +1047,7 @@ static int rna_iterator_Action_fcurves_length(PointerRNA *ptr)
{
animrig::Action &action = rna_action(ptr);
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
return 0;
}
@@ -1077,7 +1077,7 @@ static FCurve *rna_Action_fcurve_new(bAction *act,
animrig::Action &action = act->wrap();
if (use_backward_compatible_api(action)) {
/* Add the F-Curve to the channelbag for the first slot. */
animrig::ChannelBag &channelbag = animrig::legacy::channelbag_ensure(action);
animrig::Channelbag &channelbag = animrig::legacy::channelbag_ensure(action);
FCurve *fcurve = channelbag.fcurve_create_unique(bmain, fcurve_descriptor);
if (!fcurve) {
/* The only reason fcurve_create_unique() returns nullptr is when the curve
@@ -1126,7 +1126,7 @@ static FCurve *rna_Action_fcurve_find(bAction *act,
animrig::Action &action = act->wrap();
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
return nullptr;
}
@@ -1143,7 +1143,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerR
animrig::Action &action = act->wrap();
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name + 2);
return;
@@ -1193,7 +1193,7 @@ static void rna_Action_fcurve_clear(bAction *act)
{
animrig::Action &action = act->wrap();
if (use_backward_compatible_api(action)) {
animrig::ChannelBag *channelbag = animrig::legacy::channelbag_get(action);
animrig::Channelbag *channelbag = animrig::legacy::channelbag_get(action);
if (!channelbag) {
/* Nothing to clear, so the post-condition of not having F-Curves is fulfilled. */
return;
@@ -2028,7 +2028,7 @@ static void rna_def_action_slot(BlenderRNA *brna)
"Slot Handle",
"Number specific to this Slot, unique within the Action.\n"
"This is used, for example, on a ActionKeyframeStrip to look up the "
"ActionChannelBag for this Slot");
"ActionChannelbag for this Slot");
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "slot_flags", int(animrig::Slot::Flags::Active));
@@ -2154,8 +2154,8 @@ static void rna_def_keyframestrip_channelbags(BlenderRNA *brna, PropertyRNA *cpr
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "ActionChannelBags");
srna = RNA_def_struct(brna, "ActionChannelBags", nullptr);
RNA_def_property_srna(cprop, "ActionChannelbags");
srna = RNA_def_struct(brna, "ActionChannelbags", nullptr);
RNA_def_struct_sdna(srna, "ActionStrip");
RNA_def_struct_ui_text(
srna,
@@ -2163,7 +2163,7 @@ static void rna_def_keyframestrip_channelbags(BlenderRNA *brna, PropertyRNA *cpr
"For each action slot, a list of animation channels that are meant for that slot");
/* Strip.channelbags.new(slot=...) */
func = RNA_def_function(srna, "new", "rna_ChannelBags_new");
func = RNA_def_function(srna, "new", "rna_Channelbags_new");
RNA_def_function_ui_description(
func,
"Add a new channelbag to the strip, to contain animation channels for a specific slot");
@@ -2176,14 +2176,14 @@ static void rna_def_keyframestrip_channelbags(BlenderRNA *brna, PropertyRNA *cpr
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
/* Return value. */
parm = RNA_def_pointer(func, "channelbag", "ActionChannelBag", "", "Newly created channelbag");
parm = RNA_def_pointer(func, "channelbag", "ActionChannelbag", "", "Newly created channelbag");
RNA_def_function_return(func, parm);
/* Strip.channelbags.remove(strip) */
func = RNA_def_function(srna, "remove", "rna_ChannelBags_remove");
func = RNA_def_function(srna, "remove", "rna_Channelbags_remove");
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove the channelbag from the strip");
parm = RNA_def_pointer(func, "channelbag", "ActionChannelBag", "", "The channelbag to remove");
parm = RNA_def_pointer(func, "channelbag", "ActionChannelbag", "", "The channelbag to remove");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED | PARM_RNAPTR);
}
@@ -2201,7 +2201,7 @@ static void rna_def_action_keyframe_strip(BlenderRNA *brna)
RNA_def_struct_sdna_from(srna, "ActionStrip", nullptr);
prop = RNA_def_property(srna, "channelbags", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "ActionChannelBag");
RNA_def_property_struct_type(prop, "ActionChannelbag");
RNA_def_property_collection_funcs(prop,
"rna_iterator_keyframestrip_channelbags_begin",
"rna_iterator_array_next",
@@ -2220,7 +2220,7 @@ static void rna_def_action_keyframe_strip(BlenderRNA *brna)
/* Strip.channels(...). */
func = RNA_def_function(srna, "channels", "rna_ActionStrip_channels");
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
RNA_def_function_ui_description(func, "Find the ActionChannelBag for a specific Slot");
RNA_def_function_ui_description(func, "Find the ActionChannelbag for a specific Slot");
parm = RNA_def_int(func,
"slot_handle",
0,
@@ -2231,7 +2231,7 @@ static void rna_def_action_keyframe_strip(BlenderRNA *brna)
0,
INT_MAX);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_pointer(func, "channels", "ActionChannelBag", "Channels", "");
parm = RNA_def_pointer(func, "channels", "ActionChannelbag", "Channels", "");
RNA_def_function_return(func, parm);
/* Strip.key_insert(...). */
@@ -2324,21 +2324,21 @@ static void rna_def_channelbag_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "ActionChannelBagFCurves");
srna = RNA_def_struct(brna, "ActionChannelBagFCurves", nullptr);
RNA_def_struct_sdna(srna, "ActionChannelBag");
RNA_def_property_srna(cprop, "ActionChannelbagFCurves");
srna = RNA_def_struct(brna, "ActionChannelbagFCurves", nullptr);
RNA_def_struct_sdna(srna, "ActionChannelbag");
RNA_def_struct_ui_text(
srna, "F-Curves", "Collection of F-Curves for a specific action slot, on a specific strip");
/* ChannelBag.fcurves.new(...) */
extern FCurve *ActionChannelBagFCurves_new_func(ID * _selfid,
ActionChannelBag * _self,
/* Channelbag.fcurves.new(...) */
extern FCurve *ActionChannelbagFCurves_new_func(ID * _selfid,
ActionChannelbag * _self,
Main * bmain,
ReportList * reports,
const char *data_path,
int index);
func = RNA_def_function(srna, "new", "rna_ChannelBag_fcurve_new");
func = RNA_def_function(srna, "new", "rna_Channelbag_fcurve_new");
RNA_def_function_ui_description(func, "Add an F-Curve to the channelbag");
RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
parm = RNA_def_string(func, "data_path", nullptr, 0, "Data Path", "F-Curve data path to use");
@@ -2348,8 +2348,8 @@ static void rna_def_channelbag_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created F-Curve");
RNA_def_function_return(func, parm);
/* ChannelBag.fcurves.find(...) */
func = RNA_def_function(srna, "find", "rna_ChannelBag_fcurve_find");
/* Channelbag.fcurves.find(...) */
func = RNA_def_function(srna, "find", "rna_Channelbag_fcurve_find");
RNA_def_function_ui_description(
func,
"Find an F-Curve. Note that this function performs a linear scan "
@@ -2362,16 +2362,16 @@ static void rna_def_channelbag_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
RNA_def_function_return(func, parm);
/* ChannelBag.fcurves.remove(...) */
func = RNA_def_function(srna, "remove", "rna_ChannelBag_fcurve_remove");
/* Channelbag.fcurves.remove(...) */
func = RNA_def_function(srna, "remove", "rna_Channelbag_fcurve_remove");
RNA_def_function_ui_description(func, "Remove F-Curve");
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
/* ChannelBag.fcurves.clear() */
func = RNA_def_function(srna, "clear", "rna_ChannelBag_fcurve_clear");
/* Channelbag.fcurves.clear() */
func = RNA_def_function(srna, "clear", "rna_Channelbag_fcurve_clear");
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_SELF_ID);
RNA_def_function_ui_description(func, "Remove all F-Curves from this channelbag");
}
@@ -2383,12 +2383,12 @@ static void rna_def_channelbag_groups(BlenderRNA *brna, PropertyRNA *cprop)
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_property_srna(cprop, "ActionChannelBagGroups");
srna = RNA_def_struct(brna, "ActionChannelBagGroups", nullptr);
RNA_def_struct_sdna(srna, "ActionChannelBag");
RNA_def_property_srna(cprop, "ActionChannelbagGroups");
srna = RNA_def_struct(brna, "ActionChannelbagGroups", nullptr);
RNA_def_struct_sdna(srna, "ActionChannelbag");
RNA_def_struct_ui_text(srna, "F-Curve Groups", "Collection of f-curve groups");
func = RNA_def_function(srna, "new", "rna_ChannelBag_group_new");
func = RNA_def_function(srna, "new", "rna_Channelbag_group_new");
RNA_def_function_flag(func, FunctionFlag(0));
RNA_def_function_ui_description(func, "Create a new action group and add it to the action");
parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the action group");
@@ -2396,7 +2396,7 @@ static void rna_def_channelbag_groups(BlenderRNA *brna, PropertyRNA *cprop)
parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "rna_ChannelBag_group_remove");
func = RNA_def_function(srna, "remove", "rna_Channelbag_group_remove");
RNA_def_function_ui_description(func, "Remove action group");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove");
@@ -2409,24 +2409,24 @@ static void rna_def_action_channelbag(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ActionChannelBag", nullptr);
srna = RNA_def_struct(brna, "ActionChannelbag", nullptr);
RNA_def_struct_ui_text(
srna,
"Animation Channel Bag",
"Collection of animation channels, typically associated with an action slot");
RNA_def_struct_path_func(srna, "rna_ChannelBag_path");
RNA_def_struct_path_func(srna, "rna_Channelbag_path");
prop = RNA_def_property(srna, "slot_handle", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
/* ChannelBag.fcurves */
/* Channelbag.fcurves */
prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop,
"rna_iterator_ChannelBag_fcurves_begin",
"rna_iterator_Channelbag_fcurves_begin",
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_dereference_get",
"rna_iterator_ChannelBag_fcurves_length",
"rna_iterator_Channelbag_fcurves_length",
nullptr,
nullptr,
nullptr);
@@ -2434,14 +2434,14 @@ static void rna_def_action_channelbag(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that animate the slot");
rna_def_channelbag_fcurves(brna, prop);
/* ChannelBag.groups */
/* Channelbag.groups */
prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop,
"rna_iterator_ChannelBag_groups_begin",
"rna_iterator_Channelbag_groups_begin",
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_dereference_get",
"rna_iterator_ChannelBag_groups_length",
"rna_iterator_Channelbag_groups_length",
nullptr,
nullptr,
nullptr);

View File

@@ -676,10 +676,10 @@ static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value, ReportList *
/* Layered action. */
bActionGroup *group = static_cast<bActionGroup *>(value.data);
BLI_assert(group->channel_bag != nullptr);
blender::animrig::ChannelBag &channel_bag = group->channel_bag->wrap();
BLI_assert(group->channelbag != nullptr);
blender::animrig::Channelbag &channelbag = group->channelbag->wrap();
if (!channel_bag.fcurve_assign_to_channel_group(*fcu, *group)) {
if (!channelbag.fcurve_assign_to_channel_group(*fcu, *group)) {
printf(
"ERROR: F-Curve (datapath: '%s') doesn't belong to the same channel bag as "
"channel group '%s'\n",

View File

@@ -27,12 +27,12 @@ void SEQ_offset_animdata(Scene *scene, Sequence *seq, int ofs);
*/
bool SEQ_fcurve_matches(const Sequence &seq, const FCurve &fcurve);
struct SeqAnimationBackup {
/* `curves` and `channel_bag` here represent effectively the same data (the
/* `curves` and `channelbag` here represent effectively the same data (the
* fcurves that animate the Scene that the sequence belongs to), just for
* legacy and layered actions, respectively. Therefore only one or the other
* should ever have data stored in them, never both. */
ListBase curves;
blender::animrig::ChannelBag channel_bag;
blender::animrig::Channelbag channelbag;
ListBase drivers;
};

View File

@@ -100,10 +100,10 @@ void SEQ_animation_backup_original(Scene *scene, SeqAnimationBackup *backup)
if (action.is_action_legacy()) {
BLI_movelisttolist(&backup->curves, &scene->adt->action->curves);
}
else if (animrig::ChannelBag *channel_bag = animrig::channelbag_for_action_slot(
else if (animrig::Channelbag *channelbag = animrig::channelbag_for_action_slot(
action, scene->adt->slot_handle))
{
animrig::channelbag_fcurves_move(backup->channel_bag, *channel_bag);
animrig::channelbag_fcurves_move(backup->channelbag, *channelbag);
}
}
@@ -114,7 +114,7 @@ void SEQ_animation_backup_original(Scene *scene, SeqAnimationBackup *backup)
void SEQ_animation_restore_original(Scene *scene, SeqAnimationBackup *backup)
{
if (!BLI_listbase_is_empty(&backup->curves) || !backup->channel_bag.fcurves().is_empty()) {
if (!BLI_listbase_is_empty(&backup->curves) || !backup->channelbag.fcurves().is_empty()) {
BLI_assert(scene->adt != nullptr && scene->adt->action != nullptr);
animrig::Action &action = scene->adt->action->wrap();
@@ -125,13 +125,13 @@ void SEQ_animation_restore_original(Scene *scene, SeqAnimationBackup *backup)
BLI_movelisttolist(&scene->adt->action->curves, &backup->curves);
}
else {
animrig::ChannelBag *channel_bag = animrig::channelbag_for_action_slot(
animrig::Channelbag *channelbag = animrig::channelbag_for_action_slot(
action, scene->adt->slot_handle);
/* The channel bag should exist if we got here, because otherwise the
* backup channel bag would have been empty. */
BLI_assert(channel_bag != nullptr);
BLI_assert(channelbag != nullptr);
animrig::channelbag_fcurves_move(*channel_bag, backup->channel_bag);
animrig::channelbag_fcurves_move(*channelbag, backup->channelbag);
}
}
@@ -156,12 +156,12 @@ static void seq_animation_duplicate(Sequence *seq,
}
Vector<FCurve *> fcurves = {};
BLI_assert_msg(BLI_listbase_is_empty(&src->curves) || src->channel_bag.fcurves().is_empty(),
BLI_assert_msg(BLI_listbase_is_empty(&src->curves) || src->channelbag.fcurves().is_empty(),
"SeqAnimationBackup has fcurves for both legacy and layered actions, which "
"should never happen.");
if (BLI_listbase_is_empty(&src->curves)) {
fcurves = animrig::fcurves_in_span_filtered(
src->channel_bag.fcurves(),
src->channelbag.fcurves(),
[&](const FCurve &fcurve) { return SEQ_fcurve_matches(*seq, fcurve); });
}
else {
@@ -210,7 +210,7 @@ void SEQ_animation_duplicate_backup_to_scene(Scene *scene,
{
BLI_assert(scene != nullptr);
if (!BLI_listbase_is_empty(&backup->curves) || !backup->channel_bag.fcurves().is_empty()) {
if (!BLI_listbase_is_empty(&backup->curves) || !backup->channelbag.fcurves().is_empty()) {
BLI_assert(scene->adt != nullptr);
BLI_assert(scene->adt->action != nullptr);
seq_animation_duplicate(seq, scene->adt->action->wrap(), scene->adt->slot_handle, backup);

View File

@@ -208,7 +208,7 @@ class LegacyAPIOnLayeredActionTest(unittest.TestCase):
strip = layer.strips.new(type='KEYFRAME')
channelbag = strip.channelbags.new(slot=slot)
# Create new F-Curves via legacy API, they should be stored on the ChannelBag.
# Create new F-Curves via legacy API, they should be stored on the Channelbag.
fcurve1 = self.action.fcurves.new("scale", index=1)
fcurve2 = self.action.fcurves.new("scale", index=2)
self.assertEqual([fcurve1, fcurve2], channelbag.fcurves[:], "Expected two F-Curves after creating them")
@@ -246,7 +246,7 @@ class LegacyAPIOnLayeredActionTest(unittest.TestCase):
self.assertEqual([], self.action.layers[:])
def test_fcurves_new_on_empty_action(self) -> None:
# Create new F-Curves via legacy API, this should create a layer+strip+ChannelBag.
# Create new F-Curves via legacy API, this should create a layer+strip+Channelbag.
fcurve1 = self.action.fcurves.new("scale", index=1)
fcurve2 = self.action.fcurves.new("scale", index=2)
@@ -294,7 +294,7 @@ class LegacyAPIOnLayeredActionTest(unittest.TestCase):
self.assertNotIn(group, channelbag.groups[:], "A group should be removable via the legacy API")
class ChannelBagsTest(unittest.TestCase):
class ChannelbagsTest(unittest.TestCase):
def setUp(self):
anims = bpy.data.actions
while anims: