[Bf-blender-cvs] [4652f23fa34] master: Fix T74354: Avoid division by 0 when calculating hardness

Pablo Dobarro noreply at git.blender.org
Mon Mar 9 21:20:50 CET 2020


Commit: 4652f23fa340f0ca96c217fe7116493b94793b72
Author: Pablo Dobarro
Date:   Mon Mar 9 21:19:44 2020 +0100
Branches: master
https://developer.blender.org/rB4652f23fa340f0ca96c217fe7116493b94793b72

Fix T74354: Avoid division by 0 when calculating hardness

I could not reproduce the issue, but it looks like it was produced by
this division by 0. In any case, the code here was wrong.

Reviewed By: jbakker

Maniphest Tasks: T74354

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

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

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 148f5bf8799..e527fbfb40e 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2358,6 +2358,9 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
   if (p < hardness) {
     final_len = 0.0f;
   }
+  else if (hardness == 1.0f) {
+    final_len = cache->radius;
+  }
   else {
     p = (p - hardness) / (1.0f - hardness);
     final_len = p * cache->radius;



More information about the Bf-blender-cvs mailing list