Fix Dopesheet transform regressions due to rB81dc76c19cff

Functions that begin with the name `apply` closely resemble the main callback to apply.
Ref T68137
This commit is contained in:
Germano Cavalcante 2019-08-06 14:02:19 -03:00
parent 317033a1be
commit 3227b37141
Notes: blender-bot 2023-02-14 06:49:54 +01:00
Referenced by issue #68137, Dopesheet Editor: Moving keyframes by a number value doesn't work
1 changed files with 6 additions and 11 deletions

View File

@ -9649,20 +9649,17 @@ static void headerTimeSlide(TransInfo *t, const float sval, char str[UI_MAX_DRAW
BLI_snprintf(str, UI_MAX_DRAW_STR, TIP_("TimeSlide: %s"), &tvec[0]);
}
static void applyTimeSlideValue(TransInfo *t, float sval)
static void applyTimeSlideValue(TransInfo *t, float sval, float cval)
{
int i;
const float *range = t->custom.mode.data;
float minx = range[0];
float maxx = range[1];
t->values_final[0] = t->values[0];
/* set value for drawing black line */
if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
float cvalf = t->values_final[0];
saction->timeslide = cvalf;
saction->timeslide = cval;
}
/* It doesn't matter whether we apply to t->data or
@ -9675,7 +9672,6 @@ static void applyTimeSlideValue(TransInfo *t, float sval)
* (this is only valid when not in NLA)
*/
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
float cval = t->values_final[0];
/* only apply to data if in range */
if ((sval > minx) && (sval < maxx)) {
@ -9736,7 +9732,7 @@ static void applyTimeSlide(TransInfo *t, const int mval[2])
t->values_final[0] = (maxx - minx) * t->vec[0] / 2.0f + sval[0];
headerTimeSlide(t, sval[0], str);
applyTimeSlideValue(t, sval[0]);
applyTimeSlideValue(t, sval[0], t->values_final[0]);
recalcData(t);
@ -9808,14 +9804,13 @@ static void headerTimeScale(TransInfo *t, char str[UI_MAX_DRAW_STR])
BLI_snprintf(str, UI_MAX_DRAW_STR, TIP_("ScaleX: %s"), &tvec[0]);
}
static void applyTimeScaleValue(TransInfo *t)
static void applyTimeScaleValue(TransInfo *t, float value)
{
Scene *scene = t->scene;
int i;
const short autosnap = getAnimEdit_SnapMode(t);
const double secf = FPS;
t->values_final[0] = t->values[0];
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
@ -9827,7 +9822,7 @@ static void applyTimeScaleValue(TransInfo *t)
*/
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
float startx = CFRA;
float fac = t->values_final[0];
float fac = value;
if (autosnap == SACTSNAP_TSTEP) {
fac = (float)(floor((double)fac / secf + 0.5) * secf);
@ -9863,7 +9858,7 @@ static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2]))
t->values_final[0] = t->vec[0];
headerTimeScale(t, str);
applyTimeScaleValue(t);
applyTimeScaleValue(t, t->values_final[0]);
recalcData(t);