Fix for armature deform: if there's a vertexgroup on a vertex, but not with

bone assigned to the group (like for softbody) the envelope-deform was not
applied.
This commit is contained in:
Ton Roosendaal
2005-09-09 15:16:39 +00:00
parent 039a8c95f3
commit 55dd39f9fa

View File

@@ -722,14 +722,17 @@ void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3],
else
dvert= NULL;
if(dvert && dvert->totweight) { // use weight groups
if(dvert && dvert->totweight) { // use weight groups ?
int deformed= 0;
for (j=0; j<dvert->totweight; j++){
pchan = defnrToPC[dvert->dw[j].def_nr];
if (pchan) {
float weight= dvert->dw[j].weight;
Bone *bone= pchan->bone;
deformed= 1;
if(bone && bone->flag & BONE_MULT_VG_ENV) {
weight*= distfactor_to_bone(co, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist);
@@ -737,6 +740,13 @@ void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3],
pchan_bone_deform(pchan, weight, vec, co, &contrib);
}
}
/* if there are vertexgroups but not groups with bones (like for softbody groups) */
if(deformed==0 && use_envelope) {
for(pchan= armOb->pose->chanbase.first; pchan; pchan= pchan->next) {
if(!(pchan->bone->flag & BONE_NO_DEFORM))
contrib+= dist_bone_deform(pchan, vec, co);
}
}
}
else if(use_envelope) {
for(pchan= armOb->pose->chanbase.first; pchan; pchan= pchan->next) {