[Bf-blender-cvs] [203bacbe4ac] master: Fix T103809: Using Preview Range Breaks Normalized FCurve Display

Christoph Lendenfeld noreply at git.blender.org
Thu Jan 19 14:38:57 CET 2023


Commit: 203bacbe4acc26060fa0a6703dcef2ab87e8b7d9
Author: Christoph Lendenfeld
Date:   Thu Jan 19 14:38:49 2023 +0100
Branches: master
https://developer.blender.org/rB203bacbe4acc26060fa0a6703dcef2ab87e8b7d9

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

===================================================================

M	source/blender/editors/animation/anim_draw.c

===================================================================

diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 329bc2b46eb..779b63d7e9b 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -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) {



More information about the Bf-blender-cvs mailing list