Fix #142062: Armature EditBone RNA paths incomplete

`PoseBone` and `Bone` already have their `struct_path_func` defined, but
that was missing from `EditBone`.
Since `EditBone` is usually what is visible from the UI (and only later
gets flushed to `Bone` via `ED_armature_from_edit`), it makes sense to
have complete RNA paths for `EditBone` as well.

Enables the usual context menu `Copy Data Path`, `Copy As New Driver`,
... automatically.

Pull Request: https://projects.blender.org/blender/blender/pulls/142065
This commit is contained in:
Philipp Oeser
2025-07-17 14:02:22 +02:00
committed by Philipp Oeser
parent f2ee95843c
commit 8f605baa2e

View File

@@ -811,6 +811,15 @@ static IDProperty **rna_Bone_system_idprops(PointerRNA *ptr)
return &bone->system_properties;
}
static std::optional<std::string> rna_EditBone_path(const PointerRNA *ptr)
{
EditBone *ebone = static_cast<EditBone *>(ptr->data);
char name_esc[sizeof(ebone->name) * 2];
BLI_str_escape(name_esc, ebone->name, sizeof(name_esc));
return fmt::format("edit_bones[\"{}\"]", name_esc);
}
static IDProperty **rna_EditBone_idprops(PointerRNA *ptr)
{
EditBone *ebone = static_cast<EditBone *>(ptr->data);
@@ -1867,6 +1876,7 @@ static void rna_def_edit_bone(BlenderRNA *brna)
srna = RNA_def_struct(brna, "EditBone", nullptr);
RNA_def_struct_sdna(srna, "EditBone");
RNA_def_struct_path_func(srna, "rna_EditBone_path");
RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
RNA_def_struct_system_idprops_func(srna, "rna_EditBone_system_idprops");
RNA_def_struct_ui_text(srna, "Edit Bone", "Edit mode bone in an armature data-block");