diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-02 13:14:51 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-02 19:39:08 +0300 |
commit | 64efbbca8e24664e9105a4c2db02ccafb45a8b16 (patch) | |
tree | 01e433c713c502b9c4bbaf64797058b7e56c0a25 /source/blender/blenkernel/intern/collection.c | |
parent | 283d96de1170f7c42a43bde4e30fdb438939978f (diff) |
Make Scene Master collection 'Private' ID data, like root nodetrees.
Same issue here as with root nodetrees, those are private ID data owned
by another ID, and not in Main DB. This requires special handling.
there are still quiet a few things to do here, like getting rid of
special code for master collection (regular ID copying should handle
that just as it already does for root nodetrees), cleanup in ID copying
code, etc.
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 2031576190e..06710b40569 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -338,8 +338,9 @@ Collection *BKE_collection_duplicate(Main *bmain, const bool do_obdata) { /* It's not allowed to copy the master collection. */ + BLI_assert((collection->id.flag & LIB_PRIVATE_DATA) == 0); + BLI_assert((collection->flag & COLLECTION_IS_MASTER) == 0); if (collection->flag & COLLECTION_IS_MASTER) { - BLI_assert("!Master collection can't be duplicated"); return NULL; } @@ -368,6 +369,7 @@ Collection *BKE_collection_duplicate(Main *bmain, Collection *BKE_collection_copy_master(Main *bmain, Collection *collection, const int flag) { BLI_assert(collection->flag & COLLECTION_IS_MASTER); + BLI_assert(collection->id.flag & LIB_PRIVATE_DATA); Collection *collection_dst = MEM_dupallocN(collection); BKE_collection_copy_data(bmain, collection_dst, collection, flag); @@ -499,6 +501,7 @@ Collection *BKE_collection_master_add() /* Not an actual datablock, but owned by scene. */ Collection *master_collection = MEM_callocN(sizeof(Collection), "Master Collection"); STRNCPY(master_collection->id.name, "GRMaster Collection"); + master_collection->id.flag |= LIB_PRIVATE_DATA; master_collection->flag |= COLLECTION_IS_MASTER; return master_collection; } |