Cleanup: pass const ID properties to path creation functions
This commit is contained in:
parent
a3cb3a65b2
commit
8c590ef945
|
@ -1113,7 +1113,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
|
|||
if (NOT_RNA_NULL(owner_ptr = CTX_data_pointer_get_type(C, "active_pose_bone", &RNA_PoseBone)))
|
||||
{
|
||||
if (NOT_NULL(idpath = RNA_path_from_struct_to_idproperty(
|
||||
&owner_ptr, static_cast<IDProperty *>(ptr->data))))
|
||||
&owner_ptr, static_cast<const IDProperty *>(ptr->data))))
|
||||
{
|
||||
*r_lb = CTX_data_collection_get(C, "selected_pose_bones");
|
||||
}
|
||||
|
@ -1122,7 +1122,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
|
|||
owner_ptr = RNA_pointer_create(owner_ptr.owner_id, &RNA_Bone, pchan->bone);
|
||||
|
||||
if (NOT_NULL(idpath = RNA_path_from_struct_to_idproperty(
|
||||
&owner_ptr, static_cast<IDProperty *>(ptr->data))))
|
||||
&owner_ptr, static_cast<const IDProperty *>(ptr->data))))
|
||||
{
|
||||
ui_context_selected_bones_via_pose(C, r_lb);
|
||||
}
|
||||
|
@ -1134,7 +1134,7 @@ bool UI_context_copy_to_selected_list(bContext *C,
|
|||
if (NOT_RNA_NULL(
|
||||
owner_ptr = CTX_data_pointer_get_type_silent(C, "active_bone", &RNA_EditBone)) &&
|
||||
NOT_NULL(idpath = RNA_path_from_struct_to_idproperty(
|
||||
&owner_ptr, static_cast<IDProperty *>(ptr->data))))
|
||||
&owner_ptr, static_cast<const IDProperty *>(ptr->data))))
|
||||
{
|
||||
*r_lb = CTX_data_collection_get(C, "selected_editable_bones");
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, struct ListBas
|
|||
* \param needle: Custom property object to find.
|
||||
* \return Relative path or NULL.
|
||||
*/
|
||||
char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, struct IDProperty *needle);
|
||||
char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, const struct IDProperty *needle);
|
||||
|
||||
/**
|
||||
* Find the actual ID pointer and path from it to the given ID.
|
||||
|
|
|
@ -797,14 +797,14 @@ static char *rna_idp_path_create(IDP_Chain *child_link)
|
|||
}
|
||||
|
||||
static char *rna_idp_path(PointerRNA *ptr,
|
||||
IDProperty *haystack,
|
||||
IDProperty *needle,
|
||||
const IDProperty *haystack,
|
||||
const IDProperty *needle,
|
||||
IDP_Chain *parent_link)
|
||||
{
|
||||
char *path = nullptr;
|
||||
IDP_Chain link;
|
||||
|
||||
IDProperty *iter;
|
||||
const IDProperty *iter;
|
||||
int i;
|
||||
|
||||
BLI_assert(haystack->type == IDP_GROUP);
|
||||
|
@ -861,7 +861,7 @@ static char *rna_idp_path(PointerRNA *ptr,
|
|||
}
|
||||
else if (iter->type == IDP_IDPARRAY) {
|
||||
if (prop->type == PROP_COLLECTION) {
|
||||
IDProperty *array = IDP_IDPArray(iter);
|
||||
const IDProperty *array = IDP_IDPArray(iter);
|
||||
if (needle >= array && needle < (iter->len + array)) { /* found! */
|
||||
link.name = iter->name;
|
||||
link.index = int(needle - array);
|
||||
|
@ -894,9 +894,9 @@ static char *rna_idp_path(PointerRNA *ptr,
|
|||
return path;
|
||||
}
|
||||
|
||||
char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, IDProperty *needle)
|
||||
char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, const IDProperty *needle)
|
||||
{
|
||||
IDProperty *haystack = RNA_struct_idprops(ptr, false);
|
||||
const IDProperty *haystack = RNA_struct_idprops(ptr, false);
|
||||
|
||||
if (haystack) { /* can fail when called on bones */
|
||||
return rna_idp_path(ptr, haystack, needle, nullptr);
|
||||
|
@ -916,7 +916,7 @@ static char *rna_path_from_ID_to_idpgroup(const PointerRNA *ptr)
|
|||
*/
|
||||
PointerRNA id_ptr = RNA_id_pointer_create(ptr->owner_id);
|
||||
|
||||
return RNA_path_from_struct_to_idproperty(&id_ptr, static_cast<IDProperty *>(ptr->data));
|
||||
return RNA_path_from_struct_to_idproperty(&id_ptr, static_cast<const IDProperty *>(ptr->data));
|
||||
}
|
||||
|
||||
ID *RNA_find_real_ID_and_path(ID *id, const char **r_path)
|
||||
|
|
Loading…
Reference in New Issue