diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-08-17 16:10:50 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-08-17 16:52:28 +0300 |
commit | 0246128b7f9c353641733f38dfafec362c3cf933 (patch) | |
tree | 48e121018c1b249bac876f6f1b141a72336ea0f0 | |
parent | f8dd0080a9c490b017a95857ff750e79d4c6943a (diff) |
Fix wrong Anim Auto-Snap Ctrl toggle
This was not working like elsewhere in both NLA and Graph Editor
(meaning that when snapping was already enabled, {key Ctrl} during
transform did not disable it).
Now use getAnimEdit_SnapMode() for this in NLA and GE as well.
Maniphest Tasks: T87173
Differential Revision: https://developer.blender.org/D12244
-rw-r--r-- | source/blender/editors/transform/transform_convert_graph.c | 11 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_convert_nla.c | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c index 111f81ff87b..a6cbbb299ac 100644 --- a/source/blender/editors/transform/transform_convert_graph.c +++ b/source/blender/editors/transform/transform_convert_graph.c @@ -41,6 +41,7 @@ #include "transform.h" #include "transform_convert.h" +#include "transform_mode.h" typedef struct TransDataGraph { float unit_scale; @@ -656,7 +657,6 @@ static bool fcu_test_selected(FCurve *fcu) */ static void flushTransGraphData(TransInfo *t) { - SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; TransData *td; TransData2D *td2d; TransDataGraph *tdg; @@ -680,7 +680,8 @@ static void flushTransGraphData(TransInfo *t) * - Don't do this when canceling, or else these changes won't go away. */ if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0) { - switch (sipo->autosnap) { + const short autosnap = getAnimEdit_SnapMode(t); + switch (autosnap) { case SACTSNAP_FRAME: /* snap to nearest frame */ td2d->loc[0] = floor((double)td2d->loc[0] + 0.5); break; @@ -714,9 +715,9 @@ static void flushTransGraphData(TransInfo *t) * * \note We don't do this when canceling transforms, or else these changes don't go away. */ - if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0 && - ELEM(sipo->autosnap, SACTSNAP_STEP, SACTSNAP_TSTEP)) { - switch (sipo->autosnap) { + if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0) { + const short autosnap = getAnimEdit_SnapMode(t); + switch (autosnap) { case SACTSNAP_STEP: /* frame step */ td2d->loc2d[0] = floor((double)td2d->loc[0] + 0.5); td->loc[0] = floor((double)td->loc[0] + 0.5); diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index b55005673d9..f96f2e93bbc 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -42,6 +42,7 @@ #include "transform.h" #include "transform_convert.h" +#include "transform_mode.h" /** Used for NLA transform (stored in #TransData.extra pointer). */ typedef struct TransDataNla { @@ -411,7 +412,8 @@ void recalcData_nla(TransInfo *t) * NOTE: only do this when transform is still running, or we can't restore */ if (t->state != TRANS_CANCEL) { - switch (snla->autosnap) { + const short autosnap = getAnimEdit_SnapMode(t); + switch (autosnap) { case SACTSNAP_FRAME: /* snap to nearest frame */ case SACTSNAP_STEP: /* frame step - this is basically the same, * since we don't have any remapping going on */ |