Fix T103809: Using Preview Range Breaks Normalized FCurve Display

When using the "normalized" display of FCurves in the
Graph Editor, and also turning on the preview range,
the normalized display would break.

The preview frame range was assumed to be bezt indices,
which is only true when every frame has a key.

Reviewed by: Colin Basnett
Differential Revision: https://developer.blender.org/D16987
Ref: D16987
This commit is contained in:
Christoph Lendenfeld
2023-01-19 14:38:49 +01:00
parent 320757bc61
commit 203bacbe4a

View File

@@ -343,8 +343,12 @@ static void fcurve_scene_coord_range_get(Scene *scene,
int end = fcu->totvert;
if (use_preview_only) {
start = scene->r.psfra;
end = min_ii(scene->r.pefra + 1, fcu->totvert);
/* Preview frame ranges need to be converted to bezt array indices. */
bool replace = false;
start = BKE_fcurve_bezt_binarysearch_index(
fcu->bezt, scene->r.psfra, fcu->totvert, &replace);
end = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, scene->r.pefra, fcu->totvert, &replace);
}
if (fcu->bezt) {