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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <b.mont29@gmail.com>2020-03-11 14:47:25 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-03-11 14:53:10 +0300
commit68c0d77b0c95a0fca89ca010f9666c4fc3eb9598 (patch)
tree1c14c1f64de18b1563c87a81688459f3608c86e5 /source
parent8820ab41bda7d639ec7eca3c7b473d903f01238e (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')
-rw-r--r--source/blender/blenkernel/BKE_lib_query.h12
-rw-r--r--source/blender/blenkernel/intern/collection.c6
-rw-r--r--source/blender/blenkernel/intern/lib_id.c8
-rw-r--r--source/blender/blenkernel/intern/lib_query.c28
-rw-r--r--source/blender/blenkernel/intern/lib_remap.c6
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/blenloader/intern/versioning_280.c4
-rw-r--r--source/blender/makesdna/DNA_ID.h18
-rw-r--r--source/blender/makesrna/intern/rna_access.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
13 files changed, 52 insertions, 44 deletions
diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h
index 33633e59e4d..5b4aa019441 100644
--- a/source/blender/blenkernel/BKE_lib_query.h
+++ b/source/blender/blenkernel/BKE_lib_query.h
@@ -55,14 +55,14 @@ enum {
IDWALK_CB_INDIRECT_USAGE = (1 << 2),
/**
- * That ID is used as mere sub-data by its owner
- * (only case currently: those f***ing nodetrees in materials etc.).
- * This means callback shall not *do* anything,
- * only use this as informative data if it needs it.
+ * That ID is used as mere sub-data by its owner (only case currently: those root nodetrees in
+ * materials etc., and the Scene's master collections).
+ * This means callback shall not *do* anything, only use this as informative data if it needs it.
*/
- IDWALK_CB_PRIVATE = (1 << 3),
+ IDWALK_CB_EMBEDDED = (1 << 3),
- /** That ID is not really used by its owner, it's just an internal hint/helper.
+ /**
+ * That ID is not really used by its owner, it's just an internal hint/helper.
* This addresses Their Highest Ugliness the 'from' pointers: Object->from_proxy and Key->from.
* How to handle that kind of cases totally depends on what caller code is doing... */
IDWALK_CB_LOOPBACK = (1 << 4),
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));
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 01ab4c0603a..d3f41945553 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7790,7 +7790,7 @@ static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data)
{
const int cb_flag = cb_data->cb_flag;
ID **id_pointer = cb_data->id_pointer;
- if (cb_flag & IDWALK_CB_PRIVATE || *id_pointer == NULL) {
+ if (cb_flag & IDWALK_CB_EMBEDDED || *id_pointer == NULL) {
return IDWALK_RET_NOP;
}
@@ -7801,7 +7801,7 @@ static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data)
Collection *collection = (Collection *)*id_pointer;
if (collection->flag & COLLECTION_IS_MASTER) {
/* We should never reach that point anymore, since master collection private ID should be
- * properly tagged with IDWALK_CB_PRIVATE. */
+ * properly tagged with IDWALK_CB_EMBEDDED. */
BLI_assert(0);
return IDWALK_RET_NOP;
}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index b19ba351795..77eed5be223 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4089,7 +4089,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
FOREACH_MAIN_ID_BEGIN (bmain, id) {
bNodeTree *ntree = ntreeFromID(id);
if (ntree) {
- ntree->id.flag |= LIB_PRIVATE_DATA;
+ ntree->id.flag |= LIB_EMBEDDED_DATA;
}
}
FOREACH_MAIN_ID_END;
@@ -4106,7 +4106,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Older files do not have a master collection, which is then added through
* `BKE_collection_master_add()`, so everything is fine. */
if (scene->master_collection != NULL) {
- scene->master_collection->id.flag |= LIB_PRIVATE_DATA;
+ scene->master_collection->id.flag |= LIB_EMBEDDED_DATA;
}
}
}
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 3ac93a96661..40916cbdc61 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -465,16 +465,20 @@ typedef enum ID_Type {
if ((a) && (a)->id.newid) \
(a) = (void *)(a)->id.newid
-/* id->flag (persitent). */
+/** id->flag (persitent). */
enum {
- /* Don't delete the datablock even if unused. */
+ /** Don't delete the datablock even if unused. */
LIB_FAKEUSER = 1 << 9,
- /* The datablock structure is a sub-object of a different one.
- * Direct persistent references are not allowed. */
- LIB_PRIVATE_DATA = 1 << 10,
- /* Datablock is from a library and linked indirectly, with LIB_TAG_INDIRECT
+ /**
+ * The data-block is a sub-data of another one.
+ * Direct persistent references are not allowed.
+ */
+ LIB_EMBEDDED_DATA = 1 << 10,
+ /**
+ * Datablock is from a library and linked indirectly, with LIB_TAG_INDIRECT
* tag set. But the current .blend file also has a weak pointer to it that
- * we want to restore if possible, and silently drop if it's missing. */
+ * we want to restore if possible, and silently drop if it's missing.
+ */
LIB_INDIRECT_WEAK_LINK = 1 << 11,
};
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 8dd6e6982dd..33f9b2da280 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -5832,7 +5832,7 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
*r_path = "";
}
- if ((id != NULL) && (id->flag & LIB_PRIVATE_DATA)) {
+ if ((id != NULL) && (id->flag & LIB_EMBEDDED_DATA)) {
switch (GS(id->name)) {
case ID_NT:
if (r_path) {
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index ff81b4a15ff..c32ef3e6624 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -923,7 +923,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
if (DEG_get_original_id(id) != id) {
ret = PyUnicode_FromFormat("Evaluated %s %R", BKE_idcode_to_name(GS(id->name)), tmp_str);
}
- else if (RNA_struct_is_ID(self->ptr.type) && (id->flag & LIB_PRIVATE_DATA) == 0) {
+ else if (RNA_struct_is_ID(self->ptr.type) && (id->flag & LIB_EMBEDDED_DATA) == 0) {
ret = PyUnicode_FromFormat(
"bpy.data.%s[%R]", BKE_idcode_to_name_plural(GS(id->name)), tmp_str);
}
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index 1c1a1a26e3b..6344ed39b1b 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -98,7 +98,7 @@ static int foreach_libblock_id_user_map_callback(LibraryIDLinkCallbackData *cb_d
return IDWALK_RET_NOP;
}
- if (cb_flag & IDWALK_CB_PRIVATE) {
+ if (cb_flag & IDWALK_CB_EMBEDDED) {
/* We skip private pointers themselves, like root node trees, we'll 'link' their own ID
* pointers to their 'ID owner' instead. */
return IDWALK_RET_NOP;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index fc23cec3044..93ba5016ed7 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3340,7 +3340,7 @@ static int previews_id_ensure_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;
}