[Bf-blender-cvs] [c65b9fb825f] master: Sculpt: Remove hardcoded hardness from Clay brush

Pablo Dobarro noreply at git.blender.org
Mon Mar 9 19:29:47 CET 2020


Commit: c65b9fb825f61dceda5fc4565c8df01a3b837447
Author: Pablo Dobarro
Date:   Mon Mar 9 16:35:07 2020 +0100
Branches: master
https://developer.blender.org/rBc65b9fb825f61dceda5fc4565c8df01a3b837447

Sculpt: Remove hardcoded hardness from Clay brush

Hardness is now a property implemented for all brushes, so this is no
longer needed.

Reviewed By: brecht

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

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

M	source/blender/blenkernel/intern/brush.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 1716439c3fd..74c492573b1 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1303,6 +1303,7 @@ void BKE_brush_sculpt_reset(Brush *br)
       br->spacing = 3;
       br->autosmooth_factor = 0.25f;
       br->normal_radius_factor = 0.75f;
+      br->hardness = 0.65f;
       break;
     case SCULPT_TOOL_CLAY_THUMB:
       br->alpha = 0.5f;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 443aaef85c5..f389dfb84ea 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -4888,7 +4888,6 @@ static void do_clay_brush_task_cb_ex(void *__restrict userdata,
   const Brush *brush = data->brush;
   const float *area_no = data->area_no;
   const float *area_co = data->area_co;
-  const float hardness = 0.65f;
 
   PBVHVertexIter vd;
   float(*proxy)[3];
@@ -4911,15 +4910,10 @@ static void do_clay_brush_task_cb_ex(void *__restrict userdata,
 
       sub_v3_v3v3(val, intr, vd.co);
 
-      float dist = sqrtf(test.dist);
-      float p = dist / ss->cache->radius;
-      p = (p - hardness) / (1.0f - hardness);
-      CLAMP(p, 0.0f, 1.0f);
-      dist *= p;
       const float fade = bstrength * SCULPT_brush_strength_factor(ss,
                                                                   brush,
                                                                   vd.co,
-                                                                  dist,
+                                                                  sqrtf(test.dist),
                                                                   vd.no,
                                                                   vd.fno,
                                                                   vd.mask ? *vd.mask : 0.0f,



More information about the Bf-blender-cvs mailing list