From de9ea94fc6f810b101742a4c2b839fb748e95be0 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Sat, 15 Feb 2020 12:09:23 -0300 Subject: Transform: Deduplicate time snap code --- .../transform/transform_mode_timetranslate.c | 35 ++-------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'source/blender/editors/transform/transform_mode_timetranslate.c') diff --git a/source/blender/editors/transform/transform_mode_timetranslate.c b/source/blender/editors/transform/transform_mode_timetranslate.c index 16e2b3c633d..7887c17f537 100644 --- a/source/blender/editors/transform/transform_mode_timetranslate.c +++ b/source/blender/editors/transform/transform_mode_timetranslate.c @@ -87,7 +87,7 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR]) } } -static void applyTimeTranslateValue(TransInfo *t, float value) +static void applyTimeTranslateValue(TransInfo *t, const float deltax) { Scene *scene = t->scene; int i; @@ -95,8 +95,6 @@ static void applyTimeTranslateValue(TransInfo *t, float value) const short autosnap = getAnimEdit_SnapMode(t); const double secf = FPS; - float deltax, val /* , valprev */; - FOREACH_TRANS_DATA_CONTAINER (t, tc) { TransData *td = tc->data; TransData2D *td2d = tc->data_2d; @@ -110,37 +108,8 @@ static void applyTimeTranslateValue(TransInfo *t, float value) */ AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; - /* valprev = *td->val; */ /* UNUSED */ - - /* check if any need to apply nla-mapping */ - if (adt && (t->spacetype != SPACE_SEQ)) { - deltax = value; - - if (autosnap == SACTSNAP_TSTEP) { - deltax = (float)(floor(((double)deltax / secf) + 0.5) * secf); - } - else if (autosnap == SACTSNAP_STEP) { - deltax = floorf(deltax + 0.5f); - } - - val = BKE_nla_tweakedit_remap(adt, td->ival, NLATIME_CONVERT_MAP); - val += deltax * td->factor; - *(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); - } - else { - deltax = val = t->values_final[0]; - - if (autosnap == SACTSNAP_TSTEP) { - val = (float)(floor(((double)deltax / secf) + 0.5) * secf); - } - else if (autosnap == SACTSNAP_STEP) { - val = floorf(val + 0.5f); - } - - *(td->val) = td->ival + val * td->factor; - } - /* apply nearest snapping */ + *(td->val) = td->ival + deltax * td->factor; doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap); } } -- cgit v1.2.3