UI: File browser deselect on click on empty space
For the default and industry compatible keymap, clicking on empty space in the file browser will deselect all files. Also makes selection use same operator description we use for other select operators.
This commit is contained in:
parent
01a3a9c818
commit
42c062c98a
|
@ -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)]}),
|
||||
|
|
|
@ -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,},
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue