diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-11-06 12:44:34 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-11-06 12:44:34 +0300 |
commit | e2504c2ff1aa3bfb2df446e007ee9fae0993a9ee (patch) | |
tree | 57db6b729c9b42cce7993746c6e0d611af7883ab /source/blender/blenkernel/intern | |
parent | f1c6a69aad1f94f406cfa5172b7ddb941e80649d (diff) |
Mesh Deform Modifier
====================
Added a button to invert the vertex group influence, to make blending
between mdef and armature deform easier.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 35 |
1 files changed, 21 insertions, 14 deletions
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; 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); |