From be20bf2fc0704fa5894dbce5e3dbb0b7784eb3eb Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 10 Mar 2020 16:45:31 +0100 Subject: Fix T74617: Gpencil Sculpt Strength brush gets wonky results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed how the strength is calculñated and reduce the factor to get a smoother result. --- .../blender/editors/gpencil/gpencil_sculpt_paint.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 5cf4681c755..adc009efd16 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -405,27 +405,15 @@ static bool gp_brush_strength_apply(tGP_BrushEditData *gso, bGPDspoint *pt = gps->points + pt_index; float inf; - /* Compute strength of effect - * - We divide the strength, so that users can set "sane" values. - * Otherwise, good default values are in the range of 0.093 - */ - inf = gp_brush_influence_calc(gso, radius, co) / 2.0f; - CLAMP_MIN(inf, 0.01f); + /* Compute strength of effect */ + inf = gp_brush_influence_calc(gso, radius, co) * 0.125f; - /* apply */ + /* Invert effect. */ if (gp_brush_invert_check(gso)) { - /* make line more transparent - reduce alpha factor */ - pt->strength -= inf; - } - else { - /* make line more opaque - increase stroke strength */ - pt->strength += inf; + inf *= -1.0f; } - /* Strength should stay within [0.0, 1.0] */ - CLAMP(pt->strength, 0.0f, 1.0f); - /* smooth the strength */ - BKE_gpencil_stroke_smooth_strength(gps, pt_index, inf); + pt->strength = clamp_f(pt->strength + inf, 0.0f, 1.0f); return true; } -- cgit v1.2.3