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:
authorJoshua Leung <aligorith@gmail.com>2012-05-24 17:52:25 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-24 17:52:25 +0400
commit240babf07423d5efcb85edbe8e8d2571e8e163b8 (patch)
tree79b4a5c932b9eb3e9f3ebf34267f377310bacf82 /source/blender/blenkernel
parent9abd6e76515006214c0bd8d0d412c89baf88a8b1 (diff)
Graph Editor - View All/Selected now includes handles for calculating extents of
F-Curves It is possible to get the old behaviour (handles excluded) by bringing up the Operator Properties (F6) while in the Graph Editor (this doesn't work elsewhere due to the context requirements of this stuff).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h2
-rw-r--r--source/blender/blenkernel/intern/fcurve.c35
2 files changed, 24 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 9dae38d0a65..f7aa4470c19 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -218,7 +218,7 @@ void calc_fcurve_range(struct FCurve *fcu, float *min, float *max,
/* get the bounding-box extents for F-Curve */
void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only);
+ const short do_sel_only, const short include_handles);
/* .............. */
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 2a0f49262bc..e20a74e713c 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -477,7 +477,7 @@ static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple *
/* Calculate the extents of F-Curve's data */
void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only)
+ const short do_sel_only, const short include_handles)
{
float xminv = 999999999.0f, xmaxv = -999999999.0f;
float yminv = 999999999.0f, ymaxv = -999999999.0f;
@@ -495,8 +495,14 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
if (bezt_first) {
BLI_assert(bezt_last != NULL);
- xminv = MIN2(xminv, bezt_first->vec[1][0]);
- xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]);
+ if (include_handles) {
+ xminv = MIN3(xminv, bezt_first->vec[0][0], bezt_first->vec[1][0]);
+ xmaxv = MAX3(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]);
+ }
+ else {
+ xminv = MIN2(xminv, bezt_first->vec[1][0]);
+ xmaxv = MAX2(xmaxv, bezt_last->vec[1][0]);
+ }
}
}
@@ -506,10 +512,15 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {
if ((do_sel_only == FALSE) || BEZSELECTED(bezt)) {
- if (bezt->vec[1][1] < yminv)
- yminv = bezt->vec[1][1];
- if (bezt->vec[1][1] > ymaxv)
- ymaxv = bezt->vec[1][1];
+ if (include_handles) {
+ yminv = MIN4(yminv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
+ ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]);
+ }
+ else {
+ yminv = MIN2(yminv, bezt->vec[1][1]);
+ ymaxv = MAX2(ymaxv, bezt->vec[1][1]);
+ }
+
foundvert = TRUE;
}
}
@@ -531,7 +542,7 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
yminv = fpt->vec[1];
if (fpt->vec[1] > ymaxv)
ymaxv = fpt->vec[1];
-
+
foundvert = TRUE;
}
}
@@ -570,20 +581,20 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end,
/* get endpoint keyframes */
get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only);
-
+
if (bezt_first) {
BLI_assert(bezt_last != NULL);
-
+
min = MIN2(min, bezt_first->vec[1][0]);
max = MAX2(max, bezt_last->vec[1][0]);
-
+
foundvert = TRUE;
}
}
else if (fcu->fpt) {
min = MIN2(min, fcu->fpt[0].vec[0]);
max = MAX2(max, fcu->fpt[fcu->totvert - 1].vec[0]);
-
+
foundvert = TRUE;
}