[Bf-blender-cvs] [c01f8bb672f] master: Sculpt: Enable pen pressure for Scrape/Fill Area Radius

Pablo Dobarro noreply at git.blender.org
Thu Sep 10 22:08:57 CEST 2020


Commit: c01f8bb672f3d7140f5a6df80c0279e07c4b328b
Author: Pablo Dobarro
Date:   Thu Sep 10 22:07:28 2020 +0200
Branches: master
https://developer.blender.org/rBc01f8bb672f3d7140f5a6df80c0279e07c4b328b

Sculpt: Enable pen pressure for Scrape/Fill Area Radius

This should improve the issue with Scrape accumulation in concave
surfaces. When the strength of the brush is higher, the area radius is
also bigger, so the scrape plane is more stable preventing it from
accumulating displacement in the same area.
The Scrape/Fill default presets are also updated to include this
functionality.

Reviewed By: sergey

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

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	source/blender/blenkernel/intern/brush.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index a20de3e29db..d5f48876491 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -677,14 +677,16 @@ def brush_settings(layout, context, brush, popover=False):
             layout.separator()
 
         elif sculpt_tool == 'SCRAPE':
-            row = layout.row()
-            row.prop(brush, "area_radius_factor", slider=True)
+            row = layout.row(align=True)
+            row.prop(brush, "area_radius_factor")
+            row.prop(brush, "use_pressure_area_radius", text="")
             row = layout.row()
             row.prop(brush, "invert_to_scrape_fill", text="Invert to Fill")
 
         elif sculpt_tool == 'FILL':
-            row = layout.row()
-            row.prop(brush, "area_radius_factor", slider=True)
+            row = layout.row(align=True)
+            row.prop(brush, "area_radius_factor")
+            row.prop(brush, "use_pressure_area_radius", text="")
             row = layout.row()
             row.prop(brush, "invert_to_scrape_fill", text="Invert to Scrape")
 
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index ffd51f136a4..a816e4354b8 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1707,10 +1707,12 @@ void BKE_brush_sculpt_reset(Brush *br)
       break;
     case SCULPT_TOOL_SCRAPE:
     case SCULPT_TOOL_FILL:
-      br->alpha = 1.0f;
+      br->alpha = 0.7f;
+      br->area_radius_factor = 1.0f;
       br->spacing = 7;
       br->flag |= BRUSH_ACCUMULATE;
       br->flag |= BRUSH_INVERT_TO_SCRAPE_FILL;
+      br->flag2 |= BRUSH_AREA_RADIUS_PRESSURE;
       break;
     case SCULPT_TOOL_ROTATE:
       br->alpha = 1.0;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 5070709cb6d..e6ea79a771a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1920,6 +1920,9 @@ static void calc_area_normal_and_center_task_cb(void *__restrict userdata,
     if (ELEM(data->brush->sculpt_tool, SCULPT_TOOL_SCRAPE, SCULPT_TOOL_FILL) &&
         data->brush->area_radius_factor > 0.0f) {
       test_radius *= data->brush->area_radius_factor;
+      if (ss->cache && data->brush->flag2 & BRUSH_AREA_RADIUS_PRESSURE) {
+        test_radius *= ss->cache->pressure;
+      }
     }
     else {
       test_radius *= data->brush->normal_radius_factor;
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 033a69d230e..6c3ffc09919 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -774,6 +774,7 @@ typedef enum eBrushFlags2 {
   BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY = (1 << 4),
   BRUSH_POSE_USE_LOCK_ROTATION = (1 << 5),
   BRUSH_CLOTH_USE_COLLISION = (1 << 6),
+  BRUSH_AREA_RADIUS_PRESSURE = (1 << 7),
 } eBrushFlags2;
 
 typedef enum {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 0b923eb5635..3fd32aa6fd7 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2971,6 +2971,13 @@ static void rna_def_brush(BlenderRNA *brna)
       prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
   RNA_def_property_update(prop, 0, "rna_Brush_update");
 
+  prop = RNA_def_property(srna, "use_pressure_area_radius", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag2", BRUSH_AREA_RADIUS_PRESSURE);
+  RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+  RNA_def_property_ui_text(
+      prop, "Area Radius Pressure", "Enable tablet pressure sensitivity for area radius");
+  RNA_def_property_update(prop, 0, "rna_Brush_update");
+
   prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
   RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);



More information about the Bf-blender-cvs mailing list