[Bf-blender-cvs] [b8d98645180] master: Cleanup: remove unused Main argument to RNA_path functions

Campbell Barton noreply at git.blender.org
Wed Sep 7 03:09:51 CEST 2022


Commit: b8d986451805f324b0ba98f4b57b4cf89cee04ed
Author: Campbell Barton
Date:   Wed Sep 7 11:07:44 2022 +1000
Branches: master
https://developer.blender.org/rBb8d986451805f324b0ba98f4b57b4cf89cee04ed

Cleanup: remove unused Main argument to RNA_path functions

Note that lib_override functions have kept the unused argument,
but this may be removed too. It impacts many lib_override functions
so this can be handled separately.

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

M	source/blender/blenkernel/intern/lib_override.cc
M	source/blender/editors/interface/interface_ops.cc
M	source/blender/editors/interface/interface_region_tooltip.cc
M	source/blender/editors/space_console/space_console.c
M	source/blender/editors/space_text/space_text.c
M	source/blender/makesrna/RNA_path.h
M	source/blender/makesrna/intern/rna_access.c
M	source/blender/makesrna/intern/rna_access_compare_override.c
M	source/blender/makesrna/intern/rna_path.cc
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc
index a6f41868453..a85a6c5730f 100644
--- a/source/blender/blenkernel/intern/lib_override.cc
+++ b/source/blender/blenkernel/intern/lib_override.cc
@@ -92,9 +92,9 @@ BLI_INLINE void lib_override_object_posemode_transfer(ID *id_dst, ID *id_src)
 }
 
 /** Get override data for a given ID. Needed because of our beloved shape keys snowflake. */
-BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main *bmain,
+BLI_INLINE const IDOverrideLibrary *BKE_lib_override_library_get(const Main * /*bmain*/,
                                                                  const ID *id,
-                                                                 const ID *owner_id_hint,
+                                                                 const ID * /*owner_id_hint*/,
                                                                  const ID **r_owner_id)
 {
   if (r_owner_id != nullptr) {
@@ -2208,7 +2208,7 @@ static bool lib_override_resync_id_lib_level_is_valid(ID *id,
 }
 
 /* Find the root of the override hierarchy the given `id` belongs to. */
-static ID *lib_override_library_main_resync_root_get(Main *bmain, ID *id)
+static ID *lib_override_library_main_resync_root_get(Main * /*bmain*/, ID *id)
 {
   if (!ID_IS_OVERRIDE_LIBRARY_REAL(id)) {
     const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc
index a42e08c59d5..a5b0193a86d 100644
--- a/source/blender/editors/interface/interface_ops.cc
+++ b/source/blender/editors/interface/interface_ops.cc
@@ -133,10 +133,10 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *op)
   if (ptr.owner_id != nullptr) {
     if (full_path) {
       if (prop) {
-        path = RNA_path_full_property_py_ex(bmain, &ptr, prop, index, true);
+        path = RNA_path_full_property_py_ex(&ptr, prop, index, true);
       }
       else {
-        path = RNA_path_full_struct_py(bmain, &ptr);
+        path = RNA_path_full_struct_py(&ptr);
       }
     }
     else {
diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc
index 8d88261c328..a6e37d3f36f 100644
--- a/source/blender/editors/interface/interface_region_tooltip.cc
+++ b/source/blender/editors/interface/interface_region_tooltip.cc
@@ -952,11 +952,10 @@ static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
       /* never fails */
       /* Move ownership (no need for re-allocation). */
       if (rnaprop) {
-        field->text = RNA_path_full_property_py_ex(
-            CTX_data_main(C), &but->rnapoin, rnaprop, but->rnaindex, true);
+        field->text = RNA_path_full_property_py_ex(&but->rnapoin, rnaprop, but->rnaindex, true);
       }
       else {
-        field->text = RNA_path_full_struct_py(CTX_data_main(C), &but->rnapoin);
+        field->text = RNA_path_full_struct_py(&but->rnapoin);
       }
     }
   }
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 7023c91ac85..417c65eb01a 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -155,7 +155,7 @@ static void id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
   ID *id = WM_drag_get_local_ID(drag, 0);
 
   /* copy drag path to properties */
-  char *text = RNA_path_full_ID_py(G_MAIN, id);
+  char *text = RNA_path_full_ID_py(id);
   RNA_string_set(drop->ptr, "text", text);
   MEM_freeN(text);
 }
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 62e2caa7596..45cf557c4b4 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -326,7 +326,7 @@ static void text_drop_paste(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
   ID *id = WM_drag_get_local_ID(drag, 0);
 
   /* copy drag path to properties */
-  text = RNA_path_full_ID_py(G_MAIN, id);
+  text = RNA_path_full_ID_py(id);
   RNA_string_set(drop->ptr, "text", text);
   MEM_freeN(text);
 }
diff --git a/source/blender/makesrna/RNA_path.h b/source/blender/makesrna/RNA_path.h
index 7ab8c6fa313..5e29905cc4f 100644
--- a/source/blender/makesrna/RNA_path.h
+++ b/source/blender/makesrna/RNA_path.h
@@ -189,7 +189,7 @@ char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, struct IDProperty *nee
  * \param[out] r_path: Path from the real ID to the initial ID.
  * \return The ID pointer, or NULL in case of failure.
  */
-struct ID *RNA_find_real_ID_and_path(struct Main *bmain, struct ID *id, const char **r_path);
+struct ID *RNA_find_real_ID_and_path(struct ID *id, const char **r_path);
 
 char *RNA_path_from_ID_to_struct(const PointerRNA *ptr);
 
@@ -227,22 +227,21 @@ char *RNA_path_resolve_from_type_to_property(const PointerRNA *ptr,
  * Get the ID as a python representation, eg:
  *   bpy.data.foo["bar"]
  */
-char *RNA_path_full_ID_py(struct Main *bmain, struct ID *id);
+char *RNA_path_full_ID_py(struct ID *id);
 /**
  * Get the ID.struct as a python representation, eg:
  *   bpy.data.foo["bar"].some_struct
  */
-char *RNA_path_full_struct_py(struct Main *bmain, const PointerRNA *ptr);
+char *RNA_path_full_struct_py(const PointerRNA *ptr);
 /**
  * Get the ID.struct.property as a python representation, eg:
  *   bpy.data.foo["bar"].some_struct.some_prop[10]
  */
-char *RNA_path_full_property_py_ex(
-    struct Main *bmain, const PointerRNA *ptr, PropertyRNA *prop, int index, bool use_fallback);
-char *RNA_path_full_property_py(struct Main *bmain,
-                                const PointerRNA *ptr,
-                                PropertyRNA *prop,
-                                int index);
+char *RNA_path_full_property_py_ex(const PointerRNA *ptr,
+                                   PropertyRNA *prop,
+                                   int index,
+                                   bool use_fallback);
+char *RNA_path_full_property_py(const PointerRNA *ptr, PropertyRNA *prop, int index);
 /**
  * Get the struct.property as a python representation, eg:
  *   some_struct.some_prop[10]
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index c0104b1472c..835265b1986 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -5346,15 +5346,15 @@ char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
   return cstring;
 }
 
-static char *rna_pointer_as_string__bldata(Main *bmain, PointerRNA *ptr)
+static char *rna_pointer_as_string__bldata(PointerRNA *ptr)
 {
   if (ptr->type == NULL || ptr->owner_id == NULL) {
     return BLI_strdup("None");
   }
   if (RNA_struct_is_ID(ptr->type)) {
-    return RNA_path_full_ID_py(bmain, ptr->owner_id);
+    return RNA_path_full_ID_py(ptr->owner_id);
   }
-  return RNA_path_full_struct_py(bmain, ptr);
+  return RNA_path_full_struct_py(ptr);
 }
 
 char *RNA_pointer_as_string(bContext *C,
@@ -5369,7 +5369,7 @@ char *RNA_pointer_as_string(bContext *C,
   if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) {
     return RNA_pointer_as_string_id(C, ptr_prop);
   }
-  return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop);
+  return rna_pointer_as_string__bldata(ptr_prop);
 }
 
 char *RNA_pointer_as_string_keywords_ex(bContext *C,
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index d1df54df3cd..69043dbad7b 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -54,7 +54,7 @@ static CLG_LogRef LOG = {"rna.access_compare_override"};
  * #RNA_find_real_ID_and_path, since in overrides we also consider shape keys as embedded data, not
  * only root node trees and master collections.
  */
-static ID *rna_property_override_property_real_id_owner(Main *bmain,
+static ID *rna_property_override_property_real_id_owner(Main * /*bmain*/,
                                                         PointerRNA *ptr,
                                                         PropertyRNA *prop,
                                                         char **r_rna_path)
@@ -86,7 +86,7 @@ static ID *rna_property_override_property_real_id_owner(Main *bmain,
       case ID_GR:
       case ID_NT:
         /* Master collections, Root node trees. */
-        owner_id = RNA_find_real_ID_and_path(bmain, id, &rna_path_prefix);
+        owner_id = RNA_find_real_ID_and_path(id, &rna_path_prefix);
         break;
       default:
         BLI_assert_unreachable();
diff --git a/source/blender/makesrna/intern/rna_path.cc b/source/blender/makesrna/intern/rna_path.cc
index 4f5e852a12c..bc77ca3f7d3 100644
--- a/source/blender/makesrna/intern/rna_path.cc
+++ b/source/blender/makesrna/intern/rna_path.cc
@@ -916,7 +916,7 @@ static char *rna_path_from_ID_to_idpgroup(const PointerRNA *ptr)
   return RNA_path_from_struct_to_idproperty(&id_ptr, static_cast<IDProperty *>(ptr->data));
 }
 
-ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
+ID *RNA_find_real_ID_and_path(ID *id, const char **r_path)
 {
   if (r_path) {
     *r_path = "";
@@ -947,14 +947,14 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
   return id_type->owner_get(id);
 }
 
-static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_real_id)
+static char *rna_prepend_real_ID_path(Main * /*bmain*/, ID *id, char *path, ID **r_real_id)
 {
   if (r_real_id != nullptr) {
     *r_real_id = nullptr;
   }
 
   const char *prefix;
-  ID *real_id = RNA_find_real_ID_and_path(bmain, id, &prefix);
+  ID *real_id = RNA_find_real_ID_and_path(id, &prefix);
 
   if (r_real_id != nullptr) {
     *r_real_id = real_id;
@@ -1180,10 +1180,10 @@ char *RNA_path_resolve_from_type_to_property(const PointerRNA *ptr,
   return path;
 }
 
-char *RNA_path_full_ID_py(Main *bmain, ID *id)
+char *RNA_path_full_ID_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list