Fix T76801: Renaming bone in pose mode doesn't redraw the viewport names

The RNA name property of pose bones did not have any update logic defined.

Same issue also applied to the channel name in animation editors.

Duplicated the update logic from (edit-)bones now, other pose bone functions do
this too...
This commit is contained in:
Julian Eisel 2020-05-18 09:46:22 +02:00
parent 68ba154869
commit a4b2734fe2
Notes: blender-bot 2023-10-18 15:23:11 +02:00
Referenced by issue #76801, Renaming bone in pose mode doesn't redraw the viewport names
1 changed files with 13 additions and 0 deletions

View File

@ -295,6 +295,18 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
ED_armature_bone_rename(G_MAIN, ob->data, oldname, newname);
}
/* See rna_Bone_update_renamed() */
static void rna_PoseChannel_name_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
ID *id = ptr->owner_id;
/* redraw view */
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
/* update animation channels */
WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
}
static PointerRNA rna_PoseChannel_bone_get(PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
@ -996,6 +1008,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Name", "");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_struct_name_property(srna, prop);
RNA_def_property_update(prop, 0, "rna_PoseChannel_name_update");
/* Baked Bone Path cache data */
rna_def_motionpath_common(srna);