diff options
author | Bastien Montagne <bastien@blender.org> | 2022-10-04 15:58:15 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-10-17 15:38:08 +0300 |
commit | 197f3d75d1beeae78da2567a1066be1ca9876ada (patch) | |
tree | 07096add4db011d80fbd5dd5a8c43107e5bdd757 /source/blender | |
parent | 8f8eac78cf8b1cb31afb4c10189ee5c004fc5387 (diff) |
Fix T101499: Do not allow unlinking objects from linked collections.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc index dfb421367c1..382004a2484 100644 --- a/source/blender/editors/space_outliner/outliner_tools.cc +++ b/source/blender/editors/space_outliner/outliner_tools.cc @@ -380,7 +380,7 @@ static void unlink_collection_fn(bContext *C, } static void unlink_object_fn(bContext *C, - ReportList *UNUSED(reports), + ReportList *reports, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, @@ -395,12 +395,28 @@ static void unlink_object_fn(bContext *C, /* Parented objects need to find which collection to unlink from. */ TreeElement *te_parent = te->parent; while (tsep && GS(tsep->id->name) == ID_OB) { + if (ID_IS_LINKED(tsep->id)) { + BKE_reportf(reports, + RPT_WARNING, + "Cannot unlink object '%s' parented to another linked object '%s'", + ob->id.name + 2, + tsep->id->name + 2); + return; + } te_parent = te_parent->parent; tsep = te_parent ? TREESTORE(te_parent) : nullptr; } } if (tsep && tsep->id) { + if (ID_IS_LINKED(tsep->id) || ID_IS_OVERRIDE_LIBRARY(tsep->id)) { + BKE_reportf(reports, + RPT_WARNING, + "Cannot unlink object '%s' from linked collection or scene '%s'", + ob->id.name + 2, + tsep->id->name + 2); + return; + } if (GS(tsep->id->name) == ID_GR) { Collection *parent = (Collection *)tsep->id; BKE_collection_object_remove(bmain, parent, ob, true); |