[Bf-blender-cvs] [4b5570533df] master: Fix (unreported) Outliner could add (link...) a collection to a linked scene/collection.

Bastien Montagne noreply at git.blender.org
Tue Mar 12 15:48:55 CET 2019


Commit: 4b5570533dff28100ce569dd08025505d678b788
Author: Bastien Montagne
Date:   Tue Mar 12 15:47:07 2019 +0100
Branches: master
https://developer.blender.org/rB4b5570533dff28100ce569dd08025505d678b788

Fix (unreported) Outliner could add (link...) a collection to a linked scene/collection.

Think that's the last case... At least for now.

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

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

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

diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index b79f93781d2..30eaefe6149 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -562,7 +562,7 @@ void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
 
 /**************************** Link Collection ******************************/
 
-static int collection_link_exec(bContext *C, wmOperator *UNUSED(op))
+static int collection_link_exec(bContext *C, wmOperator *op)
 {
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = CTX_data_scene(C);
@@ -570,6 +570,13 @@ static int collection_link_exec(bContext *C, wmOperator *UNUSED(op))
 	SpaceOutliner *soops = CTX_wm_space_outliner(C);
 	struct CollectionEditData data = {.scene = scene, .soops = soops,};
 
+	if (ID_IS_LINKED(active_collection) ||
+	    ((active_collection->flag & COLLECTION_IS_MASTER) && ID_IS_LINKED(scene)))
+	{
+		BKE_report(op->reports, RPT_ERROR, "Cannot add a colection to a linked collection/scene");
+		return OPERATOR_CANCELLED;
+	}
+
 	data.collections_to_edit = BLI_gset_ptr_new(__func__);
 
 	/* We first walk over and find the Collections we actually want to link (ignoring duplicates). */



More information about the Bf-blender-cvs mailing list