Added an "Exponent" slider to Color Boundary brush.

This commit is contained in:
Joseph Eagar 2020-11-09 22:25:03 -08:00
parent 3042f6e608
commit d823f6e2cf
5 changed files with 37 additions and 4 deletions

View File

@ -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")

View File

@ -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.
*

View File

@ -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;

View File

@ -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;

View File

@ -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);