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.
This commit is contained in:
@@ -472,11 +472,7 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
|
||||
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 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,10 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo
|
||||
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 @@ void GRAPH_OT_previewrange_set (wmOperatorType *ot)
|
||||
|
||||
/* 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 @@ void GRAPH_OT_view_all (wmOperatorType *ot)
|
||||
|
||||
/* 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 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
|
||||
/* 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 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user