From c547323f1c1aaa94d4b3a3159508138f58404608 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 20 Jul 2010 11:17:47 +0000 Subject: Bugfix: The infamous "bone properties/constraints disappearing after renaming bones" bug This was simply caused by the lookup hash-table not being updated to be aware of the new name. Now the hashes are updated, so the name lookups (used for UI drawing among other things) works ok again after renaming bones. This closes (open) reports: 22882, 21801 and the closed/duplicate reports: 22067, 22670, 22384, 22665 --- source/blender/editors/armature/editarmature.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index b0c45616f1c..0cf6ce3656e 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -5479,8 +5479,17 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) /* Rename the pose channel, if it exists */ if (ob->pose) { bPoseChannel *pchan = get_pose_channel(ob->pose, oldname); - if (pchan) + if (pchan) { BLI_strncpy(pchan->name, newname, MAXBONENAME); + + if (ob->pose->chanhash) { + GHash *gh = ob->pose->chanhash; + + /* remove the old hash entry, and replace with the new name */ + BLI_ghash_remove(gh, oldname, NULL, NULL); + BLI_ghash_insert(gh, pchan->name, pchan); + } + } } /* Update any object constraints to use the new bone name */ -- cgit v1.2.3