[Bf-blender-cvs] [0458b24a239] master: Fix T101499: Do not allow unlinking objects from linked collections.

Bastien Montagne noreply at git.blender.org
Tue Oct 4 14:59:15 CEST 2022


Commit: 0458b24a239e6070ad6e045ace3b59f57deaf14a
Author: Bastien Montagne
Date:   Tue Oct 4 14:58:15 2022 +0200
Branches: master
https://developer.blender.org/rB0458b24a239e6070ad6e045ace3b59f57deaf14a

Fix T101499: Do not allow unlinking objects from linked collections.

===================================================================

M	source/blender/editors/space_outliner/outliner_tools.cc

===================================================================

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);



More information about the Bf-blender-cvs mailing list