diff options
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 3529b7b9e6d..737baa1ddc4 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -433,8 +433,7 @@ int binarysearch_bezt_index (BezTriple array[], float frame, int arraylen, short /* ...................................... */ /* helper for calc_fcurve_* functions -> find first and last BezTriple to be used */ -static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple **last, - const short do_sel_only) +static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple **last, const short selOnly) { /* init outputs */ *first = NULL; @@ -445,7 +444,7 @@ static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple return; /* only include selected items? */ - if (do_sel_only) { + if (selOnly) { BezTriple *bezt; unsigned int i; @@ -476,12 +475,11 @@ 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) +void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly) { float xminv=999999999.0f, xmaxv=-999999999.0f; float yminv=999999999.0f, ymaxv=-999999999.0f; - short foundvert= FALSE; + short foundvert=0; unsigned int i; if (fcu->totvert) { @@ -490,7 +488,7 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo if (xmin || xmax) { /* get endpoint keyframes */ - get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); + get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, selOnly); if (bezt_first) { BLI_assert(bezt_last != NULL); @@ -505,12 +503,11 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo BezTriple *bezt; for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) { - if ((do_sel_only == 0) || BEZSELECTED(bezt)) { + if ((selOnly == 0) || BEZSELECTED(bezt)) { if (bezt->vec[1][1] < yminv) yminv= bezt->vec[1][1]; if (bezt->vec[1][1] > ymaxv) ymaxv= bezt->vec[1][1]; - foundvert= TRUE; } } } @@ -531,11 +528,11 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo yminv= fpt->vec[1]; if (fpt->vec[1] > ymaxv) ymaxv= fpt->vec[1]; - - foundvert= TRUE; } } } + + foundvert=1; } if (foundvert) { @@ -558,50 +555,43 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo } /* Calculate the extents of F-Curve's keyframes */ -void calc_fcurve_range (FCurve *fcu, float *start, float *end, - const short do_sel_only, const short do_min_length) +void calc_fcurve_range (FCurve *fcu, float *start, float *end, const short selOnly) { float min=999999999.0f, max=-999999999.0f; - short foundvert= FALSE; + short foundvert=0; if (fcu->totvert) { if (fcu->bezt) { BezTriple *bezt_first= NULL, *bezt_last= NULL; /* get endpoint keyframes */ - get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); - + get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, selOnly); + 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; } + foundvert=1; } - if (foundvert == FALSE) { - min= max= 0.0f; + /* minimum length is 1 frame */ + if (foundvert) { + if (min == max) max += 1.0f; + *start= min; + *end= max; } - - if (do_min_length) { - /* minimum length is 1 frame */ - if (min == max) { - max += 1.0f; - } + else { + *start= 0.0f; + *end= 1.0f; } - - *start= min; - *end= max; } /* ----------------- Status Checks -------------------------- */ |