Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-10-04 15:58:15 +0300
committerBastien Montagne <bastien@blender.org>2022-10-04 15:59:06 +0300
commit0458b24a239e6070ad6e045ace3b59f57deaf14a (patch)
tree2b1af7a84f798ae37a39d79371f7d8dd71ce2427 /source/blender/editors/space_outliner
parent38170cd295f2019aa2408d43f28269677e13eb45 (diff)
Fix T101499: Do not allow unlinking objects from linked collections.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.cc18
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 2ece9ecc7f2..16b24b14845 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -381,7 +381,7 @@ static void unlink_collection_fn(bContext *C,
}
static void unlink_object_fn(bContext *C,
- ReportList * /*reports*/,
+ ReportList *reports,
Scene * /*scene*/,
TreeElement *te,
TreeStoreElem *tsep,
@@ -396,12 +396,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);