diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index c69426842fa..e612ca517cb 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -687,20 +687,22 @@ 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; + if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_SCE)) { + if (operation_fn(C, event, te, tselem)) { + success = true; + } } } - } + }); return success; } @@ -729,7 +731,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; }