[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37097] branches/soc-2011-pepper/source/ blender/editors/animation: Deleting keyframes usability tweak:

Joshua Leung aligorith at gmail.com
Thu Jun 2 14:21:56 CEST 2011


Revision: 37097
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37097
Author:   aligorith
Date:     2011-06-02 12:21:55 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
Deleting keyframes usability tweak:
There won't be dangling "empty" actions left behind anymore in the
DopeSheet channel list after you've deleted all their keyframes (and
don't want to add keyframes to them anymore).

Of course, this poses problems with more actions getting created if
you then go and keyframe those objects again. If this does turn out to
be an equally bad problem, then another approach from the channel
filtering code side (probably aided by the restructed code) will help
(though doesn't solve the problem where people complain of having
heaps of "empty" actions dangling from objects they no longer want
animated).

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
    branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c

Modified: branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c	2011-06-02 11:58:13 UTC (rev 37096)
+++ branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c	2011-06-02 12:21:55 UTC (rev 37097)
@@ -515,12 +515,34 @@
 	 *	- Drivers
 	 *	- TODO... some others?
 	 */
-	if (fcu->grp)
-		action_groups_remove_channel(adt->action, fcu);
-	else if ((ac) && (ac->datatype == ANIMCONT_DRIVERS))
+	if ((ac) && (ac->datatype == ANIMCONT_DRIVERS)) {
+		/* driver F-Curve */
 		BLI_remlink(&adt->drivers, fcu);
-	else if (adt->action)
-		BLI_remlink(&adt->action->curves, fcu);
+	}
+	else if (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 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.
+		 *
+		 * This is done so that we don't have dangling Object+Action entries in
+		 * 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);
+			adt->action = NULL;
+		}
+	}
 		
 	/* free the F-Curve itself */
 	free_fcurve(fcu);

Modified: branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c	2011-06-02 11:58:13 UTC (rev 37096)
+++ branches/soc-2011-pepper/source/blender/editors/animation/keyframes_general.c	2011-06-02 12:21:55 UTC (rev 37097)
@@ -111,7 +111,7 @@
 {
 	int i;
 	
-	if(fcu->bezt==NULL) /* ignore baked curves */
+	if (fcu->bezt==NULL) /* ignore baked curves */
 		return;
 
 	/* Delete selected BezTriples */
@@ -124,7 +124,7 @@
 	}
 	
 	/* Free the array of BezTriples if there are not keyframes */
-	if(fcu->totvert == 0)
+	if (fcu->totvert == 0)
 		clear_fcurve_keys(fcu);
 }
 




More information about the Bf-blender-cvs mailing list