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:
authorPablo Dobarro <pablodp606@gmail.com>2020-10-20 23:16:55 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-20 23:18:01 +0300
commit17cb2a6da0c88eb509448447e10bc73a38398895 (patch)
tree037e63aee0466fb19ab21ca7bd7deef9d995af5f /source/blender/windowmanager/intern/wm_operators.c
parentb55c44e3eda0165b67b1284336eaedc02198844e (diff)
UI: Move gesture selection with spacebar
This patch adds a modal key to move the selection box/lasso/line while drawing it. It also sets "repeat": False on the animation playback key to prevent accidental playback if the spacebar is released after the mouse button. Reviewed By: #user_interface, pablovazquez, Severin Differential Revision: https://developer.blender.org/D9227
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operators.c')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index c51086c5f0a..bbe2ff4b81a 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3805,6 +3805,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
+ {GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -3831,6 +3832,7 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
{GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
+ {GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -3881,6 +3883,38 @@ static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "GPENCIL_OT_select_box");
}
+/* lasso modal operators */
+static void gesture_lasso_modal_keymap(wmKeyConfig *keyconf)
+{
+ static const EnumPropertyItem modal_items[] = {
+ {GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Gesture Lasso");
+
+ /* this function is called for each spacetype, only needs to add map once */
+ if (keymap && keymap->modal_items) {
+ return;
+ }
+
+ keymap = WM_modalkeymap_ensure(keyconf, "Gesture Lasso", modal_items);
+
+ /* assign map to operators */
+ WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "GPENCIL_OT_stroke_cutter");
+ WM_modalkeymap_assign(keymap, "GPENCIL_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "MASK_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "PAINT_OT_mask_lasso_gesture");
+ WM_modalkeymap_assign(keymap, "SCULPT_OT_face_set_lasso_gesture");
+ WM_modalkeymap_assign(keymap, "SCULPT_OT_trim_lasso_gesture");
+ WM_modalkeymap_assign(keymap, "ACTION_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "CLIP_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "GRAPH_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "NODE_OT_select_lasso");
+ WM_modalkeymap_assign(keymap, "UV_OT_select_lasso");
+}
+
/* zoom to border modal operators */
static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
{
@@ -3917,6 +3951,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
gesture_box_modal_keymap(keyconf);
gesture_zoom_border_modal_keymap(keyconf);
gesture_straightline_modal_keymap(keyconf);
+ gesture_lasso_modal_keymap(keyconf);
WM_keymap_fix_linking();
}