[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34316] trunk/blender/source/blender: Bugfix [#25617] HOME Key in fcurve editor doesn't center properly

Joshua Leung aligorith at gmail.com
Fri Jan 14 06:19:05 CET 2011


Revision: 34316
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34316
Author:   aligorith
Date:     2011-01-14 05:19:04 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
Bugfix [#25617] HOME Key in fcurve editor doesn't center properly

* When euler-rotation F-Curves had a single keyframe only, the view
would be artifically extended to fill up to 57 (this comes from the
radians to degrees calculations) due to a combination of the bounds-
finding function enforcing a minimum separation of 1 unit between
min/max. This has now been moved to the operator-level where it gets
applied AFTER these conversions have taken effect

* F-Curves with samples only (i.e. baked F-Curves) would be ignored by
these operators. Was caused by using a poll calback that only
considered whether there were keyframes. Hopefully this is sufficient;
otherwise a hybrid poll method will be needed.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/fcurve.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c

Modified: trunk/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/fcurve.c	2011-01-14 02:06:35 UTC (rev 34315)
+++ trunk/blender/source/blender/blenkernel/intern/fcurve.c	2011-01-14 05:19:04 UTC (rev 34316)
@@ -472,11 +472,7 @@
 		foundvert=1;
 	}
 	
-	/* minimum sizes are 1.0f */
 	if (foundvert) {
-		if (xminv == xmaxv) xmaxv += 1.0f;
-		if (yminv == ymaxv) ymaxv += 1.0f;
-		
 		if (xmin) *xmin= xminv;
 		if (xmax) *xmax= xmaxv;
 		
@@ -484,10 +480,13 @@
 		if (ymax) *ymax= ymaxv;
 	}
 	else {
+		if (G.f & G_DEBUG)
+			printf("F-Curve calc bounds didn't find anything, so assuming minimum bounds of 1.0\n");
+			
 		if (xmin) *xmin= 0.0f;
-		if (xmax) *xmax= 0.0f;
+		if (xmax) *xmax= 1.0f;
 		
-		if (ymin) *ymin= 1.0f;
+		if (ymin) *ymin= 0.0f;
 		if (ymax) *ymax= 1.0f;
 	}
 }

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c	2011-01-14 02:06:35 UTC (rev 34315)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c	2011-01-14 05:19:04 UTC (rev 34316)
@@ -121,6 +121,10 @@
 			if ((ymax) && (tymax > *ymax)) 		*ymax= tymax;
 		}
 		
+		/* ensure that the extents are not too extreme that view implodes...*/
+		if ((xmin && xmax) && (fabs(*xmax - *xmin) < 0.1)) *xmax += 0.1;
+		if ((ymin && ymax) && (fabs(*ymax - *ymin) < 0.1)) *ymax += 0.1;
+		
 		/* free memory */
 		BLI_freelistN(&anim_data);
 	}
@@ -177,7 +181,7 @@
 	
 	/* api callbacks */
 	ot->exec= graphkeys_previewrange_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->poll= ED_operator_ipo_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -225,7 +229,7 @@
 	
 	/* api callbacks */
 	ot->exec= graphkeys_viewall_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->poll= ED_operator_ipo_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
 	
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1962,7 +1966,7 @@
 	/* filter data */
 	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
 	if (RNA_boolean_get(op->ptr, "only_active"))
-		filter |= ANIMFILTER_ACTIVE;
+		filter |= ANIMFILTER_ACTIVE; // FIXME: enforce in this case only a single channel to get handled?
 	else
 		filter |= (ANIMFILTER_SEL|ANIMFILTER_CURVEVISIBLE);
 	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@ -1976,7 +1980,7 @@
 		fcm= add_fmodifier(&fcu->modifiers, type);
 		if (fcm)
 			set_active_fmodifier(&fcu->modifiers, fcm);
-		else { // TODO: stop when this happens?
+		else {
 			BKE_report(op->reports, RPT_ERROR, "Modifier couldn't be added. See console for details.");
 			break;
 		}




More information about the Bf-blender-cvs mailing list