Fix #73072: Outliner: Alt click fails to enable toggle on selected objects

Alt click works perfect to disable restriction toggle (hide/selection
toogle) on selected object tree elements from outliner. But fails when
re-enabling them. This is because `screen_ctx_selected_editable_objects`
returns a list of selectable bases. When above two restriction toggles
are disabled, `selection` flag is cleared from resepective bases. To avoid
such situation, handle outliner case separately inside
`UI_context_copy_to_selected_list ()`, store list of objects that are selected
in outliner (i.e. `TSE_SELECTED` flag is set).

Also added few findings as comments in #133459

Pull Request: https://projects.blender.org/blender/blender/pulls/133469
This commit is contained in:
Pratik Borhade
2025-06-27 13:43:19 +02:00
committed by Pratik Borhade
parent e431145e4a
commit 52caedb19e

View File

@@ -63,6 +63,7 @@
#include "WM_types.hh"
#include "ED_object.hh"
#include "ED_outliner.hh"
#include "ED_paint.hh"
#include "ED_undo.hh"
@@ -1268,6 +1269,19 @@ bool UI_context_copy_to_selected_list(bContext *C,
*r_lb = lb;
*r_path = path;
}
else if (CTX_wm_space_outliner(C)) {
const ID *id = ptr->owner_id;
if (!(id && (GS(id->name) == ID_OB))) {
return false;
}
ListBase selected_objects = {nullptr};
ED_outliner_selected_objects_get(C, &selected_objects);
LISTBASE_FOREACH (LinkData *, link, &selected_objects) {
Object *ob = static_cast<Object *>(link->data);
r_lb->append(RNA_id_pointer_create(&ob->id));
}
}
else if (ptr->owner_id) {
ID *id = ptr->owner_id;