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:
authorDalai Felinto <dfelinto@gmail.com>2019-05-24 22:13:22 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-05-27 17:39:32 +0300
commit4ed6b891d5990c3e182d20f6c58b200be1a49cc6 (patch)
tree4fc0afeeac82baeec373692c1dea867476f52d58
parent40bde2a95d890c258bff62c2a88ddce64b633deb (diff)
Fix T63173: Dragging hidden collection inside a visible one unhides it
Same for holdout, indirect only and exclude. Reviewers: brecht Differential Revision: https://developer.blender.org/D4945
-rw-r--r--source/blender/blenkernel/intern/collection.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 68392bf0d03..e8d82ade7d3 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -1250,8 +1250,43 @@ bool BKE_collection_move(Main *bmain,
}
}
+ /* Make sure we store the flag of the layer collections before we remove and re-create them.
+ * Otherwise they will get lost and everything will be copied from the new parent collection. */
+ GHash *view_layer_hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
+
+ for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
+ for (ViewLayer *view_layer = scene->view_layers.first; view_layer;
+ view_layer = view_layer->next) {
+
+ LayerCollection *layer_collection = BKE_layer_collection_first_from_scene_collection(
+ view_layer, collection);
+
+ if (layer_collection == NULL) {
+ continue;
+ }
+
+ BLI_ghash_insert(view_layer_hash, view_layer, POINTER_FROM_INT(layer_collection->flag));
+ }
+ }
+
+ /* Create and remove layer collections. */
BKE_main_collection_sync(bmain);
+ /* Restore back the original layer collection flags. */
+ GHashIterator gh_iter;
+ GHASH_ITER (gh_iter, view_layer_hash) {
+ ViewLayer *view_layer = BLI_ghashIterator_getKey(&gh_iter);
+
+ LayerCollection *layer_collection = BKE_layer_collection_first_from_scene_collection(
+ view_layer, collection);
+
+ if (layer_collection) {
+ layer_collection->flag = POINTER_AS_INT(BLI_ghashIterator_getValue(&gh_iter));
+ }
+ }
+
+ BLI_ghash_free(view_layer_hash, NULL, NULL);
+
return true;
}