From 33563c04d31d8774dad6b2cede6895d158e96641 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Dec 2011 11:31:48 +0000 Subject: patch from Jason Hays --- Locking only redistributes or restricts weights when using bone groups. So, in addition to adding a NULL check to my last bit of code, I made has_locked_group() check for bone groups. --- source/blender/editors/sculpt_paint/paint_vertex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 3cb613ac5ca..2232f3ae9ad 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1141,14 +1141,14 @@ static void do_weight_paint_auto_normalize_all_groups(MDeformVert *dvert, const See if the current deform vertex has a locked group */ static char has_locked_group(MDeformVert *dvert, const int defbase_tot, - const char *lock_flags) + const char *bone_groups, const char *lock_flags) { int i; MDeformWeight *dw; for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) { if (dw->def_nr < defbase_tot) { - if (lock_flags[dw->def_nr] && dw->weight > 0.0f) { + if (bone_groups[dw->def_nr] && lock_flags[dw->def_nr] && dw->weight > 0.0f) { return TRUE; } } @@ -1325,7 +1325,7 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, char *change_status; - if(!lock_flags || !has_locked_group(ndv, defbase_tot, lock_flags)) { + if(!lock_flags || !has_locked_group(ndv, defbase_tot, vgroup_validmap, lock_flags)) { return; } /* record if a group was changed, unlocked and not changed, or locked */ @@ -1598,7 +1598,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert /* If there are no locks or multipaint, * then there is no need to run the more complicated checks */ if ( (wpi->do_multipaint == FALSE || wpi->defbase_tot_sel <= 1) && - (wpi->lock_flags == NULL || has_locked_group(dv, wpi->defbase_tot, wpi->lock_flags) == FALSE)) + (wpi->lock_flags == NULL || has_locked_group(dv, wpi->defbase_tot, wpi->vgroup_validmap, wpi->lock_flags) == FALSE)) { wpaint_blend(wp, dw, uw, alpha, paintweight, wpi->do_flip, FALSE); -- cgit v1.2.3