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:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index bab5ee02916..995f41382cd 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -547,10 +547,11 @@ static eOLDrawState tree_element_active_defgroup(bContext *C,
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, ob);
}
else {
- if (ob == OBACT(view_layer))
+ if (ob == OBACT(view_layer)) {
if (ob->actdef == te->index + 1) {
return OL_DRAWSEL_NORMAL;
}
+ }
}
return OL_DRAWSEL_NONE;
}
@@ -1028,8 +1029,9 @@ eOLDrawState tree_element_active(bContext *C,
const bool handle_all_types)
{
switch (te->idcode) {
- /* Note: ID_OB only if handle_all_type is true, else objects are handled specially to allow multiple
- * selection. See do_outliner_item_activate. */
+ /** \note #ID_OB only if handle_all_type is true,
+ * else objects are handled specially to allow multiple selection.
+ * See #do_outliner_item_activate. */
case ID_OB:
if (handle_all_types) {
return tree_element_set_active_object(C, scene, view_layer, soops, te, set, false);
@@ -1131,8 +1133,8 @@ static void do_outliner_item_activate_tree_element(bContext *C,
TSE_SEQUENCE_DUP,
TSE_EBONE,
TSE_LAYER_COLLECTION)) {
- /* Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects, we do not want
- * to switch out of edit mode (see T48328 for details). */
+ /* Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects,
+ * we do not want to switch out of edit mode (see T48328 for details). */
}
else if (tselem->id && OB_DATA_SUPPORT_EDITMODE(te->idcode)) {
/* Support edit-mode toggle, keeping the active object as is. */
@@ -1295,10 +1297,11 @@ void outliner_item_do_activate_from_tree_element(
*
* May expend/collapse branches or activate items.
* */
-int outliner_item_do_activate_from_cursor(bContext *C,
- const int mval[2],
- bool extend,
- bool recursive)
+static int outliner_item_do_activate_from_cursor(bContext *C,
+ const int mval[2],
+ const bool extend,
+ const bool recursive,
+ const bool deselect_all)
{
ARegion *ar = CTX_wm_region(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
@@ -1313,7 +1316,10 @@ 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);
@@ -1349,9 +1355,10 @@ 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)
@@ -1364,8 +1371,15 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
ot->poll = ED_operator_outliner_active;
+ PropertyRNA *prop;
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");
+ 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);
}
/* ****************************************************** */