From b8d986451805f324b0ba98f4b57b4cf89cee04ed Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 Sep 2022 11:07:44 +1000 Subject: 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. --- source/blender/blenkernel/intern/lib_override.cc | 6 ++--- source/blender/editors/interface/interface_ops.cc | 4 ++-- .../editors/interface/interface_region_tooltip.cc | 5 ++--- .../blender/editors/space_console/space_console.c | 2 +- source/blender/editors/space_text/space_text.c | 2 +- source/blender/makesrna/RNA_path.h | 17 +++++++------- source/blender/makesrna/intern/rna_access.c | 8 +++---- .../makesrna/intern/rna_access_compare_override.c | 4 ++-- source/blender/makesrna/intern/rna_path.cc | 26 ++++++++++++---------- source/blender/windowmanager/intern/wm_operators.c | 2 +- 10 files changed, 38 insertions(+), 38 deletions(-) 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(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_py(ID *id) { const char *path; - ID *id_real = RNA_find_real_ID_and_path(bmain, id, &path); + ID *id_real = RNA_find_real_ID_and_path(id, &path); if (id_real) { id = id_real; @@ -1215,7 +1215,7 @@ char *RNA_path_full_ID_py(Main *bmain, ID *id) path); } -char *RNA_path_full_struct_py(Main *bmain, const PointerRNA *ptr) +char *RNA_path_full_struct_py(const PointerRNA *ptr) { char *id_path; char *data_path; @@ -1227,7 +1227,7 @@ char *RNA_path_full_struct_py(Main *bmain, const PointerRNA *ptr) } /* never fails */ - id_path = RNA_path_full_ID_py(bmain, ptr->owner_id); + id_path = RNA_path_full_ID_py(ptr->owner_id); data_path = RNA_path_from_ID_to_struct(ptr); @@ -1243,8 +1243,10 @@ char *RNA_path_full_struct_py(Main *bmain, const PointerRNA *ptr) return ret; } -char *RNA_path_full_property_py_ex( - Main *bmain, const PointerRNA *ptr, PropertyRNA *prop, int index, bool use_fallback) +char *RNA_path_full_property_py_ex(const PointerRNA *ptr, + PropertyRNA *prop, + int index, + bool use_fallback) { char *id_path; const char *data_delim; @@ -1258,7 +1260,7 @@ char *RNA_path_full_property_py_ex( } /* never fails */ - id_path = RNA_path_full_ID_py(bmain, ptr->owner_id); + id_path = RNA_path_full_ID_py(ptr->owner_id); data_path = RNA_path_from_ID_to_property(ptr, prop); if (data_path) { @@ -1291,9 +1293,9 @@ char *RNA_path_full_property_py_ex( return ret; } -char *RNA_path_full_property_py(Main *bmain, const PointerRNA *ptr, PropertyRNA *prop, int index) +char *RNA_path_full_property_py(const PointerRNA *ptr, PropertyRNA *prop, int index) { - return RNA_path_full_property_py_ex(bmain, ptr, prop, index, false); + return RNA_path_full_property_py_ex(ptr, prop, index, false); } char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f37fc6ec483..18b5461383f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -639,7 +639,7 @@ char *WM_prop_pystring_assign(bContext *C, PointerRNA *ptr, PropertyRNA *prop, i if (lhs == NULL) { /* Fallback to `bpy.data.foo[id]` if we don't find in the context. */ - lhs = RNA_path_full_property_py(CTX_data_main(C), ptr, prop, index); + lhs = RNA_path_full_property_py(ptr, prop, index); } if (!lhs) { -- cgit v1.2.3