[Bf-blender-cvs] [051141acdec] master: Outliner/LibOverrides: Fix logic of checks for drag'n'drop of Collections.

Bastien Montagne noreply at git.blender.org
Wed Aug 4 11:42:20 CEST 2021


Commit: 051141acdecfd11f82cbe37bac368c2882dd4f92
Author: Bastien Montagne
Date:   Wed Aug 4 11:40:20 2021 +0200
Branches: master
https://developer.blender.org/rB051141acdecfd11f82cbe37bac368c2882dd4f92

Outliner/LibOverrides: Fix logic of checks for drag'n'drop of Collections.

Previous check was too blunt, preventing e.g. re-organization of
collection overrides inside a local parent collection, which is
perfectly valid operation.

Reported by @hjalti from the studio, thanks!

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

M	source/blender/editors/space_outliner/outliner_dragdrop.c

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

diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 11ad3abcd54..a82f516b125 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -1104,10 +1104,6 @@ static bool collection_drop_init(bContext *C,
   if (ID_IS_LINKED(to_collection)) {
     return false;
   }
-  /* Currently this should not be allowed (might be supported in the future though...). */
-  if (ID_IS_OVERRIDE_LIBRARY(to_collection)) {
-    return false;
-  }
 
   /* Get drag datablocks. */
   if (drag->type != WM_DRAG_ID) {
@@ -1131,6 +1127,11 @@ static bool collection_drop_init(bContext *C,
     from_collection = NULL;
   }
 
+  /* Currently this should not be allowed, cannot edit items in an override of a Collection. */
+  if (from_collection != NULL && ID_IS_OVERRIDE_LIBRARY(from_collection)) {
+    return false;
+  }
+
   /* Get collections. */
   if (GS(id->name) == ID_GR) {
     if (id == &to_collection->id) {
@@ -1141,6 +1142,12 @@ static bool collection_drop_init(bContext *C,
     insert_type = TE_INSERT_INTO;
   }
 
+  /* Currently this should not be allowed, cannot edit items in an override of a Collection. */
+  if (ID_IS_OVERRIDE_LIBRARY(to_collection) &&
+      !ELEM(insert_type, TE_INSERT_AFTER, TE_INSERT_BEFORE)) {
+    return false;
+  }
+
   data->from = from_collection;
   data->to = to_collection;
   data->te = te;



More information about the Bf-blender-cvs mailing list