[Bf-blender-cvs] [e77fdc62b75] master: Fix T72006: Clay brush with size pressure corrupts mesh
Pablo Dobarro
noreply at git.blender.org
Mon Dec 9 16:57:35 CET 2019
Commit: e77fdc62b75a3b96e4c3ca5c2fc4025d8091ff99
Author: Pablo Dobarro
Date: Thu Nov 28 16:48:43 2019 +0100
Branches: master
https://developer.blender.org/rBe77fdc62b75a3b96e4c3ca5c2fc4025d8091ff99
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
===================================================================
M source/blender/editors/sculpt_paint/sculpt.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 2d09f188c48..f813be7d0a2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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)
{
More information about the Bf-blender-cvs
mailing list