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 */
|
if (make_black) { /* TODO, theme color */
|
||||||
r_col[3] = 0;
|
r_col[3] = 255;
|
||||||
r_col[2] = 0;
|
r_col[2] = 0;
|
||||||
r_col[1] = 0;
|
r_col[1] = 0;
|
||||||
r_col[0] = 255;
|
r_col[0] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CLAMP(input, 0.0f, 1.0f);
|
CLAMP(input, 0.0f, 1.0f);
|
||||||
|
@@ -1878,6 +1878,7 @@ static void do_weight_paint_vertex(
|
|||||||
float oldw;
|
float oldw;
|
||||||
float neww;
|
float neww;
|
||||||
float testw = 0;
|
float testw = 0;
|
||||||
|
float observedChange = 0;
|
||||||
float change = 0;
|
float change = 0;
|
||||||
float oldChange = 0;
|
float oldChange = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -1889,13 +1890,14 @@ static void do_weight_paint_vertex(
|
|||||||
wpi->brush_alpha_value, wpi->do_flip, do_multipaint_totsel);
|
wpi->brush_alpha_value, wpi->do_flip, do_multipaint_totsel);
|
||||||
|
|
||||||
/* setup multi-paint */
|
/* setup multi-paint */
|
||||||
if (do_multipaint_totsel) {
|
observedChange = neww - oldw;
|
||||||
|
if (do_multipaint_totsel && observedChange) {
|
||||||
dv_copy.dw = MEM_dupallocN(dv->dw);
|
dv_copy.dw = MEM_dupallocN(dv->dw);
|
||||||
dv_copy.flag = dv->flag;
|
dv_copy.flag = dv->flag;
|
||||||
dv_copy.totweight = dv->totweight;
|
dv_copy.totweight = dv->totweight;
|
||||||
tdw = dw;
|
tdw = dw;
|
||||||
tdw_prev = dw_prev;
|
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 (change) {
|
||||||
if (!tdw->weight) {
|
if (!tdw->weight) {
|
||||||
i = get_first_selected_nonzero_weight(dv, wpi->defbase_tot, wpi->defbase_sel);
|
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) {
|
if (tdw->weight != tdw_prev->weight) {
|
||||||
oldChange = tdw->weight / tdw_prev->weight;
|
oldChange = tdw->weight / tdw_prev->weight;
|
||||||
testw = tdw_prev->weight * change;
|
testw = tdw_prev->weight * change;
|
||||||
if (testw > tdw_prev->weight) {
|
if (observedChange > 0) {
|
||||||
if (change > oldChange) {
|
if (change > oldChange) {
|
||||||
/* reset the weights and use the new change */
|
/* reset the weights and use the new change */
|
||||||
defvert_reset_to_prev(wp->wpaint_prev + index, dv);
|
defvert_reset_to_prev(wp->wpaint_prev + index, dv);
|
||||||
|
Reference in New Issue
Block a user