Fix T45995: Auto-set preview range sets superfluous end key.
get_keyframe_extents() would add an extra frame in case of mono-key fcurves in selected set... Now do the 'not same start/end frames' check later, and also use floor/ceil instead of round (we want to start at frame 3 if first key is at frame 3.8, reversed-same goes for end frame).
This commit is contained in:
@@ -223,7 +223,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
|
|||||||
float tmin, tmax;
|
float tmin, tmax;
|
||||||
|
|
||||||
/* get range and apply necessary scaling before processing */
|
/* get range and apply necessary scaling before processing */
|
||||||
if (calc_fcurve_range(fcu, &tmin, &tmax, onlySel, true)) {
|
if (calc_fcurve_range(fcu, &tmin, &tmax, onlySel, false)) {
|
||||||
|
|
||||||
if (adt) {
|
if (adt) {
|
||||||
tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP);
|
tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP);
|
||||||
@@ -237,7 +237,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
ANIM_animdata_freelist(&anim_data);
|
ANIM_animdata_freelist(&anim_data);
|
||||||
}
|
}
|
||||||
@@ -275,8 +275,12 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
/* set the range directly */
|
/* set the range directly */
|
||||||
get_keyframe_extents(&ac, &min, &max, false);
|
get_keyframe_extents(&ac, &min, &max, false);
|
||||||
scene->r.flag |= SCER_PRV_RANGE;
|
scene->r.flag |= SCER_PRV_RANGE;
|
||||||
scene->r.psfra = iroundf(min);
|
scene->r.psfra = floorf(min);
|
||||||
scene->r.pefra = iroundf(max);
|
scene->r.pefra = ceilf(max);
|
||||||
|
|
||||||
|
if (scene->r.psfra == scene->r.pefra) {
|
||||||
|
scene->r.pefra = scene->r.psfra + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* set notifier that things have changed */
|
/* set notifier that things have changed */
|
||||||
// XXX err... there's nothing for frame ranges yet, but this should do fine too
|
// XXX err... there's nothing for frame ranges yet, but this should do fine too
|
||||||
|
Reference in New Issue
Block a user