[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30529] trunk/blender/source/blender/ editors/armature/editarmature.c: Bugfix: The infamous "bone properties/ constraints disappearing after renaming bones" bug

Joshua Leung aligorith at gmail.com
Tue Jul 20 13:17:47 CEST 2010


Revision: 30529
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30529
Author:   aligorith
Date:     2010-07-20 13:17:47 +0200 (Tue, 20 Jul 2010)

Log Message:
-----------
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

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c	2010-07-20 11:06:26 UTC (rev 30528)
+++ trunk/blender/source/blender/editors/armature/editarmature.c	2010-07-20 11:17:47 UTC (rev 30529)
@@ -5479,8 +5479,17 @@
 				/* 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 */





More information about the Bf-blender-cvs mailing list