forked from bartvdbraak/blender
Sculpt: Hardness brush property
The hardness property moves the brush falloff towards the edges, making the brush sharper. This should be the intended way to control the brush falloff instead of tweaking the falloff curve manually, as it can be mapped to pressure to make the falloff variable during the stroke. It is also a good idea to show in the UI that the custom curves is an advance features and it should almost never be modified when sculpting/ painting unless you want to create some advanced effects. By modifying the curves freely it is really easy to break the brushes and make them produce artifacts. This needs to be done in a later after merging the pending projects to reorganize all the brush properties accordingly. Reviewed By: brecht Differential Revision: https://developer.blender.org/D6902
This commit is contained in:
parent
fc7fdc5c4e
commit
ff0124418f
@ -536,6 +536,7 @@ def brush_settings(layout, context, brush, popover=False):
|
||||
|
||||
# normal_radius_factor
|
||||
layout.prop(brush, "normal_radius_factor", slider=True)
|
||||
layout.prop(brush, "hardness", slider=True)
|
||||
|
||||
# auto_smooth_factor and use_inverse_smooth_pressure
|
||||
if capabilities.has_auto_smooth:
|
||||
|
@ -1953,8 +1953,20 @@ float tex_strength(SculptSession *ss,
|
||||
}
|
||||
}
|
||||
|
||||
/* Hardness. */
|
||||
float final_len = len;
|
||||
const float hardness = br->hardness;
|
||||
float p = len / cache->radius;
|
||||
if (p < hardness) {
|
||||
final_len = 0.0f;
|
||||
}
|
||||
else {
|
||||
p = (p - hardness) / (1.0f - hardness);
|
||||
final_len = p * cache->radius;
|
||||
}
|
||||
|
||||
/* Falloff curve. */
|
||||
avg *= BKE_brush_curve_strength(br, len, cache->radius);
|
||||
avg *= BKE_brush_curve_strength(br, final_len, cache->radius);
|
||||
avg *= frontface(br, cache->view_normal, vno, fno);
|
||||
|
||||
/* Paint mask. */
|
||||
|
@ -102,6 +102,7 @@
|
||||
.sculpt_tool = SCULPT_TOOL_DRAW, \
|
||||
.pose_smooth_iterations = 4, \
|
||||
.pose_ik_segments = 1, \
|
||||
.hardness = 0.0f, \
|
||||
\
|
||||
/* A kernel radius of 1 has almost no effect (T63233). */ \
|
||||
.blur_kernel_radius = 2, \
|
||||
|
@ -326,7 +326,7 @@ typedef struct Brush {
|
||||
char mask_tool;
|
||||
/** Active grease pencil tool. */
|
||||
char gpencil_tool;
|
||||
char _pad1[1];
|
||||
char _pad1[5];
|
||||
|
||||
float autosmooth_factor;
|
||||
|
||||
@ -344,6 +344,8 @@ typedef struct Brush {
|
||||
float texture_sample_bias;
|
||||
|
||||
int curve_preset;
|
||||
float hardness;
|
||||
|
||||
int automasking_flags;
|
||||
|
||||
/* Factor that controls the shape of the brush tip by rounding the corners of a square. */
|
||||
|
@ -2012,6 +2012,13 @@ static void rna_def_brush(BlenderRNA *brna)
|
||||
"Area to apply deformation falloff to the effects of the simulation");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "hardness", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "hardness");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Hardness", "How close the brush falloff starts from the edge of the brush");
|
||||
RNA_def_property_update(prop, 0, "rna_Brush_update");
|
||||
|
||||
prop = RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "autosmooth_factor");
|
||||
RNA_def_property_float_default(prop, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user