From 962e221cd32cfad7759eb7f0485799dce2f57424 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Wed, 23 Nov 2022 14:06:21 -0300 Subject: [PATCH] Fix T102720: Snapping in 3dViewport affects Graph, Action and NLA editors These editors have their own "Auto-Snap" activation option. So ignore the option in the 3D View in these cases. The generic incremental snap function doesn't seem really useful in these cases. If an incremental snap needs to be implemented, this should be a new option of `eAnimEdit_AutoSnap`. --- .../editors/transform/transform_snap.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 11cb57dc911..4a26a736351 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -609,16 +609,26 @@ static bool bm_face_is_snap_target(BMFace *f, void *UNUSED(user_data)) static eSnapFlag snap_flag_from_spacetype(TransInfo *t) { ToolSettings *ts = t->settings; - if (t->spacetype == SPACE_NODE) { - return ts->snap_flag_node; + switch (t->spacetype) { + case SPACE_VIEW3D: + return ts->snap_flag; + case SPACE_NODE: + return ts->snap_flag_node; + case SPACE_IMAGE: + return ts->snap_uv_flag; + case SPACE_SEQ: + return ts->snap_flag_seq; + case SPACE_GRAPH: + case SPACE_ACTION: + case SPACE_NLA: + /* These editors have their own "Auto-Snap" activation option. + * See #getAnimEdit_SnapMode. */ + return 0; + default: + BLI_assert(false); + break; } - if (t->spacetype == SPACE_IMAGE) { - return ts->snap_uv_flag; - } - if (t->spacetype == SPACE_SEQ) { - return ts->snap_flag_seq; - } - return ts->snap_flag; + return 0; } static eSnapMode snap_mode_from_spacetype(TransInfo *t)