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.
This commit is contained in:
Campbell Barton
2022-09-07 11:07:44 +10:00
parent 9c4c9a889d
commit b8d9864518
10 changed files with 38 additions and 38 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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);
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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]

View File

@@ -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,

View File

@@ -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();

View File

@@ -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_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)

View File

@@ -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) {