Fix: channel groups in duplicated channel bag point to old bag

In layered actions, the channel groups in a channel bag hold a
non-owning pointer to the channel bag they belong to, to allow looking
up the fcurves in the group. However, when a duplicate was made of a
channel bag, those pointers in the (also duplicated) channel groups
weren't updated to point at it, and thus were still pointing at the
original channel bag.

This commit adds the code to properly update those pointers when
duplicating channel bags.

Pull Request: https://projects.blender.org/blender/blender/pulls/126923
This commit is contained in:
Nathan Vegdahl
2024-08-29 14:33:51 +02:00
committed by Nathan Vegdahl
parent 743e24a86b
commit 73c1ceb18b

View File

@@ -1394,6 +1394,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;
}
}