Sculpt: Clay Strips brush tweaks
authorPablo Dobarro <pablodp606@gmail.com>
Thu, 3 Oct 2019 21:46:29 +0000 (23:46 +0200)
committerPablo Dobarro <pablodp606@gmail.com>
Fri, 4 Oct 2019 13:28:00 +0000 (15:28 +0200)
- Fix accumulate by allowing normal radius greater than one. Now it works as it should and it should be enabled by default
- Make the square test sharper. This gives a lot more definition to the brush, even when working with fewer polygons

Reviewed By: brecht

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

source/blender/blenkernel/intern/brush.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/makesrna/intern/rna_brush.c

index f80d262ee472e9bd5387b7221b7a90b47835b0e6..39a12a997efabc499808be224be2c866a8f49d88 100644 (file)
@@ -909,6 +909,13 @@ void BKE_brush_sculpt_reset(Brush *br)
     case SCULPT_TOOL_CLAY:
       br->flag |= BRUSH_FRONTFACE;
       break;
+    case SCULPT_TOOL_CLAY_STRIPS:
+      br->flag |= BRUSH_ACCUMULATE;
+      br->alpha = 0.7f;
+      br->normal_radius_factor = 1.7f;
+      br->curve_preset = BRUSH_CURVE_SPHERE;
+      br->spacing = 6;
+      break;
     case SCULPT_TOOL_CREASE:
       br->flag |= BRUSH_DIR_IN;
       br->alpha = 0.25;
index 6e9f62b980cf975ff6f807efc724941e8f4882f4..64674ecd0a18580ec7f2f63679f782a2227ec07f 100644 (file)
@@ -1098,9 +1098,8 @@ bool sculpt_brush_test_cube(SculptBrushTest *test, const float co[3], float loca
   local_co[1] = fabsf(local_co[1]);
   local_co[2] = fabsf(local_co[2]);
 
+  const float p = 8.0f;
   if (local_co[0] <= side && local_co[1] <= side && local_co[2] <= side) {
-    float p = 4.0f;
-
     test->dist = ((powf(local_co[0], p) + powf(local_co[1], p) + powf(local_co[2], p)) /
                   powf(side, p));
 
@@ -1740,11 +1739,13 @@ static float brush_strength(const Sculpt *sd,
 
   switch (brush->sculpt_tool) {
     case SCULPT_TOOL_CLAY:
-    case SCULPT_TOOL_CLAY_STRIPS:
     case SCULPT_TOOL_DRAW:
     case SCULPT_TOOL_DRAW_SHARP:
     case SCULPT_TOOL_LAYER:
       return alpha * flip * pressure * overlap * feather;
+    case SCULPT_TOOL_CLAY_STRIPS:
+      /* Clay Strips needs extra strength to compensate for its default normal radius */
+      return alpha * flip * pressure * overlap * feather * 1.3f;
 
     case SCULPT_TOOL_MASK:
       overlap = (1 + overlap) / 2;
index d64970d03abb42be24620c4836416414f5ee0697..2aaa9e7855e72695f28e717c397d55d5f6c1836a 100644 (file)
@@ -1885,8 +1885,8 @@ static void rna_def_brush(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "normal_radius_factor", PROP_FLOAT, PROP_FACTOR);
   RNA_def_property_float_sdna(prop, NULL, "normal_radius_factor");
-  RNA_def_property_range(prop, 0.0f, 1.0f);
-  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+  RNA_def_property_range(prop, 0.0f, 2.0f);
+  RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.001, 3);
   RNA_def_property_ui_text(prop,
                            "Normal Radius",
                            "Ratio between the brush radius and the radius that is going to be "