From 1f2bc7b7b34ed72a6a2722811c96f8d4a8a1f660 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 30 Aug 2010 01:07:45 +0000 Subject: Bugfix #23575: Hook modifier don't update name of bone acting as the controller when the name of that bone is changed --- source/blender/editors/armature/editarmature.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 174aadab687..8f19bb82b5c 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -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) { -- cgit v1.2.3