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:
Diffstat (limited to 'source/blender/blenkernel/intern/lib_query.c')
-rw-r--r--source/blender/blenkernel/intern/lib_query.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index ee27d0e546d..41d938e897d 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -137,11 +137,15 @@ enum {
typedef struct LibraryForeachIDData {
Main *bmain;
- /* 'Real' ID, the one that might be in bmain, only differs from self_id when the later is a
- * private one. */
+ /**
+ * 'Real' ID, the one that might be in bmain, only differs from self_id when the later is a
+ * private one.
+ */
ID *owner_id;
- /* ID from which the current ID pointer is being processed. It may be a 'private' ID like master
- * collection or root node tree. */
+ /**
+ * ID from which the current ID pointer is being processed. It may be an embedded ID like master
+ * collection or root node tree.
+ */
ID *self_id;
int flag;
@@ -343,8 +347,8 @@ static void library_foreach_layer_collection(LibraryForeachIDData *data, ListBas
/* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
* anyway... */
const int cb_flag = (lc->collection != NULL &&
- (lc->collection->id.flag & LIB_PRIVATE_DATA) != 0) ?
- IDWALK_CB_PRIVATE :
+ (lc->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
+ IDWALK_CB_EMBEDDED :
IDWALK_CB_NOP;
FOREACH_CALLBACK_INVOKE(data, lc->collection, cb_flag);
library_foreach_layer_collection(data, &lc->layer_collections);
@@ -367,8 +371,8 @@ static void library_foreach_collection(LibraryForeachIDData *data, Collection *c
/* XXX This is very weak. The whole idea of keeping pointers to private IDs is very bad
* anyway... */
const int cb_flag = ((parent->collection != NULL &&
- (parent->collection->id.flag & LIB_PRIVATE_DATA) != 0) ?
- IDWALK_CB_PRIVATE :
+ (parent->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
+ IDWALK_CB_EMBEDDED :
IDWALK_CB_NOP);
FOREACH_CALLBACK_INVOKE(
data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK | cb_flag);
@@ -484,13 +488,13 @@ static void library_foreach_screen_area(LibraryForeachIDData *data, ScrArea *are
FOREACH_CALLBACK_INVOKE_ID(data, snode->from, IDWALK_CB_NOP);
FOREACH_CALLBACK_INVOKE(
- data, snode->nodetree, is_private_nodetree ? IDWALK_CB_PRIVATE : IDWALK_CB_USER);
+ data, snode->nodetree, is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_USER);
for (path = snode->treepath.first; path; path = path->next) {
if (path == snode->treepath.first) {
/* first nodetree in path is same as snode->nodetree */
FOREACH_CALLBACK_INVOKE(
- data, path->nodetree, is_private_nodetree ? IDWALK_CB_PRIVATE : IDWALK_CB_NOP);
+ data, path->nodetree, is_private_nodetree ? IDWALK_CB_EMBEDDED : IDWALK_CB_NOP);
}
else {
FOREACH_CALLBACK_INVOKE(data, path->nodetree, IDWALK_CB_USER);
@@ -527,10 +531,13 @@ static void library_foreach_ID_as_subdata_link(ID **id_pp,
{
/* Needed e.g. for callbacks handling relationships... This call shall be absolutely readonly. */
ID *id = *id_pp;
- FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pp, IDWALK_CB_PRIVATE);
+ FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pp, IDWALK_CB_EMBEDDED);
BLI_assert(id == *id_pp);
- if (flag & IDWALK_RECURSE) {
+ if (flag & IDWALK_IGNORE_EMBEDDED_ID) {
+ /* Do Nothing. */
+ }
+ else if (flag & IDWALK_RECURSE) {
/* Defer handling into main loop, recursively calling BKE_library_foreach_ID_link in
* IDWALK_RECURSE case is troublesome, see T49553. */
/* XXX note that this breaks the 'owner id' thing now, we likely want to handle that
@@ -583,7 +590,12 @@ static void library_foreach_ID_link(Main *bmain,
for (; id != NULL; id = (flag & IDWALK_RECURSE) ? BLI_LINKSTACK_POP(data.ids_todo) : NULL) {
data.self_id = id;
- data.owner_id = (id->flag & LIB_PRIVATE_DATA) ? id_owner : data.self_id;
+ /* Note that we may call this functions sometime directly on an embedded ID, without any
+ * knowledge of the owner ID then.
+ * While not great, and that should be probably sanitized at some point, we cal live with it
+ * for now. */
+ data.owner_id = ((id->flag & LIB_EMBEDDED_DATA) != 0 && id_owner != NULL) ? id_owner :
+ data.self_id;
/* inherit_data is non-NULL when this function is called for some sub-data ID
* (like root nodetree of a material).