diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-30 11:39:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-30 11:39:54 +0400 |
commit | 064d46eef06c2ee0b4d551dcd68028179561c04c (patch) | |
tree | b829984b3d2e9fea1e55792a1941157d1a305944 /source/blender/modifiers/intern/MOD_weightvg_util.c | |
parent | b202bf05646b89c8b1f9f24a1d0f9750914997b1 (diff) |
use consistent naming for deform.c, also moved defvert_remove_index into deform.c, was local in modifier code.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvg_util.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvg_util.c | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index c2a9ae7555d..e206000f41d 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -240,51 +240,6 @@ static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float we dv->totweight++; } -/* Removes the given vertex from the vertex group, specified either by its defgrp_idx, - * or directly by its MDeformWeight pointer, if dw is not NULL. - * WARNING: This function frees the given MDeformWeight, do not use it afterward! */ -static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) -{ - /* TODO, move this into deform.c as a generic function. */ - MDeformWeight *newdw; - int i; - - /* Get index of removed MDeformWeight. */ - if(dw == NULL) { - dw = dv->dw; - for (i = dv->totweight; i > 0; i--, dw++) { - if (dw->def_nr == defgrp_idx) - break; - } - i--; - } - else { - i = dw - dv->dw; - /* Security check! */ - if(i < 0 || i >= dv->totweight) - return; - } - - dv->totweight--; - /* If there are still other deform weights attached to this vert then remove - * this deform weight, and reshuffle the others. - */ - if(dv->totweight) { - newdw = MEM_mallocN(sizeof(MDeformWeight)*(dv->totweight), "defvert_remove_from_group, new deformWeight"); - if(dv->dw){ - memcpy(newdw, dv->dw, sizeof(MDeformWeight)*i); - memcpy(newdw+i, dv->dw+i+1, sizeof(MDeformWeight)*(dv->totweight-i)); - MEM_freeN(dv->dw); - } - dv->dw = newdw; - } - /* If there are no other deform weights left then just remove this one. */ - else { - MEM_freeN(dv->dw); - dv->dw = NULL; - } -} - /* Applies weights to given vgroup (defgroup), and optionnaly add/remove vertices from the group. * If dws is not NULL, it must be an array of MDeformWeight pointers of same length as weights (and @@ -309,7 +264,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, /* If the vertex is in this vgroup, remove it if needed, or just update it. */ if(dw != NULL) { if(do_rem && w < rem_thresh) { - defvert_remove_from_group(dv, defgrp_idx, dw); + defvert_remove_index(dv, defgrp_idx, dw); } else { dw->weight = w; |