diff options
author | Hans Goudey <h.goudey@me.com> | 2020-11-16 19:00:23 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-11-16 19:00:23 +0300 |
commit | c48063d1f64bd8cb102bbd9cdc7c58e861e654dc (patch) | |
tree | c5f6fff8c9ff2c4f1b5cb4627ab2976d197dee64 /source/blender/blenkernel/intern/collection.c | |
parent | 13bcb000fa81effa3c8302b2faba853c93a6c573 (diff) | |
parent | c645da98d8727e636c14383f4c10706c6cc5ead2 (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 7ab63810719..ab92480cce2 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1864,15 +1864,23 @@ 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. */ + * Otherwise they will get lost and everything will be copied from the new parent collection. + * Don't use flag syncing when moving a collection to a different scene, as it no longer exists + * in the same view layers anyway. */ + const bool do_flag_sync = BKE_scene_find_from_collection(bmain, to_parent) == + BKE_scene_find_from_collection(bmain, collection); ListBase layer_flags; - layer_collection_flags_store(bmain, collection, &layer_flags); + if (do_flag_sync) { + layer_collection_flags_store(bmain, collection, &layer_flags); + } /* Create and remove layer collections. */ BKE_main_collection_sync(bmain); /* Restore the original layer collection flags. */ - layer_collection_flags_restore(&layer_flags, collection); + if (do_flag_sync) { + layer_collection_flags_restore(&layer_flags, collection); + } /* We need to sync it again to pass the correct flags to the collections objects. */ BKE_main_collection_sync(bmain); |