diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 243a24bc3b8..b805e3827d2 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -5067,7 +5067,28 @@ static void meshdeformModifier_do( } /* do deformation */ + fac= 1.0f; + for(b=0; bflag & 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; aweight; - } - else - fac= 1.0f; - VecMulf(co, fac/totweight); Mat3MulVecfl(icmat, co); VECADD(vertexCos[b], vertexCos[b], co); diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index c8dcba4fae7..42016ad1c16 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -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; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 40e2643a390..c9bc9a4b296 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -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) {