[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18887] branches/blender2.5/blender/source /blender: Keyframe-related bugfixes:

Joshua Leung aligorith at gmail.com
Mon Feb 9 12:05:35 CET 2009


Revision: 18887
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18887
Author:   aligorith
Date:     2009-02-09 12:05:34 +0100 (Mon, 09 Feb 2009)

Log Message:
-----------
Keyframe-related bugfixes:

* Deleting keyframes should be safer now
* Graph Editor no longer crashes on F-Curves with no keyframes/samples
* Silenced console prints that occurred when an F-Curve had now keyframes.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/action.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/action.c	2009-02-09 10:33:05 UTC (rev 18886)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/action.c	2009-02-09 11:05:34 UTC (rev 18887)
@@ -313,10 +313,14 @@
 	}
 	
 	/* only if added, set channel as belonging to this group */
-	if (done)
+	if (done) {
+		//printf("FCurve added to group \n");
 		fcurve->grp= agrp;
-	else 
+	}
+	else {
 		printf("Error: FCurve '%s' couldn't be added to Group '%s' \n", fcurve->rna_path, agrp->name);
+		BLI_addtail(&act->curves, fcurve);
+	}
 }	
 
 /* Remove the given channel from all groups */

Modified: branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c	2009-02-09 10:33:05 UTC (rev 18886)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c	2009-02-09 11:05:34 UTC (rev 18887)
@@ -103,6 +103,13 @@
 		}
 	}
 	
+	/* Free the array of BezTriples if there are not keyframes */
+	if (fcu->totvert == 0) {
+		if (fcu->bezt) 
+			MEM_freeN(fcu->bezt);
+		fcu->bezt= NULL;
+	}
+	
 #if 0 // XXX for now, we don't get rid of empty curves...
 	/* Only delete if there isn't an ipo-driver still hanging around on an empty curve */
 	if ((icu->totvert==0) && (icu->driver==NULL)) {

Modified: branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframing.c	2009-02-09 10:33:05 UTC (rev 18886)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframing.c	2009-02-09 11:05:34 UTC (rev 18887)
@@ -2267,7 +2267,7 @@
 	 */
 	for (fcu= act->curves.first; fcu; fcu= fcu->next) {
 		/* only check if there are keyframes (currently only of type BezTriple) */
-		if (fcu->bezt) {
+		if (fcu->bezt && fcu->totvert) {
 			/* we either include all regardless of muting, or only non-muted  */
 			if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED)==0) {
 				short replace = -1;

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-02-09 10:33:05 UTC (rev 18886)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-02-09 11:05:34 UTC (rev 18887)
@@ -632,15 +632,17 @@
 			ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 0); 
 		
 		/* draw curve - we currently calculate colour on the fly, but that should probably be done in advance instead */
-		col= ipo_rainbow(i, items);
-		cpack(col);
+		if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { 
+			col= ipo_rainbow(i, items);
+			cpack(col);
+			
+			draw_fcurve_repeat(fcu, &ar->v2d, 0, 0, &fac); // XXX this call still needs a lot more work
+			
+			/* draw handles and vertices as appropriate */
+			draw_fcurve_handles(sipo, ar, fcu);
+			draw_fcurve_vertices(sipo, ar, fcu);
+		}
 		
-		draw_fcurve_repeat(fcu, &ar->v2d, 0, 0, &fac); // XXX this call still needs a lot more work
-		
-		/* draw handles and vertices as appropriate */
-		draw_fcurve_handles(sipo, ar, fcu);
-		draw_fcurve_vertices(sipo, ar, fcu);
-		
 		/* undo mapping of keyframes for drawing if scaled F-Curve */
 		if (nob)
 			ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 0); 





More information about the Bf-blender-cvs mailing list