[Bf-blender-cvs] [d823f6e2cf0] temp_bmesh_multires: Added an "Exponent" slider to Color Boundary brush.
Joseph Eagar
noreply at git.blender.org
Tue Nov 10 07:25:30 CET 2020
Commit: d823f6e2cf0efe3a2eaca1d5feb20861866731a7
Author: Joseph Eagar
Date: Mon Nov 9 22:25:03 2020 -0800
Branches: temp_bmesh_multires
https://developer.blender.org/rBd823f6e2cf0efe3a2eaca1d5feb20861866731a7
Added an "Exponent" slider to Color Boundary brush.
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M source/blender/blenloader/intern/versioning_290.c
M source/blender/editors/sculpt_paint/sculpt_smooth.c
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesrna/intern/rna_brush.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index bc412c607ae..adda75b262a 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -571,7 +571,6 @@ def brush_settings(layout, context, brush, popover=False):
if capabilities.has_vcol_boundary_smooth:
layout.prop(brush, "vcol_boundary_factor", slider=True)
- # topology_rake_factor
if (
capabilities.has_topology_rake and
context.sculpt_object.use_dynamic_topology_sculpting
@@ -637,6 +636,10 @@ def brush_settings(layout, context, brush, popover=False):
# Per sculpt tool options.
+ if sculpt_tool == "VCOL_BOUNDARY":
+ row = layout.row()
+ row.prop(brush, "vcol_boundary_exponent")
+
if sculpt_tool == 'CLAY_STRIPS':
row = layout.row()
row.prop(brush, "tip_roundness")
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index fab4ce6727f..f51770e7541 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -1128,6 +1128,16 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 293, 0)) {
+ for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+ if (br->sculpt_tool == SCULPT_TOOL_VCOL_BOUNDARY) {
+ if (br->vcol_boundary_exponent == 0.0f) {
+ br->vcol_boundary_exponent = 1.0f;
+ }
+ }
+ }
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index cce27ec9da6..894efa3c30a 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -729,6 +729,13 @@ static void do_smooth_vcol_boundary_brush_task_cb_ex(void *__restrict userdata,
mul_v3_fl(avg, tot);
+ float exp = brush->vcol_boundary_exponent;
+ //detect bad value
+
+ if (exp == 0.0f) {
+ exp = 1.0f;
+ }
+
//#define SHARPEN_VCOL_BOUNDARY
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
@@ -775,7 +782,9 @@ static void do_smooth_vcol_boundary_brush_task_cb_ex(void *__restrict userdata,
sub_v4_v4v4(dv, col, avg);
float w = (fabs(dv[0]) + fabs(dv[1]) + fabs(dv[2]) + fabs(dv[3])) / 4.0;
- w *= w;
+ w = powf(w, exp);
+
+ //w *= w;
#ifdef SHARPEN_VCOL_BOUNDARY
float w2 = -1.0f;
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 589a5d34a58..10b0f51809b 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -543,7 +543,7 @@ typedef struct Brush {
/** Source for fill tool color gradient application. */
char gradient_fill_mode;
- char _pad0[5];
+ char _pad0[1];
/** Projection shape (sphere, circle). */
char falloff_shape;
@@ -577,6 +577,7 @@ typedef struct Brush {
float topology_rake_factor;
float vcol_boundary_factor;
+ float vcol_boundary_exponent;
float crease_pinch_factor;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index a6498aae40b..cab2be4f52f 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2837,7 +2837,7 @@ static void rna_def_brush(BlenderRNA *brna)
"Best used on low-poly meshes as it has a performance impact");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "vcol_boundary_factor", PROP_FLOAT, PROP_FACTOR);
+ prop = RNA_def_property(srna, "vcol_boundary_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "vcol_boundary_factor");
RNA_def_property_float_default(prop, 0);
RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -2848,6 +2848,16 @@ static void rna_def_brush(BlenderRNA *brna)
"to generate sharper features. ");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "vcol_boundary_exponent", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "vcol_boundary_exponent");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 6.0f);
+ RNA_def_property_ui_range(prop, 0.1f, 3.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop,
+ "Exponent",
+ "Hardening exponent (smaller value smoother edges)");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "tilt_strength_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "tilt_strength_factor");
RNA_def_property_float_default(prop, 0);
More information about the Bf-blender-cvs
mailing list