[Bf-blender-cvs] [05bb102a300] sculpt-dev: Sculpt: Add global smooth strength factor for alt-smooth
Pablo Dobarro
noreply at git.blender.org
Tue Feb 23 22:53:15 CET 2021
Commit: 05bb102a3005dc6322506825b3e962b946e893b5
Author: Pablo Dobarro
Date: Tue Feb 23 22:52:40 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB05bb102a3005dc6322506825b3e962b946e893b5
Sculpt: Add global smooth strength factor for alt-smooth
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenloader/intern/versioning_290.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2fe6fcd045b..7a7ee4a66a4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -850,6 +850,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
col.prop(sculpt, "use_sculpt_delay_updates")
col.prop(sculpt, "use_deform_only")
col.prop(sculpt, "show_sculpt_pivot")
+ col.prop(sculpt, "smooth_strength_factor")
col.separator()
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 4627e07caa7..b5342c05103 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1758,5 +1758,12 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
BKE_brush_default_input_curves_set(br);
}
+
+ if (!DNA_struct_elem_find(fd->filesdna, "Sculpt", "float", "smooth_strength_factor")) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
+ Sculpt *sd = scene->toolsettings->sculpt;
+ sd->smooth_strength_factor = 1.0f;
+ }
+ }
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 50d40402d06..7fedb5521ed 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2472,8 +2472,13 @@ static float brush_strength(const Sculpt *sd,
return 0.5f * alpha * flip * pressure * overlap * feather;
}
- case SCULPT_TOOL_SMOOTH:
- return flip * alpha * pressure * feather;
+ case SCULPT_TOOL_SMOOTH: {
+ const float smooth_strength_base = flip * alpha * pressure * feather;
+ if (cache->alt_smooth) {
+ return smooth_strength_base * sd->smooth_strength_factor;
+ }
+ return smooth_strength_base;
+ }
case SCULPT_TOOL_PINCH:
if (flip > 0.0f) {
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 63ad60d9b27..5b77ca6ab27 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -979,6 +979,10 @@ typedef struct Sculpt {
int transform_mode;
int transform_deform_target;
+ /* Factor to tweak the stregtn of alt-smoothing. */
+ float smooth_strength_factor;
+ char _pad0[4];
+
int automasking_flags;
/* Control tablet input */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 63015a38c03..c43b1d39fce 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -904,6 +904,14 @@ static void rna_def_sculpt(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gravity", "Amount of gravity after each dab");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ prop = RNA_def_property(srna, "smooth_strength_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "smooth_strength_factor");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Smooth Strength", "Factor to control the strength of alt-smooth");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
prop = RNA_def_property(srna, "transform_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, sculpt_transform_mode_items);
RNA_def_property_ui_text(
More information about the Bf-blender-cvs
mailing list