Fix T72006: Clay brush with size pressure corrupts mesh

When size pressure is enabled, the radius may not be enough to sample
any vertices to calculate the area normal. This lead to a vector 0 plane
and a division by 0 when calculating the signed distance to the plane,
which produces a NaN that was being written to the vertex coordinates.

Reviewed By: brecht

Maniphest Tasks: T72006

Differential Revision: https://developer.blender.org/D6326
This commit is contained in:
Pablo Dobarro 2019-11-28 16:48:43 +01:00
parent 8a7851de3a
commit e77fdc62b7
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by issue #72006, Sculpt size pressure corrupts mesh when using a tablet, crash/hang after remesh
1 changed files with 4 additions and 0 deletions

View File

@ -4616,6 +4616,10 @@ static void calc_clay_surface_task_cb(void *__restrict userdata,
test.radius_squared = test_radius * test_radius;
plane_from_point_normal_v3(plane, area_co, area_no);
if (is_zero_v4(plane)) {
return;
}
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{