[Bf-blender-cvs] [913b1fd29a8] master: BKE Collections: add helper to find the scene of a master collection.

Bastien Montagne noreply at git.blender.org
Tue Mar 12 15:48:44 CET 2019


Commit: 913b1fd29a8cb721c4cb001a10872e7c09e6bbfe
Author: Bastien Montagne
Date:   Tue Mar 12 14:57:59 2019 +0100
Branches: master
https://developer.blender.org/rB913b1fd29a8cb721c4cb001a10872e7c09e6bbfe

BKE Collections: add helper to find the scene of a master collection.

===================================================================

M	source/blender/blenkernel/BKE_collection.h
M	source/blender/blenkernel/intern/collection.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list