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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-12 17:37:09 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-12 17:48:24 +0300
commit9778b0a5bc24b82b9ea32a7a28c564eec58ebc67 (patch)
treee17fe779d84f39ee216804467baf41596696634a /source/blender/editors/space_outliner
parent07c8b829b51f1d59a214b229251902792735b92a (diff)
Fix T62488: Can delete collection from indirect linked library.
Same issue as with previous commits for other Collection Outlier's operations, checks are always different though...
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 04104aa0e4c..b79f93781d2 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -290,7 +290,39 @@ static int collection_delete_exec(bContext *C, wmOperator *op)
/* Test in case collection got deleted as part of another one. */
if (BLI_findindex(&bmain->collections, collection) != -1) {
- BKE_collection_delete(bmain, collection, hierarchy);
+ /* We cannot allow to delete collections that are indirectly linked, or that are used by (linked to...)
+ * other linked scene/collection. */
+ bool skip = false;
+ if (ID_IS_LINKED(collection)) {
+ if (collection->id.tag & LIB_TAG_INDIRECT) {
+ skip = true;
+ }
+ else {
+ for (CollectionParent *cparent = collection->parents.first; cparent; cparent = cparent->next) {
+ Collection *parent = cparent->collection;
+ if (ID_IS_LINKED(parent)) {
+ skip = true;
+ break;
+ }
+ else if (parent->flag & COLLECTION_IS_MASTER) {
+ Scene *parent_scene = BKE_collection_master_scene_search(bmain, parent);
+ if (ID_IS_LINKED(parent_scene)) {
+ skip = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (!skip) {
+ BKE_collection_delete(bmain, collection, hierarchy);
+ }
+ else {
+ BKE_reportf(op->reports, RPT_WARNING,
+ "Cannot delete linked collection '%s', it is used by other linked scenes/collections",
+ collection->id.name + 2);
+ }
}
}