diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-13 04:11:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-13 04:11:42 +0400 |
commit | 95b9e4171efaef3a6d6a9fe1d7c51931ea9aea32 (patch) | |
tree | 4d0a6deaea956916281a3ec68af32a83111ce889 /source/blender/modifiers/intern/MOD_hook.c | |
parent | 32ce3e3433c80ae0ee9f5ff793bb18c78b53ed14 (diff) |
use utility functions for vertex groups, no functional changes
Diffstat (limited to 'source/blender/modifiers/intern/MOD_hook.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_hook.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 6ca5e3ee83c..6715e2b78c0 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -214,25 +214,26 @@ static void deformVerts( if(defgrp_index >= 0 && use_dverts) { MDeformVert *dvert = me->dvert; - int i, j; + int i; + float fac; for(i = 0; i < maxVerts; i++, dvert++) { if(dm) dvert = dm->getVertData(dm, i, CD_MDEFORMVERT); - for(j = 0; j < dvert->totweight; j++) { - if(dvert->dw[j].def_nr == defgrp_index) { - float fac = hmd->force*dvert->dw[j].weight; - float *co = vertexCos[i]; - - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - mul_v3_m4v3(vec, mat, co); - interp_v3_v3v3(co, co, vec, fac); + fac= defvert_find_weight(dvert, defgrp_index); + + if(fac > 0.0f) { + float *co = vertexCos[i]; + + if(hmd->falloff != 0.0) { + float len = len_v3v3(co, hmd->cent); + if(len > hmd->falloff) fac = 0.0; + else if(len > 0.0) + fac *= sqrt(1.0 - len / hmd->falloff); } + + mul_v3_m4v3(vec, mat, co); + interp_v3_v3v3(co, co, vec, fac); } } } |