Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2020-01-17 20:26:17 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2020-01-17 21:59:00 +0300
commit35b16e498586dec627a34818acc52c8f97c98cf5 (patch)
treebeadfb7f65011ed64d49fc2ca0235e7c04f6e4fe /source/blender/blenkernel
parent7b29956cc546b3e69c4181015d457d2ee47474ff (diff)
Cleanup: factorize collection handling in libquery code.
Both actual Collection datablocks and the horrible master collection should share the same code (there were already some differences, although probably not critical, but some callbacks from scene->master_collection did not have the 'not self' flag...).
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/library_query.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index ca3da0d89c7..974d6328fcb 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -340,6 +340,23 @@ static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBas
FOREACH_FINALIZE_VOID;
}
+/* Used by both real Collection data-blokcs, and the fake horror of master collection from Scene.
+ */
+static void library_foreach_collection(LibraryForeachIDData *data, Collection *collection)
+{
+ for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
+ FOREACH_CALLBACK_INVOKE(data, cob->ob, IDWALK_CB_USER);
+ }
+ for (CollectionChild *child = collection->children.first; child; child = child->next) {
+ FOREACH_CALLBACK_INVOKE(data, child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
+ }
+ for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
+ FOREACH_CALLBACK_INVOKE(data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK);
+ }
+
+ FOREACH_FINALIZE_VOID;
+}
+
static void library_foreach_ID_as_subdata_link(ID **id_pp,
LibraryIDLinkCallback callback,
void *user_data,
@@ -484,14 +501,7 @@ static void library_foreach_ID_link(Main *bmain,
SEQ_END;
}
- for (CollectionObject *cob = scene->master_collection->gobject.first; cob;
- cob = cob->next) {
- CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER);
- }
- for (CollectionChild *child = scene->master_collection->children.first; child;
- child = child->next) {
- CALLBACK_INVOKE(child->collection, IDWALK_CB_USER);
- }
+ library_foreach_collection(&data, scene->master_collection);
ViewLayer *view_layer;
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
@@ -800,15 +810,7 @@ static void library_foreach_ID_link(Main *bmain,
case ID_GR: {
Collection *collection = (Collection *)id;
- for (CollectionObject *cob = collection->gobject.first; cob; cob = cob->next) {
- CALLBACK_INVOKE(cob->ob, IDWALK_CB_USER);
- }
- for (CollectionChild *child = collection->children.first; child; child = child->next) {
- CALLBACK_INVOKE(child->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_USER);
- }
- for (CollectionParent *parent = collection->parents.first; parent; parent = parent->next) {
- CALLBACK_INVOKE(parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK);
- }
+ library_foreach_collection(&data, collection);
break;
}