diff options
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 6 |
4 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index e0f89024420..db93193bfe3 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ * \note Use #STRINGIFY() rather than defining with quotes. */ #define BLENDER_VERSION 281 -#define BLENDER_SUBVERSION 4 +#define BLENDER_SUBVERSION 5 /** Several breakages with 280, e.g. collections vs layers. */ #define BLENDER_MINVERSION 280 #define BLENDER_MINSUBVERSION 0 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; } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index ed3b1613b2a..00c0ed561f7 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3704,12 +3704,23 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_MAIN_ID_END; } - { - /* Versioning code until next subversion bump goes here. */ + if (!MAIN_VERSION_ATLEAST(bmain, 281, 5)) { for (Brush *br = bmain->brushes.first; br; br = br->id.next) { if (br->ob_mode & OB_MODE_SCULPT && br->normal_radius_factor == 0.0f) { br->normal_radius_factor = 0.5f; } } + + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + /* Older files do not hqve a msater collection, which is then added through + * `BKE_collection_master_add()`, so everything is fine. */ + if (scene->master_collection != NULL) { + scene->master_collection->id.flag |= LIB_PRIVATE_DATA; + } + } + } + + { + /* Versioning code until next subversion bump goes here. */ } } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index bc015a378cc..531c2ef2003 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -41,6 +41,7 @@ #include "BLT_translation.h" #include "BKE_animsys.h" +#include "BKE_collection.h" #include "BKE_context.h" #include "BKE_idcode.h" #include "BKE_idprop.h" @@ -5778,6 +5779,11 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path) *r_path = "node_tree"; } return BKE_node_tree_find_owner_ID(bmain, (bNodeTree *)id); + case ID_GR: + if (r_path) { + *r_path = "collection"; + } + return (ID *)BKE_collection_master_scene_search(bmain, (Collection *)id); default: return NULL; |