From 99d9cc24098f83c9efece24213429855af884377 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 7 Jul 2023 10:19:57 +0200 Subject: [PATCH 1/2] Fix #109802: Outliner "Blender File" view cant delete scene `outliner_do_scene_operation` wasnt recursive, so it only acted on the top-level `TreeElement` (which was fine for Scenes view, but failed in `Blender File` view). Now use an iterator that handles open subhierarchies as well. --- source/blender/editors/space_outliner/outliner_tools.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index c69426842fa..f83e340b677 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -687,20 +687,20 @@ static const EnumPropertyItem prop_scene_op_types[] = { static bool outliner_do_scene_operation( bContext *C, + SpaceOutliner *space_outliner, eOutliner_PropSceneOps event, - ListBase *lb, bool (*operation_fn)(bContext *, eOutliner_PropSceneOps, TreeElement *, TreeStoreElem *)) { bool success = false; - LISTBASE_FOREACH (TreeElement *, te, lb) { + tree_iterator::all_open(*space_outliner, [&](TreeElement *te) { TreeStoreElem *tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { if (operation_fn(C, event, te, tselem)) { success = true; } } - } + }); return success; } @@ -729,7 +729,7 @@ static int outliner_scene_operation_exec(bContext *C, wmOperator *op) SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); const eOutliner_PropSceneOps event = (eOutliner_PropSceneOps)RNA_enum_get(op->ptr, "type"); - if (outliner_do_scene_operation(C, event, &space_outliner->tree, scene_fn) == false) { + if (outliner_do_scene_operation(C, space_outliner, event, scene_fn) == false) { return OPERATOR_CANCELLED; } -- 2.30.2 From 882b8edc8b87a27f0f52fe406810442532e180e0 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 11 Jul 2023 15:29:28 +0200 Subject: [PATCH 2/2] only act on scenes in outliner_do_scene_operation --- source/blender/editors/space_outliner/outliner_tools.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index f83e340b677..e612ca517cb 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -696,8 +696,10 @@ static bool outliner_do_scene_operation( tree_iterator::all_open(*space_outliner, [&](TreeElement *te) { TreeStoreElem *tselem = TREESTORE(te); if (tselem->flag & TSE_SELECTED) { - if (operation_fn(C, event, te, tselem)) { - success = true; + if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_SCE)) { + if (operation_fn(C, event, te, tselem)) { + success = true; + } } } }); -- 2.30.2