diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-27 13:43:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-27 13:46:55 +0300 |
commit | d7a877b69ca8d2cc6c5de0691d7bdf899af165ba (patch) | |
tree | d456be00be86dc7dad48c72a087f550a54b153b7 /source/blender/editors | |
parent | a7e80a94708408d99d9c1674ce0738bc60411981 (diff) |
Fix WPaint inactive when painting on a vgroup and the only other vgroup is locked.
`enforce_locks()` would reset weights of non-locked modified vgroups if it could not
find any other non-modified non-locked vgroup to 'distribute' weights into.
Sounds rather stupid, yet I hope I did not break something else, this code
is rather convoluted to say the least.
Side-reported by zeauro (ronan ducluzeau) in T43814, thanks!
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 7324cebbf49..e87dd6c2810 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1575,8 +1575,8 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv, change_status[i] = 1; /* can be altered while redistributing */ } } - /* if there was any change, redistribute it */ - if (total_changed) { + /* if there was any change, and somewhere to redistribute it, do it */ + if (total_changed && total_valid) { /* auto normalize will allow weights to temporarily go above 1 in redistribution */ if (vgroup_validmap && total_changed < 0 && total_valid) { totchange_allowed = total_valid; @@ -1740,7 +1740,8 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi, } clamp_weights(dv); - enforce_locks(&dv_test, dv, wpi->defbase_tot, wpi->defbase_sel, wpi->lock_flags, wpi->vgroup_validmap, wpi->do_auto_normalize, wpi->do_multipaint); + enforce_locks(&dv_test, dv, wpi->defbase_tot, wpi->defbase_sel, wpi->lock_flags, wpi->vgroup_validmap, + wpi->do_auto_normalize, wpi->do_multipaint); if (wpi->do_auto_normalize) { /* XXX - should we pass the active group? - currently '-1' */ |