[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53052] trunk/blender/source/blender/ editors/animation/anim_channels_edit.c: Bugfix #33541 - Deleting all keyframes leaves dangling action groups

Joshua Leung aligorith at gmail.com
Sun Dec 16 07:30:25 CET 2012


Revision: 53052
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53052
Author:   aligorith
Date:     2012-12-16 06:30:17 +0000 (Sun, 16 Dec 2012)
Log Message:
-----------
Bugfix #33541 - Deleting all keyframes leaves dangling action groups

When deleting all keyframes in F-Curves, the corresponding F-Curves are deleted.
If all the F-Curves in an action group were deleted in such a way, the group
wouldn't be removed. This meant that these groups would never be shown (until
F-Curves for these groups were created again), but would still exist, causing
problems when trying to rearrange groups in the animation editors (i.e. groups
would appear to not move). Now these groups get deleted when they get empty.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c

Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2012-12-16 05:48:27 UTC (rev 53051)
+++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2012-12-16 06:30:17 UTC (rev 53052)
@@ -538,12 +538,26 @@
 		BLI_remlink(&adt->drivers, fcu);
 	}
 	else if (adt->action) {
+		bAction *act = adt->action;
+		
 		/* remove from group or action, whichever one "owns" the F-Curve */
-		if (fcu->grp)
-			action_groups_remove_channel(adt->action, fcu);
-		else
-			BLI_remlink(&adt->action->curves, fcu);
+		if (fcu->grp) {
+			bActionGroup *agrp = fcu->grp;
 			
+			/* remove F-Curve from group+action */
+			action_groups_remove_channel(act, fcu);
+			
+			/* if group has no more channels, remove it too, 
+			 * otherwise can have many dangling groups [#33541]
+			 */
+			if (agrp->channels.first == NULL) {
+				BLI_freelinkN(&act->groups, agrp);
+			}
+		}
+		else {
+			BLI_remlink(&act->curves, fcu);
+		}
+		
 		/* if action has no more F-Curves as a result of this, unlink it from
 		 * AnimData if it did not come from a NLA Strip being tweaked.
 		 *
@@ -551,12 +565,8 @@
 		 * channel list that are empty, and linger around long after the data they
 		 * are for has disappeared (and probably won't come back).
 		 */
-		// XXX: does everybody always want this?
-		/* XXX: there's a problem where many actions could build up in the file if multiple
-		 * full add/delete cycles are performed on the same objects, but assume that this is rare
-		 */
-		if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
-			id_us_min(&adt->action->id);
+		if ((act->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
+			id_us_min(&act->id);
 			adt->action = NULL;
 		}
 	}




More information about the Bf-blender-cvs mailing list