diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-15 01:08:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-15 01:08:08 +0400 |
commit | 3d5330f789c287666b875706c84228520473add5 (patch) | |
tree | 8202068ce1276684f901a544557e804cc60133be /source/blender/editors/sculpt_paint | |
parent | b9614b0e523e3fd8c5584e07d6892383adcc9952 (diff) |
vertex group changes,
use more api functions more (some vertex group editing functions were copied about), also make some functions int oapi calls.
- remove defgroup_find_index(), use BLI_findlink instead since they both work the same way.
- move static function getNearestPointOnPlane() to BLI_math api function closest_to_plane_v3()
- ED_vgroup_give_parray() added option to return an array where unselected verts are NULL (simplifies code & works for lattice when it didn't before).
- more consistant error checking of ob->actdef.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 52d1cf0b012..5706633d138 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1432,15 +1432,15 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const char * /* change the weights back to the wv's weights * it assumes you already have the correct pointer index */ -static void reset_to_prev(MDeformVert *wv, MDeformVert *dvert) +static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv) { - MDeformWeight *dw= dvert->dw; - MDeformWeight *w; + MDeformWeight *dw= dv->dw; + MDeformWeight *dw_prev; unsigned int i; - for (i= dvert->totweight; i != 0; i--, dw++) { - w= defvert_find_index(wv, dw->def_nr); + for (i= dv->totweight; i != 0; i--, dw++) { + dw_prev= defvert_find_index(dv_prev, dw->def_nr); /* if there was no w when there is a d, then the old weight was 0 */ - dw->weight = w ? w->weight : 0.0f; + dw->weight = dw_prev ? dw_prev->weight : 0.0f; } } @@ -1652,7 +1652,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert if( testw > tuw->weight ) { if(change > oldChange) { /* reset the weights and use the new change */ - reset_to_prev(wp->wpaint_prev+index, dv); + defvert_reset_to_prev(wp->wpaint_prev+index, dv); } else { /* the old change was more significant, so set @@ -1662,7 +1662,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } else { if(change < oldChange) { - reset_to_prev(wp->wpaint_prev+index, dv); + defvert_reset_to_prev(wp->wpaint_prev+index, dv); } else { change = 0; @@ -1677,7 +1677,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } if(apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) { - reset_to_prev(&dv_copy, dv); + defvert_reset_to_prev(&dv_copy, dv); change = 0; oldChange = 0; } @@ -1918,7 +1918,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED dg= ED_vgroup_add_name(ob, pchan->name); /* sets actdef */ } else { - ob->actdef= 1 + defgroup_find_index(ob, dg); + ob->actdef= 1 + BLI_findindex(&ob->defbase, dg); BLI_assert(ob->actdef >= 0); } } |