Sculpt: added parameter to options panel

to control smooth projection
	(volume preservation) for shift-smooth
This commit is contained in:
Joseph Eagar 2021-10-04 02:19:12 -07:00
parent 2d541b2e39
commit 23db569df7
4 changed files with 15 additions and 1 deletions

View File

@ -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()

View File

@ -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",

View File

@ -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);

View File

@ -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);