[Bf-blender-cvs] [88fd2b1dd5f] master: Fix T74648: Do not relax with 0 neighbors or no vertex normal

Pablo Dobarro noreply at git.blender.org
Thu Mar 12 20:37:07 CET 2020


Commit: 88fd2b1dd5fab444850cb17f545fc860c0e7c88a
Author: Pablo Dobarro
Date:   Wed Mar 11 13:36:20 2020 +0100
Branches: master
https://developer.blender.org/rB88fd2b1dd5fab444850cb17f545fc860c0e7c88a

Fix T74648: Do not relax with 0 neighbors or no vertex normal

The mesh provided in the report has 0 area faces and overlapping
vertices, causing the relax code to fail when calculating the plane to
constraint the vertex movement. Now it works fine both in the brush and
in the mesh filter.

Reviewed By: jbakker

Maniphest Tasks: T74648

Differential Revision: https://developer.blender.org/D7109

===================================================================

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 7839922eadc..7d929c24795 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3661,6 +3661,10 @@ void SCULPT_relax_vertex(SculptSession *ss,
   if (count > 0) {
     mul_v3_fl(smooth_pos, 1.0f / (float)count);
   }
+  else {
+    copy_v3_v3(r_final_pos, vd->co);
+    return;
+  }
 
   float plane[4];
   float smooth_closest_plane[3];
@@ -3671,6 +3675,12 @@ void SCULPT_relax_vertex(SculptSession *ss,
   else {
     copy_v3_v3(vno, vd->fno);
   }
+
+  if (is_zero_v3(vno)) {
+    copy_v3_v3(r_final_pos, vd->co);
+    return;
+  }
+
   plane_from_point_normal_v3(plane, vd->co, vno);
   closest_to_plane_v3(smooth_closest_plane, plane, smooth_pos);
   sub_v3_v3v3(final_disp, smooth_closest_plane, vd->co);



More information about the Bf-blender-cvs mailing list