Fix #89479: Unable to select hierarchies of multiple objects from outliner #104737

Merged
Pratik Borhade merged 11 commits from PratikPB2123/blender:T89479-select-multi-hierarchies into main 2023-08-17 13:23:52 +02:00
1 changed files with 23 additions and 3 deletions

View File

@ -362,6 +362,9 @@ static void tree_element_object_activate(bContext *C,
}
}
}
else if (recursive) {
/* Pass */
}
else {
/* De-select all. */
@ -388,7 +391,9 @@ static void tree_element_object_activate(bContext *C,
}
if (set != OL_SETSEL_NONE) {
ED_object_base_activate_with_mode_exit_if_needed(C, base); /* adds notifier */
if (!recursive) {
ED_object_base_activate_with_mode_exit_if_needed(C, base); /* adds notifier */
}
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
@ -1449,6 +1454,15 @@ static void do_outliner_item_activate_tree_element(bContext *C,
OL_SETSEL_NORMAL,
recursive && tselem->type == TSE_SOME_ID);
}
else if (recursive && !(space_outliner->flag & SO_SYNC_SELECT)) {
/* Selection of child objects in hierarchy when sync-selection is OFF. */
tree_iterator::all(te->subtree, [&](TreeElement *te) {
TreeStoreElem *tselem = TREESTORE(te);
if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
tselem->flag |= TSE_SELECTED;
}
});
}
if (tselem->type == TSE_SOME_ID) { /* The lib blocks. */
if (do_activate_data == false) {
@ -1519,10 +1533,13 @@ void outliner_item_select(bContext *C,
const bool activate = select_flag & OL_ITEM_ACTIVATE;
const bool extend = select_flag & OL_ITEM_EXTEND;
const bool activate_data = select_flag & OL_ITEM_SELECT_DATA;
const bool recursive = select_flag & OL_ITEM_RECURSIVE;
/* Clear previous active when activating and clear selection when not extending selection */
const short clear_flag = (activate ? TSE_ACTIVE : 0) | (extend ? 0 : TSE_SELECTED);
if (clear_flag) {
/* Do not clear the active and select flag when selecting hierarchies. */
if (clear_flag && !recursive) {
outliner_flag_set(*space_outliner, clear_flag, false);
}
@ -1537,7 +1554,10 @@ void outliner_item_select(bContext *C,
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);
tselem->flag |= TSE_ACTIVE;
if (!recursive) {
tselem->flag |= TSE_ACTIVE;
}
do_outliner_item_activate_tree_element(C,
&tvc,
space_outliner,