Mesh Deform Modifier
==================== Added a button to invert the vertex group influence, to make blending between mdef and armature deform easier.
This commit is contained in:
@@ -5067,7 +5067,28 @@ static void meshdeformModifier_do(
|
||||
}
|
||||
|
||||
/* do deformation */
|
||||
fac= 1.0f;
|
||||
|
||||
for(b=0; b<totvert; b++) {
|
||||
if(dvert) {
|
||||
for(dw=NULL, a=0; a<dvert[b].totweight; a++) {
|
||||
if(dvert[b].dw[a].def_nr == defgrp_index) {
|
||||
dw = &dvert[b].dw[a];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(mmd->flag & MOD_MDEF_INVERT_VGROUP) {
|
||||
if(!dw) fac= 1.0f;
|
||||
else if(dw->weight == 0.0f) continue;
|
||||
else fac=1.0f-dw->weight;
|
||||
}
|
||||
else {
|
||||
if(!dw) continue;
|
||||
else fac= dw->weight;
|
||||
}
|
||||
}
|
||||
|
||||
totweight= 0.0f;
|
||||
co[0]= co[1]= co[2]= 0.0f;
|
||||
|
||||
@@ -5080,20 +5101,6 @@ static void meshdeformModifier_do(
|
||||
}
|
||||
|
||||
if(totweight > 0.0f) {
|
||||
if(dvert) {
|
||||
for(dw=NULL, a=0; a<dvert[b].totweight; a++) {
|
||||
if(dvert[b].dw[a].def_nr == defgrp_index) {
|
||||
dw = &dvert[b].dw[a];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!dw) continue;
|
||||
|
||||
fac= dw->weight;
|
||||
}
|
||||
else
|
||||
fac= 1.0f;
|
||||
|
||||
VecMulf(co, fac/totweight);
|
||||
Mat3MulVecfl(icmat, co);
|
||||
VECADD(vertexCos[b], vertexCos[b], co);
|
||||
|
||||
@@ -348,6 +348,8 @@ typedef struct BooleanModifierData {
|
||||
int operation, pad;
|
||||
} BooleanModifierData;
|
||||
|
||||
#define MOD_MDEF_INVERT_VGROUP (1<<0)
|
||||
|
||||
typedef struct MeshDeformModifierData {
|
||||
ModifierData modifier;
|
||||
|
||||
@@ -356,7 +358,7 @@ typedef struct MeshDeformModifierData {
|
||||
|
||||
float *bindweights, *bindcos; /* computed binding weights */
|
||||
short gridsize, needbind;
|
||||
int pad;
|
||||
short flag, pad;
|
||||
|
||||
int totvert, totcagevert;
|
||||
} MeshDeformModifierData;
|
||||
|
||||
@@ -2120,8 +2120,9 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIDPoinBut(block, test_meshobpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &mmd->object, "Mesh object to be use as cage");
|
||||
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &mmd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall meshdeform influence");
|
||||
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-19), buttonWidth-40,19, &mmd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall meshdeform influence");
|
||||
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
|
||||
uiDefButBitS(block, TOG, MOD_MDEF_INVERT_VGROUP, B_MODIFIER_RECALC, "Inv", lx+buttonWidth-40, (cy-=19), 40,19, &mmd->flag, 0.0, 31.0, 0, 0, "Invert vertex group influence");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
if(mmd->bindweights) {
|
||||
|
||||
Reference in New Issue
Block a user