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.
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user