From 8f605baa2eaf94cb630e8e244cb848ef84124ddd Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 17 Jul 2025 14:02:22 +0200 Subject: [PATCH] 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 --- source/blender/makesrna/intern/rna_armature.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/blender/makesrna/intern/rna_armature.cc b/source/blender/makesrna/intern/rna_armature.cc index b7ce6cd6f2a..62a5c1f5d2e 100644 --- a/source/blender/makesrna/intern/rna_armature.cc +++ b/source/blender/makesrna/intern/rna_armature.cc @@ -811,6 +811,15 @@ static IDProperty **rna_Bone_system_idprops(PointerRNA *ptr) return &bone->system_properties; } +static std::optional rna_EditBone_path(const PointerRNA *ptr) +{ + EditBone *ebone = static_cast(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(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");