Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/object/object_collection.c')
-rw-r--r--source/blender/editors/object/object_collection.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c
index 054c9e1de46..39951c2ab6e 100644
--- a/source/blender/editors/object/object_collection.c
+++ b/source/blender/editors/object/object_collection.c
@@ -526,7 +526,7 @@ void OBJECT_OT_collection_link(wmOperatorType *ot)
ot->prop = prop;
}
-static int collection_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int collection_remove_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Object *ob = ED_object_context(C);
@@ -535,6 +535,12 @@ static int collection_remove_exec(bContext *C, wmOperator *UNUSED(op))
if (!ob || !collection) {
return OPERATOR_CANCELLED;
}
+ if (ID_IS_LINKED(collection) || ID_IS_OVERRIDE_LIBRARY(collection)) {
+ BKE_report(op->reports,
+ RPT_ERROR,
+ "Cannot remove an object from a linked or library override collection");
+ return OPERATOR_CANCELLED;
+ }
BKE_collection_object_remove(bmain, collection, ob, false);
@@ -561,7 +567,7 @@ void OBJECT_OT_collection_remove(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int collection_unlink_exec(bContext *C, wmOperator *UNUSED(op))
+static int collection_unlink_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Collection *collection = CTX_data_pointer_get_type(C, "collection", &RNA_Collection).data;
@@ -569,6 +575,14 @@ static int collection_unlink_exec(bContext *C, wmOperator *UNUSED(op))
if (!collection) {
return OPERATOR_CANCELLED;
}
+ if (ID_IS_OVERRIDE_LIBRARY(collection) &&
+ collection->id.override_library->hierarchy_root != &collection->id) {
+ BKE_report(op->reports,
+ RPT_ERROR,
+ "Cannot unlink a library override collection which is not the root of its override "
+ "hierarchy");
+ return OPERATOR_CANCELLED;
+ }
BKE_id_delete(bmain, collection);