[Bf-blender-cvs] [2b2b5692298] sculpt-dev: Disable a static assert on gcc.
Joseph Eagar
noreply at git.blender.org
Tue Sep 21 05:27:08 CEST 2021
Commit: 2b2b5692298a776d5dd4dd61e086026b1cd008cf
Author: Joseph Eagar
Date: Mon Sep 20 20:26:53 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB2b2b5692298a776d5dd4dd61e086026b1cd008cf
Disable a static assert on gcc.
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M source/blender/blenkernel/intern/brush_engine.c
M source/blender/blenkernel/intern/brush_engine_presets.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/makesdna/DNA_sculpt_brush_types.h
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 38b75fe9713..8025b17cbed 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -856,12 +856,19 @@ def brush_settings(layout, context, brush, popover=False):
if capabilities.has_color:
ups = context.scene.tool_settings.unified_paint_settings
- row = layout.row(align=True)
+
+ if context.mode == "SCULPT":
+ row = layout.column(align=True)
+ else:
+ row = layout.row(align=True)
+
UnifiedPaintPanel.prop_unified_color(row, context, brush, "color", text="")
UnifiedPaintPanel.prop_unified_color(row, context, brush, "secondary_color", text="")
- row.separator()
- row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False)
- row.prop(ups, "use_unified_color", text="", icon='BRUSHES_ALL')
+
+ if context.mode != "SCULPT":
+ row.separator()
+ row.operator("paint.brush_colors_flip", icon='FILE_REFRESH', text="", emboss=False)
+ row.prop(ups, "use_unified_color", text="", icon='BRUSHES_ALL')
layout.prop(brush, "blend", text="Blend Mode")
# Per sculpt tool options.
diff --git a/source/blender/blenkernel/intern/brush_engine.c b/source/blender/blenkernel/intern/brush_engine.c
index 6f0b96e5d69..50929dfa649 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -1218,6 +1218,58 @@ static void float_set_uninherit(BrushChannelSet *chset, const char *channel, flo
ch->flag &= ~BRUSH_CHANNEL_INHERIT;
}
+ATTR_NO_OPT static void bke_builtin_commandlist_create_paint(Brush *brush,
+ BrushChannelSet *chset,
+ BrushCommandList *cl,
+ int tool,
+ BrushMappingData *mapdata)
+{
+ BrushCommand *cmd;
+
+ cmd = BKE_brush_commandlist_add(cl, chset, true);
+ BKE_brush_command_init(cmd, tool);
+
+ float radius = BKE_brush_channelset_get_float(chset, "radius", mapdata);
+
+ /* build autosmooth command */
+ float autosmooth_scale = BKE_brush_channelset_get_float(
+ chset, "autosmooth_radius_scale", mapdata);
+ float autosmooth_projection = BKE_brush_channelset_get_float(
+ chset, "autosmooth_projection", NULL);
+
+ float autosmooth_spacing;
+
+ if (BKE_brush_channelset_get_int(chset, "autosmooth_use_spacing", mapdata)) {
+ autosmooth_spacing = BKE_brush_channelset_get_float(chset, "autosmooth_spacing", mapdata);
+ }
+ else {
+ autosmooth_spacing = BKE_brush_channelset_get_float(chset, "spacing", mapdata);
+ }
+
+ float autosmooth = BKE_brush_channelset_get_float(chset, "autosmooth", mapdata);
+ if (autosmooth > 0.0f) {
+ cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, chset, true), SCULPT_TOOL_SMOOTH);
+ float_set_uninherit(cmd->params, "strength", autosmooth);
+ float_set_uninherit(cmd->params, "radius", radius * autosmooth_scale);
+ float_set_uninherit(cmd->params, "projection", autosmooth_projection);
+ float_set_uninherit(cmd->params, "spacing", autosmooth_spacing);
+ }
+
+ float vcol_boundary = BKE_brush_channelset_get_float(chset, "vcol_boundary_factor", mapdata);
+#define GETF(key) BKE_brush_channelset_get_float(chset, key, mapdata)
+
+ if (vcol_boundary > 0.0f) {
+ cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, chset, true),
+ SCULPT_TOOL_VCOL_BOUNDARY);
+ float_set_uninherit(cmd->params, "radius", radius * GETF("vcol_boundary_radius_scale"));
+ float_set_uninherit(cmd->params, "spacing", GETF("vcol_boundary_spacing"));
+ float_set_uninherit(cmd->params, "strength", vcol_boundary);
+ }
+
+#undef GETF
+ // float
+}
+
ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
BrushChannelSet *chset,
BrushCommandList *cl,
@@ -1227,6 +1279,10 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
BrushCommand *cmd;
/* add main tool */
+ if (ELEM(tool, SCULPT_TOOL_PAINT, SCULPT_TOOL_SMEAR)) {
+ bke_builtin_commandlist_create_paint(brush, chset, cl, tool, mapdata);
+ return;
+ }
cmd = BKE_brush_commandlist_add(cl, chset, true);
BKE_brush_command_init(cmd, tool);
@@ -1253,8 +1309,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
float autosmooth = BKE_brush_channelset_get_float(chset, "autosmooth", mapdata);
if (!no_autosmooth && autosmooth > 0.0f) {
- cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
- SCULPT_TOOL_SMOOTH);
+ cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, chset, true), SCULPT_TOOL_SMOOTH);
float_set_uninherit(cmd->params, "strength", autosmooth);
float_set_uninherit(cmd->params, "radius", radius * autosmooth_scale);
float_set_uninherit(cmd->params, "projection", autosmooth_projection);
@@ -1279,7 +1334,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
}
if (topology_rake > 0.0f) {
- cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
+ cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, chset, true),
SCULPT_TOOL_TOPOLOGY_RAKE);
float_set_uninherit(cmd->params, "strength", topology_rake);
@@ -1291,8 +1346,7 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
/* build dyntopo command */
if (!BKE_brush_channelset_get_int(chset, "dyntopo_disabled", NULL)) {
- cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
- SCULPT_TOOL_DYNTOPO);
+ cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, chset, true), SCULPT_TOOL_DYNTOPO);
float spacing = BKE_brush_channelset_get_float(chset, "dyntopo_spacing", mapdata);
float radius2 = BKE_brush_channelset_get_float(chset, "dyntopo_radius_scale", mapdata);
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index 9b2e6f44b78..cd8baad04eb 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -76,7 +76,7 @@ To enable converting to/from old data:
.type = BRUSH_CHANNEL_VEC3,\
.vector = {r, g, b, 1.0f},\
.min = 0.0f, .max = 5.0f,\
- .min = 0.0f, .max = 1.0f,\
+ .soft_min = 0.0f, .soft_max = 1.0f,\
.flag = BRUSH_CHANNEL_COLOR,\
}
@@ -87,7 +87,7 @@ To enable converting to/from old data:
.type = BRUSH_CHANNEL_VEC4,\
.vector = {r, g, b, a},\
.min = 0.0f, .max = 5.0f,\
- .min = 0.0f, .max = 1.0f,\
+ .soft_min = 0.0f, .soft_max = 1.0f,\
.flag = BRUSH_CHANNEL_COLOR,\
}
@@ -475,7 +475,15 @@ BrushChannelType brush_builtin_channels[] = {
MAKE_COLOR4("cursor_color_add", "Add Color", "Color of cursor when adding", 1.0f, 0.39f, 0.39f, 1.0f),
MAKE_COLOR4("cursor_color_sub", "Subtract Color", "Color of cursor when subtracting", 0.39f, 0.39f, 1.0f, 1.0f),
MAKE_COLOR3("color", "Color", "", 1.0f, 1.0f, 1.0f),
- MAKE_COLOR3("secondary_color", "Secondary Color", "", 0.0f, 0.0f, 0.0f)
+ MAKE_COLOR3("secondary_color", "Secondary Color", "", 0.0f, 0.0f, 0.0f),
+ MAKE_FLOAT("vcol_boundary_factor", "Boundary Hardening", "Automatically align edges on color boundaries"
+ "to generate sharper features. ", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT_EX("vcol_boundary_exponent", "Exponent", "Hardening exponent (smaller values make smoother edges)",
+ 1.0, 0.001f, 6.0f, 0.001, 3.0f),
+ MAKE_FLOAT_EX("vcol_boundary_radius_scale", "Radius Scale",
+ "Scale brush radius for vcol boundary hardening",
+ 1.0f, 0.0001f, 100.0f, 0.001f, 3.0f),
+ MAKE_FLOAT_EX("vcol_boundary_spacing", "Spacing", "Spacing for vcol boundary hardening", 15, 0.25, 5000, 0.5, 300),
};
/* clang-format on */
@@ -573,6 +581,8 @@ static BrushSettingsMap brush_settings_map[] = {
DEF(sub_col, cursor_color_sub, FLOAT4, FLOAT4)
DEF(rgb, color, FLOAT3, FLOAT3)
DEF(secondary_rgb, secondary_color, FLOAT3, FLOAT3)
+ DEF(vcol_boundary_factor, vcol_boundary_factor, FLOAT, FLOAT)
+ DEF(vcol_boundary_exponent, vcol_boundary_exponent, FLOAT, FLOAT)
};
static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -921,6 +931,11 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
ADDCH("autosmooth_use_spacing");
ADDCH("autosmooth_projection");
+ ADDCH("vcol_boundary_exponent");
+ ADDCH("vcol_boundary_factor");
+ ADDCH("vcol_boundary_radius_scale");
+ ADDCH("vcol_boundary_spacing");
+
ADDCH("topology_rake");
ADDCH("topology_rake_mode");
ADDCH("topology_rake_radius_scale");
@@ -1090,6 +1105,11 @@ void BKE_brush_check_toolsettings(Sculpt *sd)
ADDCH("automasking");
ADDCH("topology_rake_mode");
+ ADDCH("vcol_boundary_exponent");
+ ADDCH("vcol_boundary_factor");
+ ADDCH("vcol_boundary_radius_scale");
+ ADDCH("vcol_boundary_spacing");
+
ADDCH("color");
ADDCH("secondary_color");
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index bc0b5a879ee..5770185b6be 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8428,7 +8428,9 @@ void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings
SCULPT_TOOL_CLAY,
SCULPT_TOOL_CREASE,
SCULPT_TOOL_CLOTH,
- SCULPT_TOOL_SIMPLIFY)) {
+ SCULPT_TOOL_SIMPLIFY,
+ SCULPT_TOOL_PAINT,
+ SCULPT_TOOL_SMEAR)) {
if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
if (ss->cache->commandlist) {
diff --git
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list