[Bf-blender-cvs] [33cd635a82a] sculpt-dev: Sculpt: fix clay brush
Joseph Eagar
noreply at git.blender.org
Fri Sep 24 06:40:24 CEST 2021
Commit: 33cd635a82a79e5a542f097d776b0b5c6de823c6
Author: Joseph Eagar
Date: Thu Sep 23 21:39:20 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB33cd635a82a79e5a542f097d776b0b5c6de823c6
Sculpt: fix clay brush
* BRUSH_MAPPING_INHERIT is now respected
when unset.
* Also added inherit icon to
input mapping curves ui.
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M source/blender/blenkernel/BKE_brush_engine.h
M source/blender/blenkernel/intern/brush_channel_define.h
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/makesrna/intern/rna_brush_engine.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 4168b920055..b9eb6936601 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -171,12 +171,17 @@ class UnifiedPaintPanel:
path = ""
is_toolset = False
+ pressurech = ch
+
if ch.inherit or toolsettings_only:
sd = context.tool_settings.sculpt
#ensure channel exists in tool settings channel set
sd.channels.ensure(ch)
finalch = sd.channels.channels[prop_name]
+ if ch.mappings["PRESSURE"].inherit:
+ pressurech = finalch
+
is_toolset = True
path = "tool_settings.sculpt.channels.channels[\"%s\"]" % ch.idname
else:
@@ -193,7 +198,7 @@ class UnifiedPaintPanel:
props.channel = ch.idname
props.direction = 1
- if ui_editing:
+ if ui_editing and not header:
row.prop(ch, "show_in_workspace", text="", icon="HIDE_OFF")
#row.prop(ch, "ui_order", text="")
@@ -226,7 +231,7 @@ class UnifiedPaintPanel:
pressure = pressure and ch.type not in ["BOOL", "ENUM", "BITMASK", "CURVE"]
if pressure:
- row.prop(finalch.mappings["PRESSURE"], "enabled", text="", icon="STYLUS_PRESSURE")
+ row.prop(pressurech.mappings["PRESSURE"], "enabled", text="", icon="STYLUS_PRESSURE")
#if pressure_name:
@@ -251,7 +256,11 @@ class UnifiedPaintPanel:
row.prop(ch, "ui_expanded", text="", icon="TRIA_DOWN" if ch.ui_expanded else "TRIA_RIGHT")
if ch.ui_expanded:
- for mp in finalch.mappings:
+ for i, mp in enumerate(ch.mappings):
+ mp0 = mp
+ if mp.inherit:
+ mp = finalch.mappings[i]
+
row2 = layout.row()
name = mp.type.lower()
@@ -261,8 +270,9 @@ class UnifiedPaintPanel:
name = "name error"
row2.label(text=name)
+ row2.prop(mp0, "inherit", text="", icon="BRUSHES_ALL")
row2.prop(mp, "enabled", text="", icon="STYLUS_PRESSURE")
- row2.prop(mp, "ui_expanded", text="", icon="TRIA_DOWN" if mp.ui_expanded else "TRIA_RIGHT")
+ row2.prop(mp0, "ui_expanded", text="", icon="TRIA_DOWN" if mp.ui_expanded else "TRIA_RIGHT")
if mp.ui_expanded:
layout.template_curve_mapping(mp, "curve", brush=True)
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index c5048692c01..694b1e6de38 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -55,7 +55,7 @@ struct Sculpt;
#define MAKE_BUILTIN_CH_NAME(idname) BRUSH_BUILTIN_##idname
-/*these macros check channel names at compile time*/
+/* these macros check channel names at compile time */
#define BRUSHSET_LOOKUP(chset, channel) \
BKE_brush_channelset_lookup(chset, MAKE_BUILTIN_CH_NAME(channel))
@@ -67,6 +67,10 @@ struct Sculpt;
BKE_brush_channelset_get_int(chset, MAKE_BUILTIN_CH_NAME(channel), mapdata)
#define BRUSHSET_ENSURE_BUILTIN(chset, channel) \
BKE_brush_channelset_ensure_builtin(chset, MAKE_BUILTIN_CH_NAME(channel))
+#define BRUSHSET_SET_FLOAT(chset, channel, val) \
+ BKE_brush_channelset_set_float(chset, MAKE_BUILTIN_CH_NAME(channel), val)
+#define BRUSHSET_SET_INT(chset, channel, val) \
+ BKE_brush_channelset_set_int(chset, MAKE_BUILTIN_CH_NAME(channel), val)
//#define DEBUG_CURVE_MAPPING_ALLOC
#ifdef DEBUG_CURVE_MAPPING_ALLOC
@@ -134,7 +138,7 @@ typedef struct BrushCommandList {
void BKE_brush_channel_free_data(BrushChannel *ch);
void BKE_brush_channel_free(BrushChannel *ch);
-void BKE_brush_channel_copy_data(BrushChannel *dst, BrushChannel *src);
+void BKE_brush_channel_copy_data(BrushChannel *dst, BrushChannel *src, bool keep_mappings);
void BKE_brush_channel_init(BrushChannel *ch, BrushChannelType *def);
BrushChannelSet *BKE_brush_channelset_create();
diff --git a/source/blender/blenkernel/intern/brush_channel_define.h b/source/blender/blenkernel/intern/brush_channel_define.h
index 4344adf829c..21da18da4f7 100644
--- a/source/blender/blenkernel/intern/brush_channel_define.h
+++ b/source/blender/blenkernel/intern/brush_channel_define.h
@@ -74,10 +74,14 @@ places in rna_engine_codebase are relevent:
# define MAKE_FLOAT_EX(idname, name, tooltip, val, min, max, smin, smax, pressure_enabled) \
MAKE_BUILTIN_CH_DEF(idname)
+# define MAKE_FLOAT_EX_FLAG( \
+ idname, name, tooltip, val, min, max, smin, smax, pressure_enabled, flag) \
+ MAKE_BUILTIN_CH_DEF(idname)
+
# define MAKE_FLOAT_EX_INV(idname, name, tooltip, val, min, max, smin, smax, pressure_enabled) \
MAKE_BUILTIN_CH_DEF(idname)
# define MAKE_FLOAT_EX_EX( \
- idname, name, tooltip, val, min, max, smin, smax, pressure_enabled, inv) \
+ idname, name, tooltip, val, min, max, smin, smax, pressure_enabled, inv, flag) \
MAKE_BUILTIN_CH_DEF(idname)
# define MAKE_FLOAT(idname, name, tooltip, val, min, max) MAKE_BUILTIN_CH_DEF(idname);
# define MAKE_INT_EX(idname, name, tooltip, val, min, max, smin, smax) \
@@ -112,8 +116,8 @@ places in rna_engine_codebase are relevent:
"used for smoothing", 1.0f, 0.001f, 5.0f, 0.01f, 2.0f, false)
MAKE_FLOAT_EX(topology_rake_radius_scale, "Radius Scale", "Ratio between the brush radius and the radius that is going to be "
"used for topology rake", 1.0f, 0.001f, 5.0f, 0.01f, 2.0f, false)
- MAKE_FLOAT_EX(dyntopo_radius_scale, "Radius Scale", "Ratio between the brush radius and the radius that is going to be "
- "used for DynTopo", 1.0f, 0.001f, 5.0f, 0.01f, 2.0f, false)
+ MAKE_FLOAT_EX_FLAG(dyntopo_radius_scale, "Radius Scale", "Ratio between the brush radius and the radius that is going to be "
+ "used for DynTopo", 1.0f, 0.001f, 5.0f, 0.01f, 2.0f, false, BRUSH_CHANNEL_INHERIT)
MAKE_FLOAT_EX(projection, "Projection", "Amount of volume preserving projection", 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, false)
MAKE_FLOAT_EX(autosmooth_projection, "Projection", "Amount of volume preserving projection", 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, false)
MAKE_FLOAT_EX(topology_rake_projection, "Projection", "Amount of volume preserving projection", 0.975f, 0.0f, 1.0f, 0.0f, 1.0f, false)
@@ -140,7 +144,7 @@ places in rna_engine_codebase are relevent:
}), BRUSH_CHANNEL_INHERIT_IF_UNSET)
MAKE_BOOL_EX(dyntopo_disabled, "Disable Dyntopo", "", false, BRUSH_CHANNEL_NO_MAPPINGS)
- MAKE_FLAGS_EX(dyntopo_mode, "Dyntopo Operators", "s", DYNTOPO_COLLAPSE|DYNTOPO_CLEANUP|DYNTOPO_SUBDIVIDE, _({\
+ MAKE_FLAGS_EX(dyntopo_mode, "Dyntopo Operators", "", DYNTOPO_COLLAPSE|DYNTOPO_CLEANUP|DYNTOPO_SUBDIVIDE, _({
{DYNTOPO_COLLAPSE, "COLLAPSE", ICON_NONE, "Collapse", ""},
{DYNTOPO_SUBDIVIDE, "SUBDIVIDE", ICON_NONE, "Subdivide", ""},
{DYNTOPO_CLEANUP, "CLEANUP", ICON_NONE, "Cleanup", ""},
@@ -148,7 +152,7 @@ places in rna_engine_codebase are relevent:
{DYNTOPO_LOCAL_SUBDIVIDE, "LOCAL_SUBDIVIDE", ICON_NONE, "Local Subdivide", ""},
{-1}
}), BRUSH_CHANNEL_INHERIT)
- MAKE_ENUM(slide_deform_type, "Slide Deform Type", "", BRUSH_SLIDE_DEFORM_DRAG, _({\
+ MAKE_ENUM(slide_deform_type, "Slide Deform Type", "", BRUSH_SLIDE_DEFORM_DRAG, _({
{BRUSH_SLIDE_DEFORM_DRAG, "DRAG", ICON_NONE, "Drag", ""},
{BRUSH_SLIDE_DEFORM_PINCH, "PINCH", ICON_NONE, "Pinch", ""},
{BRUSH_SLIDE_DEFORM_EXPAND, "EXPAND", ICON_NONE, "Expand", ""},
@@ -159,7 +163,7 @@ places in rna_engine_codebase are relevent:
MAKE_FLOAT(hardness, "Hardness", "Brush falloff hardness", 0.0f, 0.0f, 1.0f)
MAKE_FLOAT(tip_roundness, "Tip Roundness", "", 0.0f, 0.0f, 1.0f)
MAKE_BOOL(accumulate, "Accumulate", "", false)
- MAKE_ENUM(direction, "Direction", "", 0, _({\
+ MAKE_ENUM(direction, "Direction", "", 0, _({
{0, "ADD", "ADD", "Add", "Add effect of brush"},
{1, "SUBTRACT", "REMOVE", "Subtract", "Subtract effect of brush"},
{-1}
@@ -186,11 +190,11 @@ MAKE_BOOL(use_weighted_smooth, "Weight By Area", "Weight by face area to get a s
MAKE_BOOL(preserve_faceset_boundary, "Preserve Faceset Boundary", "Preserve face set boundaries", true)
MAKE_BOOL(hard_edge_mode, "Hard Edge Mode", "Forces all brushes into hard edge face set mode (sets face set slide to 0)", false)
MAKE_BOOL(grab_silhouette, "Grab Silhouette", "Grabs trying to automask the silhouette of the object", false)
-MAKE_FLOAT(dyntopo_detail_percent, "Detail Percent", "Detail Percent", 25.0f, 0.0f, 1000.0f)
-MAKE_FLOAT(dyntopo_detail_range, "Detail Range", "Detail Range", 0.45f, 0.01f, 0.99f)
-MAKE_FLOAT_EX(dyntopo_detail_size, "Detail Size", "Detail Size", 8.0f, 0.1f, 100.0f, 0.001f, 500.0f, false)
-MAKE_FLOAT_EX(dyntopo_constant_detail, "Constaint Detail", "", 3.0f, 0.001f, 1000.0f, 0.0001, FLT_MAX, false)
-MAKE_FLOAT_EX(dyntopo_spacing, "Spacing", "Dyntopo Spacing", 35.0f, 0.01f, 300.0f, 0.001f, 50000.0f, false)
+MAKE_FLOAT_EX_FLAG(dyntopo_detail_percent, "Detail Percent", "Detail Percent", 25.0f, 0.0f, 1000.0f, 0.0f, 1000.0f, false, BRUSH_CHANNEL_INHERIT)
+MAKE_FLOAT_EX_FLAG(dyntopo_detail_range, "Detail Range", "Detail Range", 0.45f, 0.01f, 0.99f, 0.01f, 0.99f, false, BRUSH_CHANNEL_INHERIT)
+MAKE_FLOAT_EX_FLAG(dyntopo_detail_size, "Detail Size", "Detail Size", 8.0f, 0.1f, 100.0f, 0.001f, 500.0f, false, BRUSH_CHANNEL_INHERIT)
+MAKE_FLOAT_EX_FLAG(dyntopo_constant_detail, "Constaint Detail", "", 3.0f, 0.001f, 1000.0f, 0.0001, FLT_MAX, false, BRUSH_CHANNEL_INHERIT)
+MAKE_FLOAT_EX_FLAG(dyntopo_spacing, "Spacing", "Dyntopo Spacing", 35.0f, 0.01f, 300.0f, 0.001f, 50000.0f, false, BRUSH_CHANNEL_INHERIT)
MAKE_FLOAT(concave_mask_factor, "Cavity Factor", "", 0.35f, 0.0f, 1.0f)
MAKE_INT_EX(automasking_boundary_edges_propagation_steps, "Propagation Steps",
"Distance where boundary edge
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list