[Bf-blender-cvs] [9e3006e5079] master: Clay Brush: Input curves and update defaults

Pablo Dobarro noreply at git.blender.org
Wed Nov 27 17:30:30 CET 2019


Commit: 9e3006e5079cc3dd65ab755301feda4f603804b4
Author: Pablo Dobarro
Date:   Sun Nov 24 21:20:27 2019 +0100
Branches: master
https://developer.blender.org/rB9e3006e5079cc3dd65ab755301feda4f603804b4

Clay Brush: Input curves and update defaults

Updated defaults and pressure/size curves for the Clay brush.

Reviewed By: jbakker

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

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

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 a64da8f6606..8b90eafdddf 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -931,7 +931,9 @@ void BKE_brush_sculpt_reset(Brush *br)
       br->alpha = 1.0f;
       break;
     case SCULPT_TOOL_CLAY:
-      br->spacing = 6;
+      br->flag |= BRUSH_SIZE_PRESSURE;
+      br->spacing = 3;
+      br->autosmooth_factor = 0.25f;
       br->normal_radius_factor = 0.75f;
       break;
     case SCULPT_TOOL_CLAY_STRIPS:
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 63b9949e0ef..9eb32a9f731 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1741,8 +1741,9 @@ static float brush_strength(const Sculpt *sd,
 
   switch (brush->sculpt_tool) {
     case SCULPT_TOOL_CLAY:
+      final_pressure = pow4f(pressure);
       overlap = (1.0f + overlap) / 2.0f;
-      return 0.25f * alpha * flip * pressure * overlap * feather;
+      return 0.25f * alpha * flip * final_pressure * overlap * feather;
     case SCULPT_TOOL_DRAW:
     case SCULPT_TOOL_DRAW_SHARP:
     case SCULPT_TOOL_LAYER:
@@ -4659,7 +4660,6 @@ static void do_clay_brush_task_cb_ex(void *__restrict userdata,
     if (sculpt_brush_test_sq_fn(&test, vd.co)) {
       float intr[3];
       float val[3];
-
       closest_to_plane_normalized_v3(intr, test.plane_tool, vd.co);
 
       sub_v3_v3v3(val, intr, vd.co);
@@ -4695,6 +4695,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
   Brush *brush = BKE_paint_brush(&sd->paint);
 
   const float radius = fabsf(ss->cache->radius);
+  const float initial_radius = fabsf(ss->cache->initial_radius);
   bool flip = ss->cache->bstrength < 0.0f;
 
   float offset = get_offset(sd, ss);
@@ -4730,7 +4731,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
   d_offset = min_ff(radius, d_offset);
   d_offset = d_offset / radius;
   d_offset = 1.0f - d_offset;
-  displace = fabsf(radius * (0.25f + offset + (d_offset * 0.15f)));
+  displace = fabsf(initial_radius * (0.25f + offset + (d_offset * 0.15f)));
   if (flip) {
     displace = -displace;
   }
@@ -6514,8 +6515,10 @@ static void sculpt_update_cache_invariants(
 static float sculpt_brush_dynamic_size_get(Brush *brush, StrokeCache *cache, float initial_size)
 {
   switch (brush->sculpt_tool) {
+    case SCULPT_TOOL_CLAY:
+      return max_ff(initial_size * 0.20f, initial_size * pow3f(cache->pressure));
     case SCULPT_TOOL_CLAY_STRIPS:
-      return max_ff(initial_size * 0.35f, initial_size * cache->pressure * cache->pressure);
+      return max_ff(initial_size * 0.35f, initial_size * pow2f(cache->pressure));
     default:
       return initial_size * cache->pressure;
   }



More information about the Bf-blender-cvs mailing list