[Bf-blender-cvs] [197f3d75d1b] blender-v3.3-release: Fix T101499: Do not allow unlinking objects from linked collections.

Bastien Montagne noreply at git.blender.org
Mon Oct 17 15:01:06 CEST 2022


Commit: 197f3d75d1beeae78da2567a1066be1ca9876ada
Author: Bastien Montagne
Date:   Tue Oct 4 14:58:15 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB197f3d75d1beeae78da2567a1066be1ca9876ada

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



More information about the Bf-blender-cvs mailing list