T50354: Action length calculation added unnecessary padding if some F-Curves

only contained a single key (on the last real frame of the action).
This commit is contained in:
Joshua Leung 2017-09-12 12:35:04 +12:00
parent a704a66914
commit d2202117fe
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #53683, 2.79a release
1 changed files with 9 additions and 3 deletions

View File

@ -1129,9 +1129,13 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
if (fcu->totvert) {
float nmin, nmax;
/* get extents for this curve */
/* TODO: allow enabling/disabling this? */
calc_fcurve_range(fcu, &nmin, &nmax, false, true);
/* get extents for this curve
* - no "selected only", since this is often used in the backend
* - no "minimum length" (we will apply this later), otherwise
* single-keyframe curves will increase the overall length by
* a phantom frame (T50354)
*/
calc_fcurve_range(fcu, &nmin, &nmax, false, false);
/* compare to the running tally */
min = min_ff(min, nmin);
@ -1184,7 +1188,9 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
if (foundvert || foundmod) {
/* ensure that action is at least 1 frame long (for NLA strips to have a valid length) */
if (min == max) max += 1.0f;
*start = min;
*end = max;
}