Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation/anim_draw.c')
-rw-r--r--source/blender/editors/animation/anim_draw.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 61bf7f95340..7ab50afe3a1 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -422,23 +422,16 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
}
else {
const BezTriple *prev_bezt = bezt - 1;
- if (prev_bezt->ipo == BEZT_IPO_CONST) {
- /* Constant interpolation: previous CV value is used up
- * to the current keyframe.
- */
- max_coord = max_ff(max_coord, bezt->vec[1][1]);
- min_coord = min_ff(min_coord, bezt->vec[1][1]);
- }
- else if (prev_bezt->ipo == BEZT_IPO_LIN) {
- /* Linear interpolation: min/max using both previous and
- * and current CV.
+ if (!ELEM(prev_bezt->ipo, BEZT_IPO_BEZ, BEZT_IPO_BACK, BEZT_IPO_ELASTIC)) {
+ /* The points on the curve will lie inside the start and end points.
+ * Calculate min/max using both previous and current CV.
*/
max_coord = max_ff(max_coord, bezt->vec[1][1]);
min_coord = min_ff(min_coord, bezt->vec[1][1]);
max_coord = max_ff(max_coord, prev_bezt->vec[1][1]);
min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
}
- else if (prev_bezt->ipo == BEZT_IPO_BEZ) {
+ else {
const int resol = fcu->driver ?
32 :
min_ii((int)(5.0f * len_v2v2(bezt->vec[1], prev_bezt->vec[1])),
@@ -448,30 +441,12 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
}
else {
- float data[120];
- float v1[2], v2[2], v3[2], v4[2];
-
- v1[0] = prev_bezt->vec[1][0];
- v1[1] = prev_bezt->vec[1][1];
- v2[0] = prev_bezt->vec[2][0];
- v2[1] = prev_bezt->vec[2][1];
-
- v3[0] = bezt->vec[0][0];
- v3[1] = bezt->vec[0][1];
- v4[0] = bezt->vec[1][0];
- v4[1] = bezt->vec[1][1];
-
- correct_bezpart(v1, v2, v3, v4);
-
- BKE_curve_forward_diff_bezier(
- v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float) * 3);
- BKE_curve_forward_diff_bezier(
- v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float) * 3);
-
+ float step_size = (bezt->vec[1][0] - prev_bezt->vec[1][0]) / resol;
for (int j = 0; j <= resol; ++j) {
- const float *fp = &data[j * 3];
- max_coord = max_ff(max_coord, fp[1]);
- min_coord = min_ff(min_coord, fp[1]);
+ float eval_time = prev_bezt->vec[1][0] + step_size * j;
+ float eval_value = evaluate_fcurve_only_curve(fcu, eval_time);
+ max_coord = max_ff(max_coord, eval_value);
+ min_coord = min_ff(min_coord, eval_value);
}
}
}