Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_modifier.h1
-rw-r--r--source/blender/blenkernel/intern/modifier.c15
-rw-r--r--source/blender/src/editarmature.c9
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) {