Fix #113798: Weight paint gradient tool paints over hidden vertices

Note 0a0a29887d / 4c99043a85 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
This commit is contained in:
Philipp Oeser 2023-10-20 14:21:23 +02:00 committed by Philipp Oeser
parent 3cb659faa8
commit eed4f950d8
1 changed files with 3 additions and 5 deletions

View File

@ -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<WPGradient_userData *>(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;
}