Sculpt: Followup change/fix to clay strips brush
A combination of a few changes: - Don't apply hardness again, the "cube tip" calculation already factors it in. - Avoid multiplication by brush radius, just use the 0-1 distances from the cube tip calculation directly. - Add filtering by brush radius to fix the second part of #128004. - Change brush radius filtering to be consistent with previous code using less than or equal instead of less than. Note that the current radius filtering in BKE_brush_calc_curve_factors is unnecessary since we already filter by the radius in a separate step.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BKE_brush.hh"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_paint.hh"
|
||||
@@ -69,9 +70,9 @@ static void calc_faces(const Depsgraph &depsgraph,
|
||||
tls.distances.resize(verts.size());
|
||||
const MutableSpan<float> distances = tls.distances;
|
||||
calc_brush_cube_distances(brush, mat, position_data.eval, verts, distances, factors);
|
||||
scale_factors(distances, cache.radius);
|
||||
apply_hardness_to_distances(cache, distances);
|
||||
calc_brush_strength_factors(cache, brush, distances, factors);
|
||||
filter_distances_with_radius(1.0f, distances, factors);
|
||||
BKE_brush_calc_curve_factors(
|
||||
eBrushCurvePreset(brush.curve_preset), brush.curve, distances, 1.0f, factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
@@ -125,9 +126,9 @@ static void calc_grids(const Depsgraph &depsgraph,
|
||||
tls.distances.resize(positions.size());
|
||||
const MutableSpan<float> distances = tls.distances;
|
||||
calc_brush_cube_distances(brush, mat, positions, distances, factors);
|
||||
scale_factors(distances, cache.radius);
|
||||
apply_hardness_to_distances(cache, distances);
|
||||
calc_brush_strength_factors(cache, brush, distances, factors);
|
||||
filter_distances_with_radius(1.0f, distances, factors);
|
||||
BKE_brush_calc_curve_factors(
|
||||
eBrushCurvePreset(brush.curve_preset), brush.curve, distances, 1.0f, factors);
|
||||
|
||||
auto_mask::calc_grids_factors(depsgraph, object, cache.automasking.get(), node, grids, factors);
|
||||
|
||||
@@ -180,9 +181,9 @@ static void calc_bmesh(const Depsgraph &depsgraph,
|
||||
tls.distances.resize(verts.size());
|
||||
const MutableSpan<float> distances = tls.distances;
|
||||
calc_brush_cube_distances(brush, mat, positions, distances, factors);
|
||||
scale_factors(distances, cache.radius);
|
||||
apply_hardness_to_distances(cache, distances);
|
||||
calc_brush_strength_factors(cache, brush, distances, factors);
|
||||
filter_distances_with_radius(1.0f, distances, factors);
|
||||
BKE_brush_calc_curve_factors(
|
||||
eBrushCurvePreset(brush.curve_preset), brush.curve, distances, 1.0f, factors);
|
||||
|
||||
auto_mask::calc_vert_factors(depsgraph, object, cache.automasking.get(), node, verts, factors);
|
||||
|
||||
|
||||
@@ -6522,7 +6522,7 @@ void filter_distances_with_radius(const float radius,
|
||||
const MutableSpan<float> factors)
|
||||
{
|
||||
for (const int i : distances.index_range()) {
|
||||
if (distances[i] > radius) {
|
||||
if (distances[i] >= radius) {
|
||||
factors[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user