diff options
author | Jason Hays <jason_hays22@mymail.eku.edu> | 2012-05-31 21:22:52 +0400 |
---|---|---|
committer | Jason Hays <jason_hays22@mymail.eku.edu> | 2012-05-31 21:22:52 +0400 |
commit | 9547b76c2e8e0f6aa07858e94e4f0c404b86ac7d (patch) | |
tree | 1ea937a65f10534032ef2fe9a3cd9d801697198b /source | |
parent | a8f84fac89af4f62d75afa143e68a5001e8d5b83 (diff) |
This fixes a precision issue in multi-paint so that near zero values do not cause flickering as you paint.
It also changes multi-paint's "zero weight color" to black again--it was unintentionally changed to red some time late last year when an aspect of the colors were changed.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 5774dd7b1ba..7130776d05a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1054,10 +1054,10 @@ static void calc_weightpaint_vert_color( } if (make_black) { /* TODO, theme color */ - r_col[3] = 0; + r_col[3] = 255; r_col[2] = 0; r_col[1] = 0; - r_col[0] = 255; + r_col[0] = 0; } else { CLAMP(input, 0.0f, 1.0f); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index e05191dad3b..88cf9b1b0dd 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1878,6 +1878,7 @@ static void do_weight_paint_vertex( float oldw; float neww; float testw = 0; + float observedChange = 0; float change = 0; float oldChange = 0; int i; @@ -1889,13 +1890,14 @@ static void do_weight_paint_vertex( wpi->brush_alpha_value, wpi->do_flip, do_multipaint_totsel); /* setup multi-paint */ - if (do_multipaint_totsel) { + observedChange = neww - oldw; + if (do_multipaint_totsel && observedChange) { dv_copy.dw = MEM_dupallocN(dv->dw); dv_copy.flag = dv->flag; dv_copy.totweight = dv->totweight; tdw = dw; tdw_prev = dw_prev; - change = get_mp_change(&wp->wpaint_prev[index], wpi->defbase_tot, wpi->defbase_sel, neww - oldw); + change = get_mp_change(&wp->wpaint_prev[index], wpi->defbase_tot, wpi->defbase_sel, observedChange); if (change) { if (!tdw->weight) { i = get_first_selected_nonzero_weight(dv, wpi->defbase_tot, wpi->defbase_sel); @@ -1911,7 +1913,7 @@ static void do_weight_paint_vertex( if (tdw->weight != tdw_prev->weight) { oldChange = tdw->weight / tdw_prev->weight; testw = tdw_prev->weight * change; - if (testw > tdw_prev->weight) { + if (observedChange > 0) { if (change > oldChange) { /* reset the weights and use the new change */ defvert_reset_to_prev(wp->wpaint_prev + index, dv); |