diff options
3 files changed, 17 insertions, 5 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 582757f2168..b9c8e73dab2 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -1819,7 +1819,7 @@ def km_file_browser_main(params): {"properties": [("need_active", True)]}), ("file.refresh", {"type": 'NUMPAD_PERIOD', "value": 'PRESS'}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'}, - {"properties": [("open", False)]}), + {"properties": [("open", False), ("deselect_all", not params.legacy)]}), ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True}, {"properties": [("extend", True)]}), 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 a963f461dd1..29a002b2754 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -1213,7 +1213,7 @@ def km_file_browser_main(params): ("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'}, - {"properties": [("open", False)]}), + {"properties": [("open", False), ("deselect_all", True)]}), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True}, {"properties": [("extend", True)]}), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True,}, diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index c6061cb6f58..127196cca74 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -489,6 +489,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) const bool extend = RNA_boolean_get(op->ptr, "extend"); const bool fill = RNA_boolean_get(op->ptr, "fill"); const bool do_diropen = RNA_boolean_get(op->ptr, "open"); + const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all"); if (ar->regiontype != RGN_TYPE_WINDOW) { return OPERATOR_CANCELLED; @@ -521,10 +522,15 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) filelist_entry_parent_select_set(sfile->files, FILE_SEL_REMOVE, FILE_SEL_SELECTED, CHECK_ALL); } - if (FILE_SELECT_DIR == ret) { + if (ret == FILE_SELECT_NOTHING) { + if (deselect_all) { + file_deselect_all(sfile, FILE_SEL_SELECTED); + } + } + else if (ret == FILE_SELECT_DIR) { WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); } - else if (FILE_SELECT_FILE == ret) { + else if (ret == FILE_SELECT_FILE) { WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); } @@ -540,8 +546,8 @@ void FILE_OT_select(wmOperatorType *ot) /* identifiers */ ot->name = "Select"; - ot->description = "Activate/select file"; ot->idname = "FILE_OT_select"; + ot->description = "Handle mouse clicks to select and activate items"; /* api callbacks */ ot->invoke = file_select_invoke; @@ -559,6 +565,12 @@ void FILE_OT_select(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "open", true, "Open", "Open a directory when selecting it"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, + "deselect_all", + false, + "Deselect On Nothing", + "Deselect all when nothing under the cursor"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } /** |