Anim: change DNA name channelbags_array to singular channelbag_array

All the arrays in the new Action DNA are named singularly (`layer_array`,
`fcurve_array` etc). `channelbags_array` was the only plural one. For
consistency, this is now also singular.

Note that this is a backward-incompatible change, and will effectively
erase all animation from layered Actions. No effort is taken to handle this
rename as the feature is still in its experimental phase.

Action and slot assignments are not affected by this change.

Apart from the lack of backward compatibility, no functional changes are
expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/124768
This commit is contained in:
Sybren A. Stüvel
2024-07-16 13:24:23 +02:00
parent 41a61aa4aa
commit cf2dcc792c
3 changed files with 18 additions and 18 deletions

View File

@@ -977,11 +977,11 @@ KeyframeStrip::KeyframeStrip(const KeyframeStrip &other)
{
memcpy(this, &other, sizeof(*this));
this->channelbags_array = MEM_cnew_array<ActionChannelBag *>(other.channelbags_array_num,
__func__);
this->channelbag_array = MEM_cnew_array<ActionChannelBag *>(other.channelbag_array_num,
__func__);
Span<const ChannelBag *> channelbags_src = other.channelbags();
for (int i : channelbags_src.index_range()) {
this->channelbags_array[i] = MEM_new<animrig::ChannelBag>(__func__, *other.channelbag(i));
this->channelbag_array[i] = MEM_new<animrig::ChannelBag>(__func__, *other.channelbag(i));
}
}
@@ -990,8 +990,8 @@ KeyframeStrip::~KeyframeStrip()
for (ChannelBag *channelbag_for_slot : this->channelbags()) {
MEM_delete(channelbag_for_slot);
}
MEM_SAFE_FREE(this->channelbags_array);
this->channelbags_array_num = 0;
MEM_SAFE_FREE(this->channelbag_array);
this->channelbag_array_num = 0;
}
template<> bool Strip::is<KeyframeStrip>() const
@@ -1018,21 +1018,21 @@ KeyframeStrip::operator Strip &()
blender::Span<const ChannelBag *> KeyframeStrip::channelbags() const
{
return blender::Span<ChannelBag *>{reinterpret_cast<ChannelBag **>(this->channelbags_array),
this->channelbags_array_num};
return blender::Span<ChannelBag *>{reinterpret_cast<ChannelBag **>(this->channelbag_array),
this->channelbag_array_num};
}
blender::MutableSpan<ChannelBag *> KeyframeStrip::channelbags()
{
return blender::MutableSpan<ChannelBag *>{
reinterpret_cast<ChannelBag **>(this->channelbags_array), this->channelbags_array_num};
reinterpret_cast<ChannelBag **>(this->channelbag_array), this->channelbag_array_num};
}
const ChannelBag *KeyframeStrip::channelbag(const int64_t index) const
{
return &this->channelbags_array[index]->wrap();
return &this->channelbag_array[index]->wrap();
}
ChannelBag *KeyframeStrip::channelbag(const int64_t index)
{
return &this->channelbags_array[index]->wrap();
return &this->channelbag_array[index]->wrap();
}
const ChannelBag *KeyframeStrip::channelbag_for_slot(const slot_handle_t slot_handle) const
{
@@ -1067,7 +1067,7 @@ ChannelBag &KeyframeStrip::channelbag_for_slot_add(const Slot &slot)
channels.slot_handle = slot.handle;
grow_array_and_append<ActionChannelBag *>(
&this->channelbags_array, &this->channelbags_array_num, &channels);
&this->channelbag_array, &this->channelbag_array_num, &channels);
return channels;
}
@@ -1536,7 +1536,7 @@ Action *convert_to_layered_action(Main &bmain, const Action &legacy_action)
Slot &slot = converted_action.slot_add();
Layer &layer = converted_action.layer_add(legacy_action.id.name);
KeyframeStrip &strip = layer.strip_add<KeyframeStrip>();
BLI_assert(strip.channelbags_array_num == 0);
BLI_assert(strip.channelbag_array_num == 0);
ChannelBag *bag = &strip.channelbag_for_slot_add(slot);
const int fcu_count = BLI_listbase_count(&legacy_action.curves);

View File

@@ -387,11 +387,11 @@ static void read_channelbag(BlendDataReader *reader, animrig::ChannelBag &channe
static void read_keyframe_strip(BlendDataReader *reader, animrig::KeyframeStrip &strip)
{
BLO_read_pointer_array(reader, reinterpret_cast<void **>(&strip.channelbags_array));
BLO_read_pointer_array(reader, reinterpret_cast<void **>(&strip.channelbag_array));
for (int i = 0; i < strip.channelbags_array_num; i++) {
BLO_read_struct(reader, ActionChannelBag, &strip.channelbags_array[i]);
ActionChannelBag *channelbag = strip.channelbags_array[i];
for (int i = 0; i < strip.channelbag_array_num; i++) {
BLO_read_struct(reader, ActionChannelBag, &strip.channelbag_array[i]);
ActionChannelBag *channelbag = strip.channelbag_array[i];
read_channelbag(reader, channelbag->wrap());
}
}

View File

@@ -1200,8 +1200,8 @@ typedef struct ActionStrip {
typedef struct KeyframeActionStrip {
ActionStrip strip;
struct ActionChannelBag **channelbags_array;
int channelbags_array_num;
struct ActionChannelBag **channelbag_array;
int channelbag_array_num;
uint8_t _pad[4];