Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2020-02-15 18:09:23 +0300
committermano-wii <germano.costa@ig.com.br>2020-02-15 18:09:23 +0300
commitde9ea94fc6f810b101742a4c2b839fb748e95be0 (patch)
tree0a8fcca4e459fff0614332d415b557ca9cd3c1bf /source/blender/editors/transform/transform_mode_timetranslate.c
parentf0c991a380e9d449ebc02cc91649ef3728848070 (diff)
Transform: Deduplicate time snap code
Diffstat (limited to 'source/blender/editors/transform/transform_mode_timetranslate.c')
-rw-r--r--source/blender/editors/transform/transform_mode_timetranslate.c35
1 files changed, 2 insertions, 33 deletions
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);
}
}