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:
2017-09-12 12:35:04 +12:00
parent a704a66914
commit d2202117fe

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;
}