From 7830ea29c2ea6c30cec1dcd6d6c11a1f228e9cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 17 Dec 2019 15:20:11 +0100 Subject: Fix T68665: FCurve group disappear on Curve/Surface object data When going from EDIT to OBJECT mode, Blender updates the object data from the edit-mode data. This took care of renaming FCurves that animate Curve control points when control points are added/removed, but this didn't keep the FCurve groups intact. Since the FCurve groups are tightly connected to the Action channels, it's hard to keep the group pointers intact during this process. Instead of making the code even more complex in an attempt to do that, I implemented a function (`BKE_action_groups_reconstruct()`) that rebuilds the group channel pointers. The call to `action_groups_add_channel()` had to be removed because it updates the the next/prev pointers of the FCurve while we're looping over them, causing infinite loops. --- source/blender/blenkernel/BKE_action.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenkernel/BKE_action.h') diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index fdfea95937b..60d988ab21e 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -122,6 +122,9 @@ void action_groups_add_channel(struct bAction *act, /* Remove the given channel from all groups */ void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu); +/* Reconstruct group channel pointers. */ +void BKE_action_groups_reconstruct(struct bAction *act); + /* Find a group with the given name */ struct bActionGroup *BKE_action_group_find_name(struct bAction *act, const char name[]); -- cgit v1.2.3