[Bf-blender-cvs] [23db569df7d] sculpt-dev: Sculpt: added parameter to options panel to control smooth projection (volume preservation) for shift-smooth

Joseph Eagar noreply at git.blender.org
Mon Oct 4 11:19:57 CEST 2021


Commit: 23db569df7d874cee8c18d1164814b5f973af212
Author: Joseph Eagar
Date:   Mon Oct 4 02:19:12 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB23db569df7d874cee8c18d1164814b5f973af212

Sculpt: added parameter to options panel
        to control smooth projection
	(volume preservation) for shift-smooth

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/brush_channel_define.h
M	source/blender/blenkernel/intern/brush_engine_presets.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index f9526f21ae1..0911ee2162e 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1234,6 +1234,11 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
             brush,
             "smooth_strength_factor", ui_editing=False, slider=True)
 
+        UnifiedPaintPanel.channel_unified(layout.column(),
+            context,
+            brush,
+            "smooth_strength_projection", ui_editing=False, slider=True)
+
         #col.prop(sculpt, "smooth_strength_factor")
 
         col.separator()
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index f042a9e9f70..86ad65113f2 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -222,6 +222,7 @@ places in rna_engine_codebase are relevent:
   })
 
   MAKE_FLOAT_EX_EX(smooth_strength_factor, "Smooth Strength", "Factor to control the strength of shift-smooth", 0.1f, 0.0f, 10.0f, 0.0f, 2.0f, false, false, BRUSH_CHANNEL_INHERIT)
+  MAKE_FLOAT_EX_EX(smooth_strength_projection, "Smooth Projection", "Factor to control the volume preservation of shift-smooth", 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, false, false, BRUSH_CHANNEL_INHERIT)
   MAKE_ENUM(smooth_deform_type, "Deformation", "Deformation type that is used in the brush",  BRUSH_SMOOTH_DEFORM_LAPLACIAN, {
       {BRUSH_SMOOTH_DEFORM_LAPLACIAN,
        "LAPLACIAN",
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index 879d2e4c198..4d1553a0e85 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -1017,6 +1017,8 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
     ADDCH(smooth_strength_factor)->flag |= BRUSH_CHANNEL_INHERIT;
   }
 
+  ADDCH(smooth_strength_projection);
+
   ADDCH(accumulate);
   ADDCH(original_normal);
   ADDCH(original_plane);
@@ -1727,6 +1729,7 @@ void BKE_brush_check_toolsettings(Sculpt *sd)
   ADDCH(unprojected_radius);
 
   ADDCH(smooth_strength_factor);
+  ADDCH(smooth_strength_projection);
 
   ADDCH(tilt_strength_factor);
   ADDCH(automasking_boundary_edges_propagation_steps);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 1ec5035a223..d1aae016ba9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8728,7 +8728,11 @@ void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
 
   if (ss->cache->alt_smooth && brush->sculpt_tool == SCULPT_TOOL_SMOOTH) {
     float factor = BRUSHSET_GET_FLOAT(ss->cache->channels_final, smooth_strength_factor, NULL);
+    float projection = BRUSHSET_GET_FLOAT(
+        ss->cache->channels_final, smooth_strength_projection, NULL);
+
     BRUSHSET_SET_FLOAT(ss->cache->channels_final, strength, factor);
+    BRUSHSET_SET_FLOAT(ss->cache->channels_final, projection, projection);
   }
 
   if (ok) {
@@ -9536,7 +9540,8 @@ static void SCULPT_run_command_list(
         break;
       case SCULPT_TOOL_SMOOTH:
         if (brush2->smooth_deform_type == BRUSH_SMOOTH_DEFORM_LAPLACIAN) {
-          SCULPT_do_smooth_brush(sd, ob, nodes, totnode, brush2->autosmooth_projection);
+          SCULPT_do_smooth_brush(
+              sd, ob, nodes, totnode, BRUSHSET_GET_FLOAT(cmd->params_mapped, projection, NULL));
         }
         else if (brush2->smooth_deform_type == BRUSH_SMOOTH_DEFORM_SURFACE) {
           SCULPT_do_surface_smooth_brush(sd, ob, nodes, totnode);



More information about the Bf-blender-cvs mailing list