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:
authorJulian Eisel <eiseljulian@gmail.com>2019-09-08 21:31:12 +0300
committerYimingWu <xp8110@outlook.com>2019-09-12 04:13:03 +0300
commit85730454041d810f2d314c38a5e06b6ca1a4ba14 (patch)
treec24ab85ab56e93ea57086d6b1ab1082cb198f072
parentb9252e63fa9648022fa14a72ba6a4383170b2fb4 (diff)
UI: Allow file number shortcuts ouside main region
Makes the numpad + and - type of shortcuts to increase/decrease the file number suffix work in the upper and lower bar of the file browser. Had to add keymap handlers to the execute region for this to work.
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py24
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py24
-rw-r--r--source/blender/editors/space_file/space_file.c6
3 files changed, 30 insertions, 24 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 89563b6f64d..cd3dff55d47 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -1788,6 +1788,18 @@ def km_file_browser(_params):
("file.directory_new", {"type": 'I', "value": 'PRESS'}, None),
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
+ ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
+ {"properties": [("increment", 1)]}),
+ ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
+ {"properties": [("increment", 10)]}),
+ ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
+ {"properties": [("increment", 100)]}),
+ ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
+ {"properties": [("increment", -1)]}),
+ ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
+ {"properties": [("increment", -10)]}),
+ ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
+ {"properties": [("increment", -100)]}),
])
return keymap
@@ -1848,18 +1860,6 @@ def km_file_browser_main(params):
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
op_menu("FILEBROWSER_MT_context_menu", params.context_menu_event),
- ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
- {"properties": [("increment", 1)]}),
- ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
- {"properties": [("increment", 10)]}),
- ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
- {"properties": [("increment", 100)]}),
- ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
- {"properties": [("increment", -1)]}),
- ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
- {"properties": [("increment", -10)]}),
- ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
- {"properties": [("increment", -100)]}),
])
return keymap
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index d1cd27296e1..27cae25bd88 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -1181,6 +1181,18 @@ def km_file_browser(params):
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
("file.bookmark_toggle", {"type": 'T', "value": 'PRESS'}, None),
("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
+ ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
+ {"properties": [("increment", 1)]}),
+ ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
+ {"properties": [("increment", 10)]}),
+ ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
+ {"properties": [("increment", 100)]}),
+ ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
+ {"properties": [("increment", -1)]}),
+ ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
+ {"properties": [("increment", -10)]}),
+ ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
+ {"properties": [("increment", -100)]}),
])
return keymap
@@ -1243,18 +1255,6 @@ def km_file_browser_main(params):
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
op_menu("FILEBROWSER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
- ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
- {"properties": [("increment", 1)]}),
- ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
- {"properties": [("increment", 10)]}),
- ("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
- {"properties": [("increment", 100)]}),
- ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
- {"properties": [("increment", -1)]}),
- ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
- {"properties": [("increment", -10)]}),
- ("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
- {"properties": [("increment", -100)]}),
])
return keymap
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 7525ac5b705..d6a4eafc658 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -593,8 +593,14 @@ static void file_ui_region_draw(const bContext *C, ARegion *ar)
static void file_execution_region_init(wmWindowManager *wm, ARegion *ar)
{
+ wmKeyMap *keymap;
+
ED_region_panels_init(wm, ar);
ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
+
+ /* own keymap */
+ keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
+ WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
}
static void file_execution_region_draw(const bContext *C, ARegion *ar)