diff options
-rw-r--r-- | source/blender/editors/object/object_collection.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_dragdrop.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_collection.c | 17 |
3 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c index 7554c4efeda..0822697d265 100644 --- a/source/blender/editors/object/object_collection.c +++ b/source/blender/editors/object/object_collection.c @@ -481,6 +481,22 @@ static int collection_link_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } + /* Currently this should not be allowed (might be supported in the future though...). */ + if (ID_IS_OVERRIDE_LIBRARY(&collection->id)) { + BKE_report(op->reports, + RPT_ERROR, + "Could not add the collection because it is overridden."); + return OPERATOR_CANCELLED; + } + /* Linked collections are already checked for by using RNA_collection_local_itemf + * but operator can be called without invoke */ + if (ID_IS_LINKED(&collection->id)) { + BKE_report(op->reports, + RPT_ERROR, + "Could not add the collection because it is linked."); + return OPERATOR_CANCELLED; + } + /* Adding object to collection which is used as dupli-collection for self is bad idea. * * It is also bad idea to add object to collection which is in collection which diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 44e5347dcad..c2c9f3a5bfb 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -675,6 +675,10 @@ 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) { diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 709be0cf842..fe64ead3f89 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -82,6 +82,23 @@ static void rna_Collection_objects_link(Collection *collection, ReportList *reports, Object *object) { + /* Currently this should not be allowed (might be supported in the future though...). */ + if (ID_IS_OVERRIDE_LIBRARY(&collection->id)) { + BKE_reportf(reports, + RPT_ERROR, + "Could not link the object '%s' because the collection '%s' is overridden.", + object->id.name + 2, + collection->id.name + 2); + return; + } + if (ID_IS_LINKED(&collection->id)) { + BKE_reportf(reports, + RPT_ERROR, + "Could not link the object '%s' because the collection '%s' is linked.", + object->id.name + 2, + collection->id.name + 2); + return; + } if (!BKE_collection_object_add(bmain, collection, object)) { BKE_reportf(reports, RPT_ERROR, |