[Bf-blender-cvs] [c9f1e104daa] sculpt-dev: Sculpt: Brush channels names are now lower-case instead of upper case.
Joseph Eagar
noreply at git.blender.org
Mon Sep 20 12:14:54 CEST 2021
Commit: c9f1e104daabc50dbed829dcca5b43cd584cc2c8
Author: Joseph Eagar
Date: Sun Sep 19 16:17:01 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBc9f1e104daabc50dbed829dcca5b43cd584cc2c8
Sculpt: Brush channels names are now lower-case instead
of upper case.
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M source/blender/blenkernel/BKE_brush_engine.h
M source/blender/blenkernel/intern/brush.c
M source/blender/blenkernel/intern/brush_engine.c
M source/blender/blenkernel/intern/brush_engine_presets.c
M source/blender/blenkernel/intern/scene.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 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, "strengt
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list