diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-12 16:57:59 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-12 17:48:24 +0300 |
commit | 913b1fd29a8cb721c4cb001a10872e7c09e6bbfe (patch) | |
tree | 46d747020d1601e538ee20655c4c9ad3d49e5b90 /source | |
parent | c10d011cc596727db8ff4622a8ae28fd2bb15b39 (diff) |
BKE Collections: add helper to find the scene of a master collection.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_collection.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 0390078fc7f..a4b68a8cba2 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -66,6 +66,7 @@ struct Collection *BKE_collection_copy_master(struct Main *bmain, struct Collect struct Collection *BKE_collection_master(const struct Scene *scene); struct Collection *BKE_collection_master_add(void); +struct Scene *BKE_collection_master_scene_search(const struct Main *bmain, const struct Collection *master_collection); /* Collection Objects */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index a4d2ee55de1..b00448cc8c3 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -483,6 +483,19 @@ Collection *BKE_collection_master(const Scene *scene) return scene->master_collection; } +Scene *BKE_collection_master_scene_search(const Main *bmain, const Collection *master_collection) +{ + BLI_assert((master_collection->flag & COLLECTION_IS_MASTER) != 0); + + for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { + if (scene->master_collection == master_collection) { + return scene; + } + } + + return NULL; +} + /*********************** Cyclic Checks ************************/ static bool collection_object_cyclic_check_internal(Object *object, Collection *collection) |