Multiple armatures<>mesh objects now work with name flipping.

previously would only work if the armature was the first in the meshes modifier list,
in that case the armature would be name flipped but the mesh would not)
This commit is contained in:
Campbell Barton 2006-05-04 00:59:02 +00:00
parent e5ccb8773d
commit cb67cba19a
3 changed files with 19 additions and 6 deletions

View File

@ -202,6 +202,7 @@ int modifiers_getCageIndex (struct Object *ob, int *lastPossibleCageIndex_r)
int modifiers_isSoftbodyEnabled (struct Object *ob);
struct Object* modifiers_isDeformedByArmature(struct Object *ob);
int modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
int modifiers_isDeformed (struct Object *ob);
ModifierData* modifiers_getVirtualModifierList (struct Object *ob);

View File

@ -2125,6 +2125,21 @@ Object *modifiers_isDeformedByArmature(Object *ob)
return NULL;
}
int modifiers_usesArmature(Object *ob, bArmature *arm)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);
for (; md; md=md->next) {
if (md->type==eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData*) md;
if (amd->object->data==arm)
return 1;
}
}
return NULL;
}
int modifiers_isDeformed(Object *ob)
{
ModifierData *md = modifiers_getVirtualModifierList(ob);

View File

@ -2383,7 +2383,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldnam
/* seems messy, but thats what you get with not using pointers but channel names :) */
void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
{
Object *ob, *modob;
Object *ob;
char newname[MAXBONENAME];
char oldname[MAXBONENAME];
@ -2465,11 +2465,8 @@ void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
BLI_strncpy(ob->parsubstr, newname, MAXBONENAME);
}
}
/* or is there an armature deforming object */
/* this is a bit sloppy, what if we have more then 1 armature deforming a mesh?
TODO: Should have a function modifiers_isUsingArmature(ob, arm) - Campbell */
modob = modifiers_isDeformedByArmature(ob);
if(modob && modob->data==arm) {
if(modifiers_usesArmature(ob, arm)) {
bDeformGroup *dg;
/* bone name in defgroup */
for (dg=ob->defbase.first; dg; dg=dg->next) {