From eed4f950d826d0f27ccf1f1b36fc12ebe432bbf3 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 20 Oct 2023 14:21:23 +0200 Subject: [PATCH] Fix #113798: Weight paint gradient tool paints over hidden vertices Note 0a0a29887d70 / 4c99043a85bb were supposed to fix this. This was mostly working, but verts could still obtain wrong weights (most notably "outside" the gradient range). Code from above commits would correctly skip hidden verts in `gradientVertUpdate__mapFunc`. However, `gradientVertInit__mapFunc` (called prior) already does `gradientVert_update` once [not entirely sure why it does this, but wouldnt want to remove the call there due to unforseen behavioral changes] and we dont early out there. So now move the check for hidden verts from `gradientVertUpdate__mapFunc` to `gradientVertInit__mapFunc` and early out (also saves us from doing other unneccessary stuff there). Pull Request: https://projects.blender.org/blender/blender/pulls/113825 --- .../editors/sculpt_paint/paint_vertex_weight_ops.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.cc b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.cc index c1523117142..5eff4e5ef25 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.cc +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.cc @@ -644,10 +644,6 @@ static void gradientVertUpdate__mapFunc(void *user_data, return; } - if (grad_data->hide_vert[index]) { - return; - } - gradientVert_update(grad_data, index); } @@ -659,7 +655,9 @@ static void gradientVertInit__mapFunc(void *user_data, WPGradient_userData *grad_data = static_cast(user_data); WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index]; - if (grad_data->use_select && (grad_data->select_vert && !grad_data->select_vert[index])) { + if (grad_data->hide_vert[index] || + (grad_data->use_select && (grad_data->select_vert && !grad_data->select_vert[index]))) + { copy_v2_fl(vs->sco, FLT_MAX); return; }