Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-03-11 15:36:20 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-03-12 22:36:49 +0300
commit88fd2b1dd5fab444850cb17f545fc860c0e7c88a (patch)
tree2b3b1030f3b0c3cf7217af0d8500a91aa51a5689
parent088b92b92ceec1f69c55740b09683fe10d472422 (diff)
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
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c10
1 files changed, 10 insertions, 0 deletions
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);