diff options
author | Bastien Montagne <b.mont29@gmail.com> | 2020-03-11 14:47:25 +0300 |
---|---|---|
committer | Bastien Montagne <b.mont29@gmail.com> | 2020-03-11 14:53:10 +0300 |
commit | 68c0d77b0c95a0fca89ca010f9666c4fc3eb9598 (patch) | |
tree | 1c14c1f64de18b1563c87a81688459f3608c86e5 /source/blender/blenkernel/intern | |
parent | 8820ab41bda7d639ec7eca3c7b473d903f01238e (diff) |
Cleanup: rename 'private' to 'embedded' for sub-data IDs.
'Private' can be a rather confusing term, especially when considering
its meaning in programming languages.
So now root node trees and master collections are 'embedded' IDs
instead.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 28 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_remap.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 2 |
5 files changed, 27 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 5c4636db728..d9954323594 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -89,7 +89,7 @@ static void collection_copy_data(Main *bmain, ID *id_dst, const ID *id_src, cons const Collection *collection_src = (const Collection *)id_src; BLI_assert(((collection_src->flag & COLLECTION_IS_MASTER) != 0) == - ((collection_src->id.flag & LIB_PRIVATE_DATA) != 0)); + ((collection_src->id.flag & LIB_EMBEDDED_DATA) != 0)); /* Do not copy collection's preview (same behavior as for objects). */ if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0 && false) { /* XXX TODO temp hack */ @@ -366,7 +366,7 @@ Collection *BKE_collection_duplicate(Main *bmain, const bool do_obdata) { /* It's not allowed to copy the master collection. */ - BLI_assert((collection->id.flag & LIB_PRIVATE_DATA) == 0); + BLI_assert((collection->id.flag & LIB_EMBEDDED_DATA) == 0); BLI_assert((collection->flag & COLLECTION_IS_MASTER) == 0); if (collection->flag & COLLECTION_IS_MASTER) { return NULL; @@ -514,7 +514,7 @@ Collection *BKE_collection_master_add() /* Not an actual datablock, but owned by scene. */ Collection *master_collection = MEM_callocN(sizeof(Collection), "Master Collection"); STRNCPY(master_collection->id.name, "GRMaster Collection"); - master_collection->id.flag |= LIB_PRIVATE_DATA; + master_collection->id.flag |= LIB_EMBEDDED_DATA; master_collection->flag |= COLLECTION_IS_MASTER; return master_collection; } diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 919f249eea6..c342185d0b8 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -340,7 +340,7 @@ static int lib_id_expand_local_cb(LibraryIDLinkCallbackData *cb_data) ID *id_self = cb_data->id_self; ID **id_pointer = cb_data->id_pointer; int const cb_flag = cb_data->cb_flag; - if (cb_flag & IDWALK_CB_PRIVATE) { + if (cb_flag & IDWALK_CB_EMBEDDED) { return IDWALK_RET_NOP; } @@ -1148,7 +1148,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int ori ID *new_id = *r_newid; int flag = orig_flag; - const bool is_private_id_data = (id->flag & LIB_PRIVATE_DATA) != 0; + const bool is_private_id_data = (id->flag & LIB_EMBEDDED_DATA) != 0; BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) != 0 || bmain != NULL); BLI_assert((flag & LIB_ID_CREATE_NO_MAIN) != 0 || (flag & LIB_ID_CREATE_NO_ALLOCATE) == 0); @@ -1167,7 +1167,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int ori } /* The id->flag bits to copy over. */ - const int copy_idflag_mask = LIB_PRIVATE_DATA; + const int copy_idflag_mask = LIB_EMBEDDED_DATA; if ((flag & LIB_ID_CREATE_NO_ALLOCATE) != 0) { /* r_newid already contains pointer to allocated memory. */ @@ -1744,7 +1744,7 @@ static void library_make_local_copying_check(ID *id, } /* Shapekeys are considered 'private' to their owner ID here, and never tagged - * (since they cannot be linked), * so we have to switch effective parent to their owner. + * (since they cannot be linked), so we have to switch effective parent to their owner. */ if (GS(par_id->name) == ID_KE) { par_id = ((Key *)par_id)->from; diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index ee27d0e546d..2a66624f88f 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,7 +531,7 @@ 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) { @@ -583,7 +587,7 @@ 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; + data.owner_id = (id->flag & LIB_EMBEDDED_DATA) ? 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). diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c index eade7467051..16d533b3d0e 100644 --- a/source/blender/blenkernel/intern/lib_remap.c +++ b/source/blender/blenkernel/intern/lib_remap.c @@ -94,7 +94,7 @@ static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data) { const int cb_flag = cb_data->cb_flag; - if (cb_flag & IDWALK_CB_PRIVATE) { + if (cb_flag & IDWALK_CB_EMBEDDED) { return IDWALK_RET_NOP; } @@ -108,7 +108,7 @@ static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data) /* Those asserts ensure the general sanity of ID tags regarding 'embeded' ID data (root nodetrees * and co). */ BLI_assert(id_owner == id_remap_data->id_owner); - BLI_assert(id_self == id_owner || (id_self->flag & LIB_PRIVATE_DATA) != 0); + BLI_assert(id_self == id_owner || (id_self->flag & LIB_EMBEDDED_DATA) != 0); if (!old_id) { /* Used to cleanup all IDs used by a specific one. */ BLI_assert(!new_id); @@ -653,7 +653,7 @@ void BKE_libblock_relink_ex( static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data) { const int cb_flag = cb_data->cb_flag; - if (cb_flag & IDWALK_CB_PRIVATE) { + if (cb_flag & IDWALK_CB_EMBEDDED) { return IDWALK_RET_NOP; } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 1feb20ec272..872ba1b38d7 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1654,7 +1654,7 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname) } else { ntree = MEM_callocN(sizeof(bNodeTree), "new node tree"); - ntree->id.flag |= LIB_PRIVATE_DATA; + ntree->id.flag |= LIB_EMBEDDED_DATA; *((short *)ntree->id.name) = ID_NT; BLI_strncpy(ntree->id.name + 2, name, sizeof(ntree->id.name)); } |