Select: add 'select on nothing' to Outliner.

Althought this has limited usability currently (only 'nothing' area in
Outliner are empty lines below last entries), better for consistency to
have it here too.

Part of T63995.
This commit is contained in:
Bastien Montagne 2019-04-29 15:09:31 +02:00
parent a17d1e4bc8
commit ab62a5db49
2 changed files with 17 additions and 7 deletions

View File

@ -713,7 +713,7 @@ def km_outliner(params):
("outliner.highlight_update", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
("outliner.item_rename", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK'},
{"properties": [("extend", False), ("recursive", False)]}),
{"properties": [("extend", False), ("recursive", False), ("deselect_all", not params.legacy)]}),
("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "shift": True},
{"properties": [("extend", True), ("recursive", False)]}),
("outliner.item_activate", {"type": 'LEFTMOUSE', "value": 'CLICK', "ctrl": True},

View File

@ -1299,8 +1299,9 @@ void outliner_item_do_activate_from_tree_element(
* */
static int outliner_item_do_activate_from_cursor(bContext *C,
const int mval[2],
bool extend,
bool recursive)
const bool extend,
const bool recursive,
const bool deselect_all)
{
ARegion *ar = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
@ -1315,7 +1316,10 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
}
if (!(te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]))) {
/* skip */
if (deselect_all) {
outliner_flag_set(&soops->tree, TSE_SELECTED, false);
changed = true;
}
}
else if (outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
outliner_item_toggle_closed(te, extend);
@ -1351,9 +1355,10 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
/* event can enterkey, then it opens/closes */
static int outliner_item_activate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
bool extend = RNA_boolean_get(op->ptr, "extend");
bool recursive = RNA_boolean_get(op->ptr, "recursive");
return outliner_item_do_activate_from_cursor(C, event->mval, extend, recursive);
const bool extend = RNA_boolean_get(op->ptr, "extend");
const bool recursive = RNA_boolean_get(op->ptr, "recursive");
const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
return outliner_item_do_activate_from_cursor(C, event->mval, extend, recursive, deselect_all);
}
void OUTLINER_OT_item_activate(wmOperatorType *ot)
@ -1368,6 +1373,11 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection for activation");
RNA_def_boolean(ot->srna, "recursive", false, "Recursive", "Select Objects and their children");
RNA_def_boolean(ot->srna,
"deselect_all",
false,
"Deselect On Nothing",
"Deselect all when nothing under the cursor");
}
/* ****************************************************** */