[Bf-blender-cvs] [1f43ea041e8] sculpt-dev: Sculpt-dev: fix broken brush falloff curve defaults
Joseph Eagar
noreply at git.blender.org
Mon Jan 10 12:34:01 CET 2022
Commit: 1f43ea041e8b36c4df5cead5132ad950a406e986
Author: Joseph Eagar
Date: Mon Jan 10 03:32:11 2022 -0800
Branches: sculpt-dev
https://developer.blender.org/rB1f43ea041e8b36c4df5cead5132ad950a406e986
Sculpt-dev: fix broken brush falloff
curve defaults
* brush_engine_presets.c now sets falloff
curves properly when resetting brushes.
* Fixed visual bug in one-column toolbar.
===================================================================
M release/datafiles/startup.blend
M release/scripts/startup/bl_ui/space_toolsystem_common.py
M source/blender/blenkernel/intern/brush_engine_presets.c
===================================================================
diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend
index 91a661a27f9..cc16b16e21a 100644
Binary files a/release/datafiles/startup.blend and b/release/datafiles/startup.blend differ
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index f63beee3f03..e4dd1da05be 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -732,6 +732,7 @@ class ToolSelectPanelHelper:
if item.get_enabled is not None:
sub2 = sub.row(align=False)
+ sub2.scale_x = 2.0
sub2.enabled = item.get_enabled(context, item.idname)
if use_menu:
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index 0c463470edc..c33577c520f 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -971,6 +971,32 @@ void BKE_brush_channelset_compat_load(BrushChannelSet *chset, Brush *brush, bool
brush->flag &= ~BRUSH_INVERSE_SMOOTH_PRESSURE;
}
}
+
+ if (brush_to_channels) {
+ BrushChannel *ch = BRUSHSET_LOOKUP(chset, falloff_curve);
+
+ if (ch) {
+ ch->curve.preset = brush->curve_preset;
+ BKE_brush_channel_curve_ensure_write(&ch->curve);
+
+ if (brush->curve && brush->curve_preset == BRUSH_CURVE_CUSTOM) {
+ BKE_curvemapping_free_data(ch->curve.curve);
+ BKE_curvemapping_copy_data(ch->curve.curve, brush->curve);
+ }
+ }
+ }
+ else {
+ BrushChannel *ch = BRUSHSET_LOOKUP(chset, falloff_curve);
+
+ if (ch) {
+ brush->curve_preset = ch->curve.preset;
+
+ if (ch->curve.curve && ch->curve.preset == BRUSH_CURVE_CUSTOM) {
+ BKE_curvemapping_free_data(brush->curve);
+ BKE_curvemapping_copy_data(brush->curve, ch->curve.curve);
+ }
+ }
+ }
}
/* todo: move into BKE_brush_reset_mapping*/
@@ -1755,6 +1781,8 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
break;
}
case SCULPT_TOOL_DRAW_SHARP:
+ BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_POW4;
+
BRUSHSET_LOOKUP(chset, spacing)->fvalue = 5;
BRUSHSET_SET_INT(chset, direction, 1);
BRUSHSET_LOOKUP(chset, radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |=
@@ -1765,12 +1793,15 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
case SCULPT_TOOL_DISPLACEMENT_ERASER:
case SCULPT_TOOL_FAIRING:
case SCULPT_TOOL_SCENE_PROJECT:
+ BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_SMOOTHER;
BRUSHSET_LOOKUP(chset, spacing)->fvalue = 10;
BRUSHSET_LOOKUP(chset, strength)->fvalue = 1.0f;
BRUSHSET_LOOKUP(chset, dyntopo_disabled)->ivalue = 1;
BRUSHSET_SET_BOOL(chset, use_space_attenuation, false);
break;
case SCULPT_TOOL_SMEAR:
+ BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_SPHERE;
+
BRUSHSET_SET_FLOAT(chset, spacing, 5.0f);
BRUSHSET_SET_FLOAT(chset, strength, 1.0f);
BRUSHSET_LOOKUP(chset, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag &=
@@ -1837,7 +1868,7 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
~BRUSH_MAPPING_ENABLED;
break;
case SCULPT_TOOL_CLAY_STRIPS: {
- // BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_SMOOTHER;
+ BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_SMOOTHER;
BRUSHSET_LOOKUP(chset, radius)->mappings[BRUSH_MAPPING_PRESSURE].flag |=
BRUSH_MAPPING_ENABLED;
@@ -1958,6 +1989,8 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
BRUSHSET_SET_BOOL(chset, use_space_attenuation, false);
break;
case SCULPT_TOOL_BOUNDARY:
+ BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_CONSTANT;
+
BRUSHSET_LOOKUP(chset, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag &=
~BRUSH_MAPPING_ENABLED;
BRUSHSET_SET_BOOL(chset, use_space_attenuation, false);
@@ -1971,10 +2004,16 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
ADDCH(elastic_deform_type);
ADDCH(elastic_deform_volume_preservation);
break;
+ case SCULPT_TOOL_DISPLACEMENT_SMEAR:
+ BRUSHSET_LOOKUP(chset, falloff_curve)->curve.preset = BRUSH_CURVE_SMOOTHER;
+ BRUSHSET_LOOKUP(chset, strength)->mappings[BRUSH_MAPPING_PRESSURE].flag &=
+ ~BRUSH_MAPPING_ENABLED;
+ BRUSHSET_SET_BOOL(chset, use_space_attenuation, false);
+ BRUSHSET_SET_FLOAT(chset, hardness, 0.7f);
+ BRUSHSET_SET_FLOAT(chset, spacing, 5.0f);
+ BRUSHSET_SET_FLOAT(chset, strength, 1.0f);
+ break;
default: {
- // implement me!
- // BKE_brush_channelset_free(chset);
- // brush->channels = NULL;
break;
}
}
More information about the Bf-blender-cvs
mailing list