Bugfix #23575: Hook modifier don't update name of bone acting as the controller when the name of that bone is changed

This commit is contained in:
Joshua Leung 2010-08-30 01:07:45 +00:00
parent 88f657f251
commit 1f2bc7b7b3

@ -5460,6 +5460,8 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
/* do entire dbase - objects */
for (ob= G.main->object.first; ob; ob= ob->id.next) {
ModifierData *md;
/* we have the object using the armature */
if (arm==ob->data) {
Object *cob;
@ -5509,6 +5511,19 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
}
}
/* fix modifiers that might be using this name */
for (md= ob->modifiers.first; md; md= md->next) {
if (md->type == eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData *)md;
/* uses armature, so may use the affected bone name */
if (hmd->object && (hmd->object->data == arm)) {
if (!strcmp(hmd->subtarget, oldname))
BLI_strncpy(hmd->subtarget, newname, MAXBONENAME);
}
}
}
/* Fix animation data attached to this object */
// TODO: should we be using the database wide version instead (since drivers may break)
if (ob->adt) {