diff options
author | Pablo Dobarro <pablodp606> | 2020-03-09 23:19:44 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-09 23:19:55 +0300 |
commit | 4652f23fa340f0ca96c217fe7116493b94793b72 (patch) | |
tree | 0474a2e2d21e3cc1963a53acf3e3e2cc7f82061a /source/blender/editors/sculpt_paint | |
parent | 84b94f9e7b8b36ac74980e31b6a2c69bc49b2e0d (diff) |
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
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |