Commit: 35b16e498586dec627a34818acc52c8f97c98cf5
Author: Bastien Montagne
Date: Fri Jan 17 18:26:17 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB35b16e498586dec627a34818acc52c8f97c98cf5
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...).
===================================================================
M source/blender/blenkernel/intern/library_query.c
===================================================================
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;
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs