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:
authorCampbell Barton <campbell@blender.org>2022-04-04 06:47:06 +0300
committerCampbell Barton <campbell@blender.org>2022-04-04 07:32:42 +0300
commitf699dbba86156ad3f24c24e3d369f0708b3fd1b5 (patch)
treee244f3f17a5a2166d443d25c14abb915d316f1a2 /source/blender/editors/space_view3d/view3d_navigate_move.c
parent0ef96cd3922dbc16271f2dbaca0c7752db92a40d (diff)
Cleanup: use event parameters for functions that create key-map items
Replace 5 arguments with a single struct as the same arguments are used in many places. This didn't read well and was confusing with both arguments named `val` & `value` in the case of WM_modalkeymap_add_item.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_navigate_move.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_move.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/view3d_navigate_move.c b/source/blender/editors/space_view3d/view3d_navigate_move.c
index af8419894b1..e653b349a2f 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_move.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_move.c
@@ -43,15 +43,50 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
keymap = WM_modalkeymap_ensure(keyconf, "View3D Move Modal", modal_items);
/* items for modal map */
- WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, KM_ANY, VIEW_MODAL_CONFIRM);
- WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, KM_ANY, VIEW_MODAL_CONFIRM);
+
+ WM_modalkeymap_add_item(keymap,
+ &(const KeyMapItem_Params){
+ .type = MIDDLEMOUSE,
+ .value = KM_RELEASE,
+ .modifier = KM_ANY,
+ .direction = KM_ANY,
+ },
+ VIEW_MODAL_CONFIRM);
+ WM_modalkeymap_add_item(keymap,
+ &(const KeyMapItem_Params){
+ .type = EVT_ESCKEY,
+ .value = KM_PRESS,
+ .modifier = KM_ANY,
+ .direction = KM_ANY,
+ },
+ VIEW_MODAL_CONFIRM);
/* disabled mode switching for now, can re-implement better, later on */
#if 0
- WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
- WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
- WM_modalkeymap_add_item(
- keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
+ WM_modalkeymap_add_item(keymap,
+ &(const KeyMapItem_Params){
+ .type = LEFTMOUSE,
+ .value = KM_PRESS,
+ .modifier = KM_ANY,
+ .direction = KM_ANY,
+ },
+ VIEWROT_MODAL_SWITCH_ZOOM);
+ WM_modalkeymap_add_item(keymap,
+ &(const KeyMapItem_Params){
+ .type = EVT_LEFTCTRLKEY,
+ .value = KM_PRESS,
+ .modifier = KM_ANY,
+ .direction = KM_ANY,
+ },
+ VIEWROT_MODAL_SWITCH_ZOOM);
+ WM_modalkeymap_add_item(keymap,
+ &(const KeyMapItem_Params){
+ .type = EVT_LEFTSHIFTKEY,
+ .value = KM_RELEASE,
+ .modifier = KM_ANY,
+ .direction = KM_ANY,
+ },
+ VIEWROT_MODAL_SWITCH_ROTATE);
#endif
/* assign map to operators */