diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-05-04 04:59:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-05-04 04:59:02 +0400 |
commit | cb67cba19a85b6a43faba2cd700973bb3f061b37 (patch) | |
tree | b8b2c8e6906e3576a6049f02f87e1d15382aa869 /source | |
parent | e5ccb8773dd16b528eef300fdbc012fafb4e47ea (diff) |
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)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 15 | ||||
-rw-r--r-- | source/blender/src/editarmature.c | 9 |
3 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index b90758a52fb..ecbfeed157a 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -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); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 39e61fd63e3..edda9f7a9a1 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -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); diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 69353e15775..3ce31ea8963 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -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) { |