diff --git a/source/blender/editors/transform/transform_convert_graph.cc b/source/blender/editors/transform/transform_convert_graph.cc index 127b49c50ab2aae39ce974ef1df952fd9c70e611..c2e8b613b6d531211d152d6cf6895bbc428e963e 100644 --- a/source/blender/editors/transform/transform_convert_graph.cc +++ b/source/blender/editors/transform/transform_convert_graph.cc @@ -644,18 +644,6 @@ static bool fcu_test_selected(FCurve *fcu) return false; } -static void invert_snap(eSnapMode &snap_mode) -{ - if (snap_mode & SCE_SNAP_TO_FRAME) { - snap_mode &= ~SCE_SNAP_TO_FRAME; - snap_mode |= SCE_SNAP_TO_SECOND; - } - else if (snap_mode & SCE_SNAP_TO_SECOND) { - snap_mode &= ~SCE_SNAP_TO_SECOND; - snap_mode |= SCE_SNAP_TO_FRAME; - } -} - /* This function is called on recalc_data to apply the transforms applied * to the transdata on to the actual keyframe data */ @@ -668,10 +656,6 @@ static void flushTransGraphData(TransInfo *t) eSnapMode snap_mode = t->tsnap.mode; - if (t->modifiers & MOD_SNAP_INVERT) { - invert_snap(snap_mode); - } - TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); /* flush to 2d vector from internally used 3d vector */ for (a = 0, diff --git a/source/blender/editors/transform/transform_snap.cc b/source/blender/editors/transform/transform_snap.cc index 136bf630cbf4a0761dd6001fa3343d0ff54b9049..5418124bc27b01a748e55add58c86503a7ca25cb 100644 --- a/source/blender/editors/transform/transform_snap.cc +++ b/source/blender/editors/transform/transform_snap.cc @@ -129,10 +129,28 @@ bool validSnap(const TransInfo *t) void transform_snap_flag_from_modifiers_set(TransInfo *t) { - if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) { + if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA)) { /* Those space-types define their own invert behavior instead of toggling it on/off. */ return; } + if (t->spacetype == SPACE_GRAPH) { + /* This is to stay consistent with the behavior from 3.6. */ + if (t->modifiers & MOD_SNAP_INVERT) { + t->tsnap.mode |= SCE_SNAP_TO_INCREMENT; + } + else { + t->tsnap.mode &= ~SCE_SNAP_TO_INCREMENT; + } + /* In 3.6 when snapping was disabled, pressing the invert button would turn on snapping. + * But it wouldn't turn it off when it was enabled. */ + if ((t->modifiers & MOD_SNAP) || (t->modifiers & MOD_SNAP_INVERT)) { + t->tsnap.flag |= SCE_SNAP; + } + else { + t->tsnap.flag &= ~SCE_SNAP; + } + return; + } SET_FLAG_FROM_TEST(t->tsnap.flag, (((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP) || ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP_INVERT)),