Fix T68499: weight paint gradient is broken with generative modifiers

Caused by rBac442da4a14d.

Above commit tweaked the logic to not only early out, but also set the
WPGradient_vertStore screen coord to FLT_MAX in case this original index
was visited before [gradientVertInit__mapFunc].
For generative modifiers though, we might get here multiple times for the
same orig index, resulting in a valid orig index being made invalid for
gradientVertUpdate__mapFunc [which would early out in case of FLT_MAX].

Restored original logic, so that setting FLT_MAX only really happens
when it should: when ED_view3d_project_float_object fails...

Maniphest Tasks: T68499

Differential Revision: https://developer.blender.org/D6282
This commit is contained in:
Philipp Oeser
2019-11-20 21:08:42 +01:00
parent 1fbb86654a
commit cee9478985

View File

@@ -665,13 +665,15 @@ static void gradientVertInit__mapFunc(void *userData,
* the screen coords of the verts need to be cached because
* updating the mesh may move them about (entering feedback loop) */
if (BLI_BITMAP_TEST(grad_data->vert_visit, index)) {
copy_v2_fl(vs->sco, FLT_MAX);
/* Do not copy FLT_MAX here, for generative modifiers we are getting here
* multiple times with the same orig index. */
return;
}
if (ED_view3d_project_float_object(
grad_data->ar, co, vs->sco, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) !=
V3D_PROJ_RET_OK) {
copy_v2_fl(vs->sco, FLT_MAX);
return;
}