[Bf-blender-cvs] [68c0d77b0c9] master: Cleanup: rename 'private' to 'embedded' for sub-data IDs.

Bastien Montagne noreply at git.blender.org
Wed Mar 11 12:53:15 CET 2020


Commit: 68c0d77b0c95a0fca89ca010f9666c4fc3eb9598
Author: Bastien Montagne
Date:   Wed Mar 11 12:47:25 2020 +0100
Branches: master
https://developer.blender.org/rB68c0d77b0c95a0fca89ca010f9666c4fc3eb9598

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.

===================================================================

M	source/blender/blenkernel/BKE_lib_query.h
M	source/blender/blenkernel/intern/collection.c
M	source/blender/blenkernel/intern/lib_id.c
M	source/blender/blenkernel/intern/lib_query.c
M	source/blender/blenkernel/intern/lib_remap.c
M	source/blender/blenkernel/intern/node.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/python/intern/bpy_rna.c
M	source/blender/python/intern/bpy_rna_id_collection.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

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/so

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list