Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2021-09-20 02:17:01 +0300
committerJoseph Eagar <joeedh@gmail.com>2021-09-20 02:17:01 +0300
commitc9f1e104daabc50dbed829dcca5b43cd584cc2c8 (patch)
tree76e41e0e33c9f286ae0df9d72b681a5a61ef4cee
parent336b263b568fad2547014fe50d5810f03daa1677 (diff)
Sculpt: Brush channels names are now lower-case instead
of upper case.
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py18
-rw-r--r--source/blender/blenkernel/BKE_brush_engine.h5
-rw-r--r--source/blender/blenkernel/intern/brush.c8
-rw-r--r--source/blender/blenkernel/intern/brush_engine.c83
-rw-r--r--source/blender/blenkernel/intern/brush_engine_presets.c322
-rw-r--r--source/blender/blenkernel/intern/scene.c3
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c18
-rw-r--r--source/blender/makesrna/intern/rna_brush_engine.c27
8 files changed, 264 insertions, 220 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index ee748af74b3..b147ff90e2c 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -20,14 +20,14 @@
from bpy.types import Menu
channel_name_map = {
- "size" : "RADIUS",
- "autosmooth_fset_slide":"FSET_SLIDE",
- "auto_smooth_factor": "AUTOSMOOTH",
- "auto_smooth_projection": "SMOOTH_PROJECTION",
- "auto_smooth_radius_factor": "AUTOSMOOTH_RADIUS_SCALE",
- "boundary_smooth_factor": "BOUNDARY_SMOOTH",
- "autosmooth_fset_slide": "FSET_SLIDE",
- "topology_rake_factor": "TOPOLOGY_RAKE"
+ "size" : "radius",
+ "autosmooth_fset_slide":"fset_slide",
+ "auto_smooth_factor": "autosmooth",
+ "auto_smooth_projection": "smooth_projection",
+ "auto_smooth_radius_factor": "autosmooth_radius_scale",
+ "boundary_smooth_factor": "boundary_smooth",
+ "autosmooth_fset_slide": "fset_slide",
+ "topology_rake_factor": "topology_rake"
};
class UnifiedPaintPanel:
@@ -204,8 +204,6 @@ class UnifiedPaintPanel:
if prop_name in channel_name_map:
prop_name = channel_name_map[prop_name]
- else:
- prop_name = prop_name.upper()
if prop_name in brush.channels.channels:
# def channel_unified(layout, context, brush, prop_name, icon='NONE', pressure=True, text=None, slider=False, header=False):
diff --git a/source/blender/blenkernel/BKE_brush_engine.h b/source/blender/blenkernel/BKE_brush_engine.h
index 8fd2ded7075..03f9fb55cc4 100644
--- a/source/blender/blenkernel/BKE_brush_engine.h
+++ b/source/blender/blenkernel/BKE_brush_engine.h
@@ -75,7 +75,7 @@ typedef struct BrushMappingData {
typedef struct BrushEnumDef {
int value;
const char identifier[64];
- int icon;
+ char icon[32];
const char name[64];
const char description[512];
} BrushEnumDef;
@@ -210,7 +210,8 @@ void BKE_brush_channelset_compat_load(BrushChannelSet *chset,
// merge in channels the ui requested
void BKE_brush_apply_queued_channels(BrushChannelSet *chset, bool do_override);
-void BKE_brush_channeltype_rna_check(BrushChannelType *def);
+void BKE_brush_channeltype_rna_check(BrushChannelType *def,
+ int (*getIconFromName)(const char *name));
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 0151cc4e16d..ebfef911281 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -2469,11 +2469,11 @@ void BKE_brush_size_set(Scene *scene, Brush *brush, int size, bool use_brush_cha
if (use_brush_channels) {
if (scene->toolsettings->sculpt && scene->toolsettings->sculpt->channels) {
BKE_brush_channelset_set_final_float(
- brush->channels, scene->toolsettings->sculpt->channels, "RADIUS", (float)size);
+ brush->channels, scene->toolsettings->sculpt->channels, "radius", (float)size);
return;
}
else {
- BKE_brush_channelset_set_float(brush->channels, "RADIUS", (float)size);
+ BKE_brush_channelset_set_float(brush->channels, "radius", (float)size);
}
}
@@ -2495,10 +2495,10 @@ int BKE_brush_size_get(const Scene *scene, const Brush *brush, bool use_brush_ch
if (use_brush_channel) {
if (scene->toolsettings->sculpt) {
return (int)BKE_brush_channelset_get_final_float(
- brush->channels, scene->toolsettings->sculpt->channels, "RADIUS", NULL);
+ brush->channels, scene->toolsettings->sculpt->channels, "radius", NULL);
}
else {
- return (int)BKE_brush_channelset_get_float(brush->channels, "RADIUS", NULL);
+ return (int)BKE_brush_channelset_get_float(brush->channels, "radius", NULL);
}
}
diff --git a/source/blender/blenkernel/intern/brush_engine.c b/source/blender/blenkernel/intern/brush_engine.c
index 4a67ffd2e37..b038334fcbf 100644
--- a/source/blender/blenkernel/intern/brush_engine.c
+++ b/source/blender/blenkernel/intern/brush_engine.c
@@ -105,7 +105,8 @@ generated from the node group inputs.
extern BrushChannelType brush_builtin_channels[];
extern const int brush_builtin_channel_len;
-ATTR_NO_OPT void BKE_brush_channeltype_rna_check(BrushChannelType *def)
+ATTR_NO_OPT void BKE_brush_channeltype_rna_check(BrushChannelType *def,
+ int (*getIconFromName)(const char *name))
{
if (def->rna_enumdef) {
return;
@@ -124,7 +125,7 @@ ATTR_NO_OPT void BKE_brush_channeltype_rna_check(BrushChannelType *def)
for (int i = 0; i < ARRAY_SIZE(def->enumdef); i++) {
def->rna_enumdef[i].value = def->enumdef[i].value;
def->rna_enumdef[i].identifier = def->enumdef[i].identifier;
- def->rna_enumdef[i].icon = def->enumdef[i].icon;
+ def->rna_enumdef[i].icon = getIconFromName ? getIconFromName(def->enumdef[i].icon) : -1;
def->rna_enumdef[i].name = def->enumdef[i].name;
def->rna_enumdef[i].description = def->enumdef[i].description;
}
@@ -798,27 +799,27 @@ BrushCommand *BKE_brush_command_init(BrushCommand *command, int tool)
command->tool = tool;
- ADDCH("SPACING");
+ ADDCH("spacing");
switch (tool) {
case SCULPT_TOOL_DRAW:
- ADDCH("RADIUS");
- ADDCH("STRENGTH");
+ ADDCH("radius");
+ ADDCH("strength");
break;
case SCULPT_TOOL_SMOOTH:
- ADDCH("RADIUS");
- ADDCH("STRENGTH");
- ADDCH("FSET_SLIDE");
- ADDCH("BOUNDARY_SMOOTH");
- ADDCH("AUTOSMOOTH_PROJECTION");
+ ADDCH("radius");
+ ADDCH("strength");
+ ADDCH("fset_slide");
+ ADDCH("boundary_smooth");
+ ADDCH("autosmooth_projection");
break;
case SCULPT_TOOL_TOPOLOGY_RAKE:
- ADDCH("RADIUS");
- ADDCH("STRENGTH");
- // ADDCH("FSET_SLIDE");
- // ADDCH("BOUNDARY_SMOOTH");
- ADDCH("AUTOSMOOTH_PROJECTION");
- ADDCH("TOPOLOGY_RAKE_MODE");
+ ADDCH("radius");
+ ADDCH("strength");
+ // ADDCH("fset_slide");
+ // ADDCH("boundary_smooth");
+ ADDCH("autosmooth_projection");
+ ADDCH("topology_rake_mode");
break;
case SCULPT_TOOL_DYNTOPO:
break;
@@ -855,64 +856,64 @@ ATTR_NO_OPT void BKE_builtin_commandlist_create(Brush *brush,
cmd = BKE_brush_commandlist_add(cl, chset, true);
BKE_brush_command_init(cmd, tool);
- float radius = BKE_brush_channelset_get_float(chset, "RADIUS", NULL);
+ float radius = BKE_brush_channelset_get_float(chset, "radius", NULL);
bool no_autosmooth = ELEM(
brush->sculpt_tool, SCULPT_TOOL_BOUNDARY, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_MASK);
/* build autosmooth command */
- float autosmooth_scale = BKE_brush_channelset_get_float(chset, "AUTOSMOOTH_RADIUS_SCALE", NULL);
+ float autosmooth_scale = BKE_brush_channelset_get_float(chset, "autosmooth_radius_scale", NULL);
float autosmooth_projection = BKE_brush_channelset_get_float(
- chset, "TOPOLOGY_RAKE_PROJECTION", NULL);
+ chset, "topology_rake_projection", NULL);
float autosmooth_spacing;
- if (BKE_brush_channelset_get_int(chset, "AUTOSMOOTH_USE_SPACING")) {
- autosmooth_spacing = BKE_brush_channelset_get_float(chset, "AUTOSMOOTH_SPACING", NULL);
+ if (BKE_brush_channelset_get_int(chset, "autosmooth_use_spacing")) {
+ autosmooth_spacing = BKE_brush_channelset_get_float(chset, "autosmooth_spacing", NULL);
}
else {
- autosmooth_spacing = BKE_brush_channelset_get_float(chset, "SPACING", NULL);
+ autosmooth_spacing = BKE_brush_channelset_get_float(chset, "spacing", NULL);
}
- float autosmooth = BKE_brush_channelset_get_float(chset, "AUTOSMOOTH", NULL);
+ float autosmooth = BKE_brush_channelset_get_float(chset, "autosmooth", NULL);
if (!no_autosmooth && autosmooth > 0.0f) {
cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, 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_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 topology_rake_scale = BKE_brush_channelset_get_float(
- chset, "TOPOLOGY_RAKE_RADIUS_SCALE", NULL);
+ chset, "topology_rake_radius_scale", NULL);
float topology_rake_projection = BKE_brush_channelset_get_float(
- chset, "TOPOLOGY_RAKE_PROJECTION", NULL);
+ chset, "topology_rake_projection", NULL);
/* build topology rake command*/
- float topology_rake = BKE_brush_channelset_get_float(chset, "TOPOLOGY_RAKE", NULL);
+ float topology_rake = BKE_brush_channelset_get_float(chset, "topology_rake", NULL);
float topology_rake_spacing;
- if (BKE_brush_channelset_get_int(chset, "TOPOLOGY_RAKE_USE_SPACING")) {
- topology_rake_spacing = BKE_brush_channelset_get_float(chset, "TOPOLOGY_RAKE_SPACING", NULL);
+ if (BKE_brush_channelset_get_int(chset, "topology_rake_use_spacing")) {
+ topology_rake_spacing = BKE_brush_channelset_get_float(chset, "topology_rake_spacing", NULL);
}
else {
- topology_rake_spacing = BKE_brush_channelset_get_float(chset, "SPACING", NULL);
+ topology_rake_spacing = BKE_brush_channelset_get_float(chset, "spacing", NULL);
}
if (topology_rake > 0.0f) {
cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
SCULPT_TOOL_SMOOTH);
- float_set_uninherit(cmd->params, "STRENGTH", topology_rake);
- float_set_uninherit(cmd->params, "RADIUS", radius * topology_rake_scale);
- float_set_uninherit(cmd->params, "PROJECTION", topology_rake_projection);
- float_set_uninherit(cmd->params, "SPACING", topology_rake_spacing);
+ float_set_uninherit(cmd->params, "strength", topology_rake);
+ float_set_uninherit(cmd->params, "radius", radius * topology_rake_scale);
+ float_set_uninherit(cmd->params, "projection", topology_rake_projection);
+ float_set_uninherit(cmd->params, "spacing", topology_rake_spacing);
}
/* build dyntopo command */
- if (!BKE_brush_channelset_get_int(chset, "DYNTOPO_DISABLED")) {
+ if (!BKE_brush_channelset_get_int(chset, "dyntopo_disabled")) {
cmd = BKE_brush_command_init(BKE_brush_commandlist_add(cl, brush->channels, true),
SCULPT_TOOL_DYNTOPO);
}
@@ -1033,15 +1034,15 @@ void BKE_brush_channelset_to_unified_settings(BrushChannelSet *chset, UnifiedPai
{
BrushChannel *ch;
- if (ch = BKE_brush_channelset_lookup(chset, "RADIUS")) {
+ if (ch = BKE_brush_channelset_lookup(chset, "radius")) {
ups->size = ch->fvalue;
}
- if (ch = BKE_brush_channelset_lookup(chset, "STRENGTH")) {
+ if (ch = BKE_brush_channelset_lookup(chset, "strength")) {
ups->alpha = ch->fvalue;
}
- if (ch = BKE_brush_channelset_lookup(chset, "WEIGHT")) {
+ if (ch = BKE_brush_channelset_lookup(chset, "weight")) {
ups->weight = ch->fvalue;
}
}
diff --git a/source/blender/blenkernel/intern/brush_engine_presets.c b/source/blender/blenkernel/intern/brush_engine_presets.c
index 098b38b84f4..7dd23e20e1c 100644
--- a/source/blender/blenkernel/intern/brush_engine_presets.c
+++ b/source/blender/blenkernel/intern/brush_engine_presets.c
@@ -41,7 +41,7 @@ To enable converting to/from old data:
3. If not a boolean mapping to a bitflag: Add to brush_settings_map
4. If a boolean mapping to a bitflag: Add to brush_flags_map_len.
*/
-#define ICON_NONE -1
+#define ICON_NONE "NONE"
/* clang-format off */
#define MAKE_FLOAT_EX_OPEN(idname1, name1, tooltip1, value1, min1, max1, smin1, smax1) \
@@ -96,7 +96,7 @@ That includes per-brush enums and bitflags!
BrushChannelType brush_builtin_channels[] = {
{
.name = "Radius",
- .idname = "RADIUS",
+ .idname = "radius",
.min = 0.001f,
.type = BRUSH_CHANNEL_FLOAT,
.max = 2048.0f,
@@ -110,7 +110,7 @@ BrushChannelType brush_builtin_channels[] = {
{
.name = "Strength",
- .idname = "STRENGTH",
+ .idname = "strength",
.min = -1.0f,
.type = BRUSH_CHANNEL_FLOAT,
.max = 4.0f,
@@ -123,7 +123,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Alpha",
- .idname = "ALPHA",
+ .idname = "alpha",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0f,
.max = 1.0f,
@@ -136,7 +136,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Spacing",
- .idname = "SPACING",
+ .idname = "spacing",
.min = 1.0f,
.type = BRUSH_CHANNEL_INT,
.max = 500.0f,
@@ -149,7 +149,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Autosmooth",
- .idname = "AUTOSMOOTH",
+ .idname = "autosmooth",
.type = BRUSH_CHANNEL_FLOAT,
.min = -1.0f,
.max = 4.0f,
@@ -161,7 +161,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Topology Rake",
- .idname = "TOPOLOGY_RAKE",
+ .idname = "topology_rake",
.type = BRUSH_CHANNEL_FLOAT,
.min = -1.0f,
.max = 4.0f,
@@ -173,7 +173,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Autosmooth Radius Scale",
- .idname = "AUTOSMOOTH_RADIUS_SCALE",
+ .idname = "autosmooth_radius_scale",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 25.0f,
@@ -186,7 +186,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Rake Radius Scale",
- .idname = "TOPOLOGY_RAKE_RADIUS_SCALE",
+ .idname = "topology_rake_radius_scale",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 25.0f,
@@ -199,7 +199,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Face Set Slide",
- .idname = "FSET_SLIDE",
+ .idname = "fset_slide",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -212,7 +212,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Boundary Smooth",
- .idname = "BOUNDARY_SMOOTH",
+ .idname = "boundary_smooth",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -224,7 +224,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Projection",
- .idname = "PROJECTION",
+ .idname = "projection",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -236,19 +236,19 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Use Spacing",
- .idname = "TOPOLOGY_RAKE_USE_SPACING",
+ .idname = "topology_rake_use_spacing",
.type = BRUSH_CHANNEL_BOOL,
.ivalue = 0
},
{
.name = "Use Spacing",
- .idname = "AUTOSMOOTH_USE_SPACING",
+ .idname = "autosmooth_use_spacing",
.type = BRUSH_CHANNEL_BOOL,
.ivalue = 0
},
{
.name = "Projection",
- .idname = "AUTOSMOOTH_PROJECTION",
+ .idname = "autosmooth_projection",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -260,7 +260,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Projection",
- .idname = "TOPOLOGY_RAKE_PROJECTION",
+ .idname = "topology_rake_projection",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -273,7 +273,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Spacing",
- .idname = "TOPOLOGY_RAKE_SPACING",
+ .idname = "topology_rake_spacing",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -286,7 +286,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Spacing",
- .idname = "AUTOSMOOTH_SPACING",
+ .idname = "autosmooth_spacing",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.0001f,
.max = 1.0f,
@@ -300,7 +300,7 @@ BrushChannelType brush_builtin_channels[] = {
{
.name = "Topology Rake Mode",
- .idname = "TOPOLOGY_RAKE_MODE",
+ .idname = "topology_rake_mode",
.type = BRUSH_CHANNEL_ENUM,
.enumdef = {
{0, "BRUSH_DIRECTION", ICON_NONE, "Stroke", "Stroke Direction"},
@@ -310,7 +310,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Automasking",
- .idname = "AUTOMASKING",
+ .idname = "automasking",
.flag = BRUSH_CHANNEL_INHERIT_IF_UNSET | BRUSH_CHANNEL_INHERIT,
.type = BRUSH_CHANNEL_BITMASK,
.enumdef = {
@@ -324,14 +324,14 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Disable Dyntopo",
- .idname = "DYNTOPO_DISABLED",
+ .idname = "dyntopo_disabled",
.type = BRUSH_CHANNEL_BOOL,
.flag = BRUSH_CHANNEL_NO_MAPPINGS,
.ivalue = 0
},
{
.name = "Detail Range",
- .idname = "DYNTOPO_DETAIL_RANGE",
+ .idname = "dyntopo_detail_range",
.type = BRUSH_CHANNEL_FLOAT,
.min = 0.001,
.max = 0.99,
@@ -340,7 +340,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Operations",
- .idname = "DYNTOPO_OPS",
+ .idname = "dyntopo_ops",
.type = BRUSH_CHANNEL_BITMASK,
.flag = BRUSH_CHANNEL_INHERIT,
.ivalue = DYNTOPO_COLLAPSE | DYNTOPO_CLEANUP | DYNTOPO_SUBDIVIDE,
@@ -355,7 +355,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Slide Deform Type",
- .idname = "SLIDE_DEFORM_TYPE",
+ .idname = "slide_deform_type",
.ivalue = BRUSH_SLIDE_DEFORM_DRAG,
.type = BRUSH_CHANNEL_ENUM,
.enumdef = {
@@ -367,7 +367,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Normal Radius",
- .idname = "NORMAL_RADIUS_FACTOR",
+ .idname = "normal_radius_factor",
.tooltip = "Ratio between the brush radius and the radius that is going to be "
"used to sample the normal",
.type = BRUSH_CHANNEL_FLOAT,
@@ -378,7 +378,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Hardness",
- .idname = "HARDNESS",
+ .idname = "hardness",
.tooltip = "Brush hardness",
.type = BRUSH_CHANNEL_FLOAT,
.fvalue = 0.0f,
@@ -389,7 +389,7 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Tip Roundness",
- .idname = "TIP_ROUNDNESS",
+ .idname = "tip_roundness",
.tooltip = "",
.type = BRUSH_CHANNEL_FLOAT,
.fvalue = 0.0f,
@@ -400,31 +400,41 @@ BrushChannelType brush_builtin_channels[] = {
},
{
.name = "Accumulate",
- .idname = "ACCUMULATE",
+ .idname = "accumulate",
.type = BRUSH_CHANNEL_BOOL,
.ivalue = 0
},
- MAKE_FLOAT("NORMAL_WEIGHT", "Normal Weight", "", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT("RAKE_FACTOR", "Rake Factor", "How much grab will follow cursor rotation", 0.0f, 0.0f, 10.0f),
- MAKE_FLOAT("WEIGHT", "Weight", "", 0.5f, 0.0f, 1.0f),
- MAKE_FLOAT("JITTER", "Jitter", "Jitter the position of the brush while painting", 0.0f, 0.0f, 1.0f),
- MAKE_INT("JITTER_ABSOLUTE", "Absolute Jitter", "", 0, 0.0f, 1000.0f),
- MAKE_FLOAT("SMOOTH_STROKE_RADIUS", "Smooth Stroke Radius", "Minimum distance from last point before stroke continues", 10.0f, 10.0f, 200.0f),
- MAKE_FLOAT("SMOOTH_STROKE_FACTOR", "Smooth Stroke Factor", "", 0.5f, 0.5f, 0.99f),
- MAKE_FLOAT_EX("RATE", "Rate", "", 0.5, 0.0001f, 10000.0f, 0.01f, 1.0f),
- MAKE_FLOAT("FLOW", "Flow", "Amount of paint that is applied per stroke sample", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT("WET_MIX", "Wet Mix", "Amount of paint that is picked from the surface into the brush color", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT("WET_PERSISTENCE", "Wet Persistence", "Amount of wet paint that stays in the brush after applying paint to the surface", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT("DENSITY", "Density", "Amount of random elements that are going to be affected by the brush", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT("TIP_SCALE_X", "Tip Scale X", "Scale of the brush tip in the X axis", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT("DASH_RATIO", "Dash Ratio", "Ratio of samples in a cycle that the brush is enabled", 0.0f, 0.0f, 1.0f),
- MAKE_FLOAT_EX("PLANE_OFFSET", "Plane Offset", "Adjust plane on which the brush acts towards or away from the object surface", 0.0f, -2.0f, 2.0f, -0.5f, 0.5f),
- MAKE_BOOL("ORIGINAL_NORMAL", "Original Normal", "When locked keep using normal of surface where stroke was initiated", false),
- MAKE_BOOL("ORIGINAL_PLANE", "Original Plane", "When locked keep using the plane origin of surface where stroke was initiated", false),
- MAKE_BOOL("USE_WEIGHTED_SMOOTH", "Weight By Area", "Weight by face area to get a smoother result", true),
- MAKE_BOOL("PRESERVE_FACESET_BOUNDARY", "Keep FSet 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),
+ {
+ .name = "Direction",
+ .idname = "direction",
+ .ivalue = 0,
+ .enumdef = {
+ {0, "ADD", "ADD", "Add", "Add effect of brush"},
+ {BRUSH_DIR_IN, "SUBTRACT", "REMOVE", "Subtract", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ }
+ },
+ MAKE_FLOAT("normal_weight", "Normal Weight", "", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT("rake_factor", "Rake Factor", "How much grab will follow cursor rotation", 0.0f, 0.0f, 10.0f),
+ MAKE_FLOAT("weight", "Weight", "", 0.5f, 0.0f, 1.0f),
+ MAKE_FLOAT("jitter", "Jitter", "Jitter the position of the brush while painting", 0.0f, 0.0f, 1.0f),
+ MAKE_INT("jitter_absolute", "Absolute Jitter", "", 0, 0.0f, 1000.0f),
+ MAKE_FLOAT("smooth_stroke_radius", "Smooth Stroke Radius", "Minimum distance from last point before stroke continues", 10.0f, 10.0f, 200.0f),
+ MAKE_FLOAT("smooth_stroke_factor", "Smooth Stroke Factor", "", 0.5f, 0.5f, 0.99f),
+ MAKE_FLOAT_EX("rate", "Rate", "", 0.5, 0.0001f, 10000.0f, 0.01f, 1.0f),
+ MAKE_FLOAT("flow", "Flow", "Amount of paint that is applied per stroke sample", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT("wet_mix", "Wet Mix", "Amount of paint that is picked from the surface into the brush color", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT("wet_persistence", "Wet Persistence", "Amount of wet paint that stays in the brush after applying paint to the surface", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT("density", "Density", "Amount of random elements that are going to be affected by the brush", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT("tip_scale_x", "Tip Scale X", "Scale of the brush tip in the X axis", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT("dash_ratio", "Dash Ratio", "Ratio of samples in a cycle that the brush is enabled", 0.0f, 0.0f, 1.0f),
+ MAKE_FLOAT_EX("plane_offset", "Plane Offset", "Adjust plane on which the brush acts towards or away from the object surface", 0.0f, -2.0f, 2.0f, -0.5f, 0.5f),
+ MAKE_BOOL("original_normal", "Original Normal", "When locked keep using normal of surface where stroke was initiated", false),
+ MAKE_BOOL("original_plane", "Original Plane", "When locked keep using the plane origin of surface where stroke was initiated", false),
+ MAKE_BOOL("use_weighted_smooth", "Weight By Area", "Weight by face area to get a smoother result", true),
+ MAKE_BOOL("preserve_faceset_boundary", "Keep FSet 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),
};
/* clang-format on */
@@ -439,9 +449,10 @@ ATTR_NO_OPT static bool check_builtin_init()
do_builtin_init = false;
- for (int i = 0; i < brush_builtin_channel_len; i++) {
- BKE_brush_channeltype_rna_check(brush_builtin_channels + i);
- }
+ // can't do this here, since we can't lookup icon ids in blenkernel
+ // for (int i = 0; i < brush_builtin_channel_len; i++) {
+ // BKE_brush_channeltype_rna_check(brush_builtin_channels + i);
+ //}
return true;
}
@@ -494,30 +505,30 @@ typedef struct BrushSettingsMap {
/* This lookup table is used convert data to/from brush channels
and the old settings fields in Brush*/
static BrushSettingsMap brush_settings_map[] = {
- DEF(size, RADIUS, INT, FLOAT)
- DEF(alpha, STRENGTH, FLOAT, FLOAT)
- DEF(autosmooth_factor, AUTOSMOOTH, FLOAT, FLOAT)
+ DEF(size, radius, INT, FLOAT)
+ DEF(alpha, strength, FLOAT, FLOAT)
+ DEF(autosmooth_factor, autosmooth, FLOAT, FLOAT)
DEF(autosmooth_projection, SMOOTH_PROJECTION, FLOAT, FLOAT)
- DEF(topology_rake_projection, TOPOLOGY_RAKE_PROJECTION, FLOAT, FLOAT)
- DEF(topology_rake_radius_factor, TOPOLOGY_RAKE_RADIUS_SCALE, FLOAT, FLOAT)
- DEF(topology_rake_spacing, TOPOLOGY_RAKE_SPACING, INT, FLOAT)
- DEF(topology_rake_factor, TOPOLOGY_RAKE, FLOAT, FLOAT)
- DEF(autosmooth_fset_slide, FSET_SLIDE, FLOAT, FLOAT)
- DEF(boundary_smooth_factor, BOUNDARY_SMOOTH, FLOAT, FLOAT)
- DEF(autosmooth_radius_factor, AUTOSMOOTH_RADIUS_SCALE, FLOAT, FLOAT)
- DEF(normal_weight, NORMAL_WEIGHT, FLOAT, FLOAT)
- DEF(rake_factor, RAKE_FACTOR, FLOAT, FLOAT)
- DEF(weight, WEIGHT, FLOAT, FLOAT)
- DEF(jitter, JITTER, FLOAT, FLOAT)
+ DEF(topology_rake_projection, topology_rake_projection, FLOAT, FLOAT)
+ DEF(topology_rake_radius_factor, topology_rake_radius_scale, FLOAT, FLOAT)
+ DEF(topology_rake_spacing, topology_rake_spacing, INT, FLOAT)
+ DEF(topology_rake_factor, topology_rake, FLOAT, FLOAT)
+ DEF(autosmooth_fset_slide, fset_slide, FLOAT, FLOAT)
+ DEF(boundary_smooth_factor, boundary_smooth, FLOAT, FLOAT)
+ DEF(autosmooth_radius_factor, autosmooth_radius_scale, FLOAT, FLOAT)
+ DEF(normal_weight, normal_weight, FLOAT, FLOAT)
+ DEF(rake_factor, rake_factor, FLOAT, FLOAT)
+ DEF(weight, weight, FLOAT, FLOAT)
+ DEF(jitter, jitter, FLOAT, FLOAT)
DEF(jitter_absolute, JITTER_ABSOLITE, INT, INT)
- DEF(smooth_stroke_radius, SMOOTH_STROKE_RADIUS, INT, FLOAT)
- DEF(smooth_stroke_factor, SMOOTH_STROKE_FACTOR, FLOAT, FLOAT)
- DEF(rate, RATE, FLOAT, FLOAT)
- DEF(flow, FLOW, FLOAT, FLOAT)
- DEF(wet_mix, WET_MIX, FLOAT, FLOAT)
- DEF(wet_persistence, WET_PERSISTENCE, FLOAT, FLOAT)
- DEF(density, DENSITY, FLOAT, FLOAT)
- DEF(tip_scale_x, TIP_SCALE_X, FLOAT, FLOAT)
+ DEF(smooth_stroke_radius, smooth_stroke_radius, INT, FLOAT)
+ DEF(smooth_stroke_factor, smooth_stroke_factor, FLOAT, FLOAT)
+ DEF(rate, rate, FLOAT, FLOAT)
+ DEF(flow, flow, FLOAT, FLOAT)
+ DEF(wet_mix, wet_mix, FLOAT, FLOAT)
+ DEF(wet_persistence, wet_persistence, FLOAT, FLOAT)
+ DEF(density, density, FLOAT, FLOAT)
+ DEF(tip_scale_x, tip_scale_x, FLOAT, FLOAT)
};
static const int brush_settings_map_len = ARRAY_SIZE(brush_settings_map);
@@ -538,13 +549,14 @@ typedef struct BrushFlagMap {
/* This lookup table is like brush_settings_map except it converts
individual bitflags instead of whole struct members.*/
BrushFlagMap brush_flags_map[] = {
- DEF(flag, ORIGINAL_NORMAL, BRUSH_ORIGINAL_NORMAL)
- DEF(flag, ORIGINAL_PLANE, BRUSH_ORIGINAL_PLANE)
- DEF(flag, ACCUMULATE, BRUSH_ACCUMULATE)
- DEF(flag2, USE_WEIGHTED_SMOOTH, BRUSH_SMOOTH_USE_AREA_WEIGHT)
- DEF(flag2, PRESERVE_FACESET_BOUNDARY, BRUSH_SMOOTH_PRESERVE_FACE_SETS)
- DEF(flag2, HARD_EDGE_MODE, BRUSH_HARD_EDGE_MODE)
- DEF(flag2, GRAB_SILHOUETTE, BRUSH_GRAB_SILHOUETTE)
+ DEF(flag, original_normal, BRUSH_ORIGINAL_NORMAL)
+ DEF(flag, original_plane, BRUSH_ORIGINAL_PLANE)
+ DEF(flag, accumulate, BRUSH_ACCUMULATE)
+ DEF(flag2, use_weighted_smooth, BRUSH_SMOOTH_USE_AREA_WEIGHT)
+ DEF(flag2, preserve_faceset_boundary, BRUSH_SMOOTH_PRESERVE_FACE_SETS)
+ DEF(flag2, hard_edge_mode, BRUSH_HARD_EDGE_MODE)
+ DEF(flag2, grab_silhouette, BRUSH_GRAB_SILHOUETTE)
+ DEF(flag, direction, BRUSH_DIR_IN)
};
int brush_flags_map_len = ARRAY_SIZE(brush_flags_map);
@@ -707,53 +719,55 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
BrushChannelSet *chset = brush->channels;
- ADDCH("RADIUS");
- ADDCH("SPACING");
- ADDCH("STRENGTH");
-
- ADDCH("AUTOSMOOTH");
- ADDCH("AUTOSMOOTH_RADIUS_SCALE");
- ADDCH("AUTOSMOOTH_SPACING");
- ADDCH("AUTOSMOOTH_USE_SPACING");
- ADDCH("AUTOSMOOTH_PROJECTION");
-
- ADDCH("TOPOLOGY_RAKE");
- ADDCH("TOPOLOGY_RAKE_MODE");
- ADDCH("TOPOLOGY_RAKE_RADIUS_SCALE");
- ADDCH("TOPOLOGY_RAKE_USE_SPACING");
- ADDCH("TOPOLOGY_RAKE_SPACING");
- ADDCH("TOPOLOGY_RAKE_PROJECTION");
-
- ADDCH("HARDNESS");
- ADDCH("TIP_ROUNDNESS");
- ADDCH("NORMAL_RADIUS_FACTOR");
-
- ADDCH("AUTOMASKING");
-
- ADDCH("DYNTOPO_DISABLED");
- ADDCH("DYNTOPO_DETAIL_RANGE");
- ADDCH("DYNTOPO_OPS");
-
- ADDCH("ACCUMULATE");
- ADDCH("ORIGINAL_NORMAL");
- ADDCH("ORIGINAL_PLANE");
- ADDCH("JITTER");
- ADDCH("JITTER_ABSOLUTE");
- ADDCH("USE_WEIGHTED_SMOOTH");
- ADDCH("PRESERVE_FACESET_BOUNDARY");
- ADDCH("HARD_EDGE_MODE");
- ADDCH("GRAB_SILHOUETTE");
-
- ADDCH("PROJECTION");
- ADDCH("BOUNDARY_SMOOTH");
- ADDCH("FSET_SLIDE");
+ ADDCH("radius");
+ ADDCH("spacing");
+ ADDCH("strength");
+
+ ADDCH("autosmooth");
+ ADDCH("autosmooth_radius_scale");
+ ADDCH("autosmooth_spacing");
+ ADDCH("autosmooth_use_spacing");
+ ADDCH("autosmooth_projection");
+
+ ADDCH("topology_rake");
+ ADDCH("topology_rake_mode");
+ ADDCH("topology_rake_radius_scale");
+ ADDCH("topology_rake_use_spacing");
+ ADDCH("topology_rake_spacing");
+ ADDCH("topology_rake_projection");
+
+ ADDCH("hardness");
+ ADDCH("tip_roundness");
+ ADDCH("normal_radius_factor");
+
+ ADDCH("automasking");
+
+ ADDCH("dyntopo_disabled");
+ ADDCH("dyntopo_detail_range");
+ ADDCH("dyntopo_ops");
+
+ ADDCH("accumulate");
+ ADDCH("original_normal");
+ ADDCH("original_plane");
+ ADDCH("jitter");
+ ADDCH("jitter_absolute");
+ ADDCH("use_weighted_smooth");
+ ADDCH("preserve_faceset_boundary");
+ ADDCH("hard_edge_mode");
+ ADDCH("grab_silhouette");
+
+ ADDCH("projection");
+ ADDCH("boundary_smooth");
+ ADDCH("fset_slide");
+
+ ADDCH("direction");
switch (tool) {
case SCULPT_TOOL_DRAW: {
break;
}
case SCULPT_TOOL_SLIDE_RELAX:
- ADDCH("SLIDE_DEFORM_TYPE");
+ ADDCH("slide_deform_type");
break;
}
@@ -781,51 +795,51 @@ void BKE_brush_builtin_create(Brush *brush, int tool)
BKE_brush_builtin_patch(brush, tool);
- GETCH("STRENGTH")->flag |= BRUSH_CHANNEL_INHERIT;
- GETCH("RADIUS")->flag |= BRUSH_CHANNEL_INHERIT;
+ GETCH("strength")->flag |= BRUSH_CHANNEL_INHERIT;
+ GETCH("radius")->flag |= BRUSH_CHANNEL_INHERIT;
switch (tool) {
case SCULPT_TOOL_DRAW: {
break;
}
case SCULPT_TOOL_DRAW_SHARP:
- GETCH("SPACING")->ivalue = 5;
- GETCH("RADIUS")->mappings[BRUSH_MAPPING_PRESSURE].blendmode = true;
+ GETCH("spacing")->ivalue = 5;
+ GETCH("radius")->mappings[BRUSH_MAPPING_PRESSURE].blendmode = true;
break;
case SCULPT_TOOL_DISPLACEMENT_ERASER:
case SCULPT_TOOL_FAIRING:
case SCULPT_TOOL_SCENE_PROJECT:
- GETCH("SPACING")->ivalue = 10;
- GETCH("STRENGTH")->fvalue = 1.0f;
- GETCH("DYNTOPO_DISABLED")->ivalue = 1;
+ GETCH("spacing")->ivalue = 10;
+ GETCH("strength")->fvalue = 1.0f;
+ GETCH("dyntopo_disabled")->ivalue = 1;
break;
case SCULPT_TOOL_SLIDE_RELAX:
- GETCH("SPACING")->ivalue = 10;
- GETCH("STRENGTH")->fvalue = 1.0f;
- GETCH("DYNTOPO_DISABLED")->ivalue = 1;
- GETCH("SLIDE_DEFORM_TYPE")->ivalue = BRUSH_SLIDE_DEFORM_DRAG;
+ GETCH("spacing")->ivalue = 10;
+ GETCH("strength")->fvalue = 1.0f;
+ GETCH("dyntopo_disabled")->ivalue = 1;
+ GETCH("slide_deform_type")->ivalue = BRUSH_SLIDE_DEFORM_DRAG;
break;
case SCULPT_TOOL_CLAY:
- GETCH("RADIUS")->mappings[BRUSH_MAPPING_PRESSURE].flag |= BRUSH_MAPPING_ENABLED;
- GETCH("SPACING")->ivalue = 3;
- GETCH("AUTOSMOOTH")->fvalue = 0.25f;
- GETCH("NORMAL_RADIUS_FACTOR")->fvalue = 0.75f;
- GETCH("HARDNESS")->fvalue = 0.65;
+ GETCH("radius")->mappings[BRUSH_MAPPING_PRESSURE].flag |= BRUSH_MAPPING_ENABLED;
+ GETCH("spacing")->ivalue = 3;
+ GETCH("autosmooth")->fvalue = 0.25f;
+ GETCH("normal_radius_factor")->fvalue = 0.75f;
+ GETCH("hardness")->fvalue = 0.65;
break;
case SCULPT_TOOL_TWIST:
- GETCH("STRENGTH")->fvalue = 0.5f;
- GETCH("NORMAL_RADIUS_FACTOR")->fvalue = 1.0f;
- GETCH("SPACING")->ivalue = 6;
- GETCH("HARDNESS")->fvalue = 0.5;
+ GETCH("strength")->fvalue = 0.5f;
+ GETCH("normal_radius_factor")->fvalue = 1.0f;
+ GETCH("spacing")->ivalue = 6;
+ GETCH("hardness")->fvalue = 0.5;
break;
case SCULPT_TOOL_CLAY_STRIPS: {
- GETCH("RADIUS")->mappings[BRUSH_MAPPING_PRESSURE].flag |= BRUSH_MAPPING_ENABLED;
- GETCH("TIP_ROUNDNESS")->fvalue = 0.18f;
- GETCH("NORMAL_RADIUS_FACTOR")->fvalue = 1.35f;
- GETCH("STRENGTH")->fvalue = 0.8f;
- GETCH("ACCUMULATE")->ivalue = 1;
+ GETCH("radius")->mappings[BRUSH_MAPPING_PRESSURE].flag |= BRUSH_MAPPING_ENABLED;
+ GETCH("tip_roundness")->fvalue = 0.18f;
+ GETCH("normal_radius_factor")->fvalue = 1.35f;
+ GETCH("strength")->fvalue = 0.8f;
+ GETCH("accumulate")->ivalue = 1;
- CurveMapping *curve = &GETCH("RADIUS")->mappings[BRUSH_MAPPING_PRESSURE].curve;
+ CurveMapping *curve = &GETCH("radius")->mappings[BRUSH_MAPPING_PRESSURE].curve;
CurveMap *cuma = curve->cm;
cuma->curve[0].x = 0.0f;
@@ -862,12 +876,12 @@ void BKE_brush_init_toolsettings(Sculpt *sd)
BrushChannelSet *chset = sd->channels = BKE_brush_channelset_create();
- ADDCH("RADIUS");
- ADDCH("STRENGTH");
- ADDCH("AUTOMASKING");
- ADDCH("TOPOLOGY_RAKE_MODE");
- ADDCH("DYNTOPO_DISABLED");
- ADDCH("DYNTOPO_DETAIL_RANGE");
+ ADDCH("radius");
+ ADDCH("strength");
+ ADDCH("automasking");
+ ADDCH("topology_rake_mode");
+ ADDCH("dyntopo_disabled");
+ ADDCH("dyntopo_detail_range");
namestack_pop();
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 796e7ab2c41..9508f0de043 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1066,7 +1066,8 @@ static void scene_blend_read_data(BlendDataReader *reader, ID *id)
if (sce->toolsettings->sculpt) {
// make sure radius exists in the toolsettings brush channel set
- BKE_brush_channelset_ensure_builtin(sce->toolsettings->sculpt->channels, "RADIUS");
+ BKE_brush_channelset_ensure_builtin(sce->toolsettings->sculpt->channels, "radius");
+ BKE_brush_channelset_ensure_builtin(sce->toolsettings->sculpt->channels, "strength");
}
/* relink grease pencil interpolation curves */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 12e14ce4480..9a2293709d6 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8846,7 +8846,7 @@ ATTR_NO_OPT static void SCULPT_run_command_list(
/* With these options enabled not all required nodes are inside the original brush radius, so
* the brush can produce artifacts in some situations. */
if (cmd->tool == SCULPT_TOOL_DRAW &&
- BKE_brush_channelset_get_int(cmd->params_final, "ORIGINAL_NORMAL")) {
+ BKE_brush_channelset_get_int(cmd->params_final, "original_normal")) {
radius_scale = MAX2(radius_scale, 2.0f);
}
@@ -8862,13 +8862,13 @@ ATTR_NO_OPT static void SCULPT_run_command_list(
}
float radius = BKE_brush_channelset_get_float(
- ss->cache->channels_final, "RADIUS", &ss->cache->input_mapping);
+ ss->cache->channels_final, "radius", &ss->cache->input_mapping);
radius_max = max_ff(radius_max, radius);
}
float ratio = radius_max / BKE_brush_channelset_get_float(
- ss->cache->channels_final, "RADIUS", &ss->cache->input_mapping);
+ ss->cache->channels_final, "radius", &ss->cache->input_mapping);
ss->cache->radius = start_radius * ratio;
ss->cache->radius_squared = start_radius * start_radius * ratio * ratio;
@@ -9011,7 +9011,7 @@ ATTR_NO_OPT static void SCULPT_run_command_list(
ss->cache->brush = brush2;
ss->cache->bstrength = BKE_brush_channelset_get_float(
- cmd->params_final, "STRENGTH", &ss->cache->input_mapping);
+ cmd->params_final, "strength", &ss->cache->input_mapping);
// Load parameters into brush2 for compatibility with old code
BKE_brush_channelset_compat_load(cmd->params_final, brush2, false);
@@ -11239,6 +11239,16 @@ void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerR
BKE_brush_channelset_compat_load(ss->cache->channels_final, brush, false);
BKE_brush_channelset_to_unified_settings(ss->cache->channels_final, ups);
+ ss->cache->bstrength = BKE_brush_channelset_get_float(
+ ss->cache->channels_final, "strength", &ss->cache->input_mapping);
+
+ if (ss->cache->invert) {
+ brush->alpha = -brush->alpha;
+ ss->cache->bstrength = -ss->cache->bstrength;
+
+ BKE_brush_channelset_set_float(ss->cache->channels_final, "strength", ss->cache->bstrength);
+ }
+
ss->cache->stroke_distance = stroke->stroke_distance;
ss->cache->stroke_distance_t = stroke->stroke_distance_t;
ss->cache->stroke = stroke;
diff --git a/source/blender/makesrna/intern/rna_brush_engine.c b/source/blender/makesrna/intern/rna_brush_engine.c
index 935b7493b5a..91e00aedaeb 100644
--- a/source/blender/makesrna/intern/rna_brush_engine.c
+++ b/source/blender/makesrna/intern/rna_brush_engine.c
@@ -45,7 +45,7 @@
#include "DNA_sculpt_brush_types.h"
#include "WM_types.h"
-static EnumPropertyItem null_enum[2] = {{0, "null", 0, 0}, {-1, NULL, -1, NULL, NULL}};
+static EnumPropertyItem null_enum[2] = {{0, "null", 0, 0}, {0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -205,6 +205,25 @@ int rna_BrushChannel_enum_value_set(PointerRNA *ptr, int val)
return 1;
}
+extern EnumPropertyItem *rna_enum_icon_items;
+
+int lookup_icon_id(const char *icon)
+{
+ EnumPropertyItem *item = rna_enum_icon_items;
+ int i = 0;
+
+ while (item->identifier) {
+ if (STREQ(item->identifier, icon)) {
+ return i;
+ }
+
+ item++;
+ i++;
+ }
+
+ return ICON_NONE;
+}
+
ATTR_NO_OPT const EnumPropertyItem *rna_BrushChannel_enum_value_get_items(struct bContext *C,
PointerRNA *ptr,
PropertyRNA *prop,
@@ -216,7 +235,7 @@ ATTR_NO_OPT const EnumPropertyItem *rna_BrushChannel_enum_value_get_items(struct
return null_enum;
}
- BKE_brush_channeltype_rna_check(ch->def);
+ BKE_brush_channeltype_rna_check(ch->def, lookup_icon_id);
return ch->def->rna_enumdef;
}
@@ -229,7 +248,7 @@ static EnumPropertyItem mapping_type_items[] = {
{BRUSH_MAPPING_YTILT, "YTILT", ICON_NONE, "Y Tilt"},
{BRUSH_MAPPING_ANGLE, "ANGLE", ICON_NONE, "Angle"},
{BRUSH_MAPPING_SPEED, "SPEED", ICON_NONE, "Speed"},
- {-1, NULL, -1, -1},
+ {0, NULL, 0, NULL, NULL},
};
void RNA_def_brush_mapping(BlenderRNA *brna)
@@ -274,7 +293,7 @@ EnumPropertyItem channel_types[] = {{BRUSH_CHANNEL_FLOAT, "FLOAT", ICON_NONE, "F
{BRUSH_CHANNEL_BOOL, "BOOL", ICON_NONE, "Boolean"},
{BRUSH_CHANNEL_VEC3, "VEC3", ICON_NONE, "Color3"},
{BRUSH_CHANNEL_VEC4, "VEC4", ICON_NONE, "Color4"},
- {-1, NULL, -1, NULL}};
+ {0, NULL, 0, NULL, NULL}};
void RNA_def_brush_channel(BlenderRNA *brna)
{