[Bf-blender-cvs] [b114f285ac9] temp-T94185-id_remapping-experiment-a: Changed enum values and names.

Jeroen Bakker noreply at git.blender.org
Mon Jan 3 14:13:14 CET 2022


Commit: b114f285ac92ac4611ebd466978161a6ff768e3c
Author: Jeroen Bakker
Date:   Mon Jan 3 13:58:59 2022 +0100
Branches: temp-T94185-id_remapping-experiment-a
https://developer.blender.org/rBb114f285ac92ac4611ebd466978161a6ff768e3c

Changed enum values and names.

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

M	source/blender/blenkernel/BKE_lib_remap.h
M	source/blender/blenkernel/intern/lib_id_remapper.cc
M	source/blender/blenkernel/intern/lib_id_remapper_test.cc
M	source/blender/editors/space_buttons/space_buttons.c
M	source/blender/editors/space_node/space_node.cc
M	source/blender/editors/space_outliner/space_outliner.c
M	source/blender/editors/space_spreadsheet/space_spreadsheet.cc
M	source/blender/editors/space_view3d/space_view3d.c

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

diff --git a/source/blender/blenkernel/BKE_lib_remap.h b/source/blender/blenkernel/BKE_lib_remap.h
index 7de7e9af659..9af70d0dcd5 100644
--- a/source/blender/blenkernel/BKE_lib_remap.h
+++ b/source/blender/blenkernel/BKE_lib_remap.h
@@ -173,19 +173,20 @@ void BKE_library_callback_remap_editor_id_reference_set(
 struct IDRemapper;
 typedef enum IDRemapperApplyResult {
   /** No remapping rules available for the source. */
-  ID_REMAP_SOURCE_UNAVAILABLE,
+  ID_REMAP_RESULT_SOURCE_UNAVAILABLE,
   /** Source isn't mappable (fe NULL). */
-  ID_REMAP_SOURCE_NOT_MAPPABLE,
+  ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE,
   /** Source has been remapped to a new pointer. */
-  ID_REMAP_SOURCE_REMAPPED,
+  ID_REMAP_RESULT_SOURCE_REMAPPED,
   /** Source has been set to NULL. */
-  ID_REMAP_SOURCE_UNASSIGNED,
+  ID_REMAP_RESULT_SOURCE_UNASSIGNED,
 } IDRemapperApplyResult;
 
 typedef enum IDRemapperApplyOptions {
-  ID_REMAP_APPLY_DEFAULT = 0,
   ID_REMAP_APPLY_UPDATE_REFCOUNT = (1 << 0),
   ID_REMAP_APPLY_ENSURE_REAL = (1 << 1),
+
+  ID_REMAP_APPLY_DEFAULT = 0,
 } IDRemapperApplyOptions;
 
 typedef void (*IDRemapperIterFunction)(struct ID *old_id, struct ID *new_id, void *user_data);
diff --git a/source/blender/blenkernel/intern/lib_id_remapper.cc b/source/blender/blenkernel/intern/lib_id_remapper.cc
index 2daf5b784c6..b4271d88d41 100644
--- a/source/blender/blenkernel/intern/lib_id_remapper.cc
+++ b/source/blender/blenkernel/intern/lib_id_remapper.cc
@@ -45,11 +45,11 @@ struct IDRemapper {
   {
     BLI_assert(id_ptr_ptr != nullptr);
     if (*id_ptr_ptr == nullptr) {
-      return ID_REMAP_SOURCE_NOT_MAPPABLE;
+      return ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE;
     }
 
     if (!mappings.contains(*id_ptr_ptr)) {
-      return ID_REMAP_SOURCE_UNAVAILABLE;
+      return ID_REMAP_RESULT_SOURCE_UNAVAILABLE;
     }
 
     if (options & ID_REMAP_APPLY_UPDATE_REFCOUNT) {
@@ -58,7 +58,7 @@ struct IDRemapper {
 
     *id_ptr_ptr = mappings.lookup(*id_ptr_ptr);
     if (*id_ptr_ptr == nullptr) {
-      return ID_REMAP_SOURCE_UNASSIGNED;
+      return ID_REMAP_RESULT_SOURCE_UNASSIGNED;
     }
 
     if (options & ID_REMAP_APPLY_UPDATE_REFCOUNT) {
@@ -68,7 +68,7 @@ struct IDRemapper {
     if (options & ID_REMAP_APPLY_ENSURE_REAL) {
       id_us_ensure_real(*id_ptr_ptr);
     }
-    return ID_REMAP_SOURCE_REMAPPED;
+    return ID_REMAP_RESULT_SOURCE_REMAPPED;
   }
 
   void iter(IDRemapperIterFunction func, void *user_data) const
diff --git a/source/blender/blenkernel/intern/lib_id_remapper_test.cc b/source/blender/blenkernel/intern/lib_id_remapper_test.cc
index ba99fdaca05..9eed277aade 100644
--- a/source/blender/blenkernel/intern/lib_id_remapper_test.cc
+++ b/source/blender/blenkernel/intern/lib_id_remapper_test.cc
@@ -30,7 +30,7 @@ TEST(lib_id_remapper, unavailable)
 
   IDRemapper *remapper = BKE_id_remapper_create();
   IDRemapperApplyResult result = BKE_id_remapper_apply(remapper, &idp, ID_REMAP_APPLY_DEFAULT);
-  EXPECT_EQ(result, ID_REMAP_SOURCE_UNAVAILABLE);
+  EXPECT_EQ(result, ID_REMAP_RESULT_SOURCE_UNAVAILABLE);
 
   BKE_id_remapper_free(remapper);
 }
@@ -41,7 +41,7 @@ TEST(lib_id_remapper, not_mappable)
 
   IDRemapper *remapper = BKE_id_remapper_create();
   IDRemapperApplyResult result = BKE_id_remapper_apply(remapper, &idp, ID_REMAP_APPLY_DEFAULT);
-  EXPECT_EQ(result, ID_REMAP_SOURCE_NOT_MAPPABLE);
+  EXPECT_EQ(result, ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE);
 
   BKE_id_remapper_free(remapper);
 }
@@ -55,7 +55,7 @@ TEST(lib_id_remapper, mapped)
   IDRemapper *remapper = BKE_id_remapper_create();
   BKE_id_remapper_add(remapper, &id1, &id2);
   IDRemapperApplyResult result = BKE_id_remapper_apply(remapper, &idp, ID_REMAP_APPLY_DEFAULT);
-  EXPECT_EQ(result, ID_REMAP_SOURCE_REMAPPED);
+  EXPECT_EQ(result, ID_REMAP_RESULT_SOURCE_REMAPPED);
   EXPECT_EQ(idp, &id2);
 
   BKE_id_remapper_free(remapper);
@@ -69,7 +69,7 @@ TEST(lib_id_remapper, unassigned)
   IDRemapper *remapper = BKE_id_remapper_create();
   BKE_id_remapper_add(remapper, &id1, nullptr);
   IDRemapperApplyResult result = BKE_id_remapper_apply(remapper, &idp, ID_REMAP_APPLY_DEFAULT);
-  EXPECT_EQ(result, ID_REMAP_SOURCE_UNASSIGNED);
+  EXPECT_EQ(result, ID_REMAP_RESULT_SOURCE_UNASSIGNED);
   EXPECT_EQ(idp, nullptr);
 
   BKE_id_remapper_free(remapper);
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index cf9fb7f1b27..96812240371 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -868,7 +868,7 @@ static void buttons_id_remap(ScrArea *UNUSED(area),
   SpaceProperties *sbuts = (SpaceProperties *)slink;
 
   if (BKE_id_remapper_apply(mappings, &sbuts->pinid, ID_REMAP_APPLY_DEFAULT) ==
-      ID_REMAP_SOURCE_UNASSIGNED) {
+      ID_REMAP_RESULT_SOURCE_UNASSIGNED) {
     sbuts->flag &= ~SB_PIN_CONTEXT;
   }
 
@@ -877,7 +877,7 @@ static void buttons_id_remap(ScrArea *UNUSED(area),
 
     for (int i = 0; i < path->len; i++) {
       switch (BKE_id_remapper_apply(mappings, &path->ptr[i].owner_id, ID_REMAP_APPLY_DEFAULT)) {
-        case ID_REMAP_SOURCE_UNASSIGNED: {
+        case ID_REMAP_RESULT_SOURCE_UNASSIGNED: {
           if (i == 0) {
             MEM_SAFE_FREE(sbuts->path);
           }
@@ -887,7 +887,7 @@ static void buttons_id_remap(ScrArea *UNUSED(area),
           }
           break;
         }
-        case ID_REMAP_SOURCE_REMAPPED: {
+        case ID_REMAP_RESULT_SOURCE_REMAPPED: {
           RNA_id_pointer_create(path->ptr[i].owner_id, &path->ptr[i]);
           /* There is no easy way to check/make path downwards valid, just nullify it.
            * Next redraw will rebuild this anyway. */
@@ -897,8 +897,8 @@ static void buttons_id_remap(ScrArea *UNUSED(area),
           break;
         }
 
-        case ID_REMAP_SOURCE_NOT_MAPPABLE:
-        case ID_REMAP_SOURCE_UNAVAILABLE: {
+        case ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE:
+        case ID_REMAP_RESULT_SOURCE_UNAVAILABLE: {
           /* Nothing to do. */
           break;
         }
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index b633eac3235..321c10338f5 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -899,8 +899,8 @@ static void node_id_remap(ScrArea *UNUSED(area),
   SpaceNode *snode = (SpaceNode *)slink;
 
   if (ELEM(BKE_id_remapper_apply(mappings, &snode->id, ID_REMAP_APPLY_DEFAULT),
-           ID_REMAP_SOURCE_REMAPPED,
-           ID_REMAP_SOURCE_UNASSIGNED)) {
+           ID_REMAP_RESULT_SOURCE_REMAPPED,
+           ID_REMAP_RESULT_SOURCE_UNASSIGNED)) {
     /* nasty DNA logic for SpaceNode:
      * ideally should be handled by editor code, but would be bad level call
      */
@@ -912,7 +912,7 @@ static void node_id_remap(ScrArea *UNUSED(area),
     snode->edittree = nullptr;
   }
   if (BKE_id_remapper_apply(mappings, &snode->from, ID_REMAP_APPLY_DEFAULT) ==
-      ID_REMAP_SOURCE_UNASSIGNED) {
+      ID_REMAP_RESULT_SOURCE_UNASSIGNED) {
     snode->flag &= ~SNODE_PIN;
   }
   BKE_id_remapper_apply(mappings, (ID **)&snode->gpd, ID_REMAP_APPLY_UPDATE_REFCOUNT);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 0cc9ffb26ed..a4f20c1b91b 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -417,15 +417,15 @@ static void outliner_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRe
   BLI_mempool_iternew(space_outliner->treestore, &iter);
   while ((tselem = BLI_mempool_iterstep(&iter))) {
     switch (BKE_id_remapper_apply(mappings, &tselem->id, ID_REMAP_APPLY_DEFAULT)) {
-      case ID_REMAP_SOURCE_REMAPPED:
+      case ID_REMAP_RESULT_SOURCE_REMAPPED:
         changed = true;
         break;
-      case ID_REMAP_SOURCE_UNASSIGNED:
+      case ID_REMAP_RESULT_SOURCE_UNASSIGNED:
         changed = true;
         unassigned = true;
         break;
-      case ID_REMAP_SOURCE_UNAVAILABLE:
-      case ID_REMAP_SOURCE_NOT_MAPPABLE:
+      case ID_REMAP_RESULT_SOURCE_UNAVAILABLE:
+      case ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE:
         break;
     }
   }
diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
index 5e0008063e4..110b880e1e2 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -184,7 +184,7 @@ static void spreadsheet_id_remap(ScrArea *UNUSED(area),
     SpreadsheetContextObject *object_context = (SpreadsheetContextObject *)context;
     if (BKE_id_remapper_apply(mappings,
                               ((ID **)&object_context->object),
-                              ID_REMAP_APPLY_DEFAULT) == ID_REMAP_SOURCE_REMAPPED) {
+                              ID_REMAP_APPLY_DEFAULT) == ID_REMAP_RESULT_SOURCE_REMAPPED) {
       if (object_context->object != nullptr && GS(object_context->object->id.name) != ID_OB) {
         object_context->object = nullptr;
       }
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index b9bd9ca1f5e..0a5bebac8a8 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1817,7 +1817,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 static void view3d_id_remap_v3d_ob_centers(View3D *v3d, const struct IDRemapper *mappings)
 {
   if (BKE_id_remapper_apply(mappings, (ID **)&v3d->ob_center, ID_REMAP_APPLY_DEFAULT) ==
-      ID_REMAP_SOURCE_UNASSIGNED) {
+      ID_REMAP_RESULT_SOURCE_UNASSIGNED) {
     /* Otherwise, bonename may remain valid...
      * We could be smart and check this, too? */
     v3d->ob_center_bone[0] = '\0';
@@ -1832,7 +1832,7 @@ static void view3d_id_remap_v3d(ScrArea *area,
 {
   ARegion *region;
   if (BKE_id_remapper_apply(mappings, (ID **)&v3d->camera, ID_REMAP_APPLY_DEFAULT) ==
-      ID_REMAP_SOURCE_UNASSIGNED) {
+      ID_REMAP_RESULT_SOURCE_UNASSIGNED) {
     /* 3D view might be inactive,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list