diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-10-01 17:33:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-10-01 17:33:43 +0400 |
commit | d8020f54baefc96ccaf7d1c5df49f8e5cd0c6e76 (patch) | |
tree | 9f2c6428e674ad8e0e09ff543fb9908219195bff /source/blender/editors/armature | |
parent | 9883641f46ebf4a9db407f125903a45ea617464e (diff) |
change to ED_armature_bone_rename so theres never any duplicates dictionary items in 'ob->pose->chanhash'
this turned out to be harmless but it did make ghash assert() because the ghash isnt flagged to allow duplicates.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_naming.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 60f5e69621f..8745d571a28 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -182,13 +182,17 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n if (ob->pose) { bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, oldname); if (pchan) { + GHash *gh = ob->pose->chanhash; + + /* remove the old hash entry, and replace with the new name */ + if (gh) { + BLI_assert(BLI_ghash_haskey(gh, pchan->name)); + BLI_ghash_remove(gh, pchan->name, NULL, NULL); + } + 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); + + if (gh) { BLI_ghash_insert(gh, pchan->name, pchan); } } |