Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-05-23 10:47:17 +0300
committerHans Goudey <h.goudey@me.com>2022-05-23 10:47:17 +0300
commitf4a01c8a8bfcc948aedf45888d9303b7ce571124 (patch)
tree1d9ce85c6e9c98a8f8fe03beed37c236ed0b9c93 /source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
parent8f3847aef3f21d9c2cc549c783ea2ce708ec3161 (diff)
Fix T98101: Handle single point curves in delete brush
The 3D brush utility and the delete brush only considered segments, so they did not handle single points. Fix by adding special cases for single point curves. Differential Revision: https://developer.blender.org/D14944
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_brush.cc')
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_brush.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index 83e0d493d00..92ce6ba3153 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -95,6 +95,26 @@ static std::optional<float3> find_curves_brush_position(const CurvesGeometry &cu
for (const int curve_i : curves_range) {
const IndexRange points = curves.points_for_curve(curve_i);
+ if (points.size() == 1) {
+ const float3 &pos_cu = positions[points.first()];
+
+ const float depth_sq_cu = math::distance_squared(ray_start_cu, pos_cu);
+ if (depth_sq_cu > max_depth_sq_cu) {
+ continue;
+ }
+
+ float2 pos_re;
+ ED_view3d_project_float_v2_m4(&region, pos_cu, pos_re, projection.values);
+
+ BrushPositionCandidate candidate;
+ candidate.position_cu = pos_cu;
+ candidate.depth_sq_cu = depth_sq_cu;
+ candidate.distance_sq_re = math::distance_squared(brush_pos_re, pos_re);
+
+ update_if_better(best_candidate, candidate);
+ continue;
+ }
+
for (const int segment_i : points.drop_back(1)) {
const float3 &p1_cu = positions[segment_i];
const float3 &p2_cu = positions[segment_i + 1];