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!
This commit is contained in:
Bastien Montagne 2021-08-04 11:40:20 +02:00
parent d9a530c55e
commit 051141acde
1 changed files with 11 additions and 4 deletions

View File

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