[Bf-blender-cvs] [b54c6a20aaf] master: Curves: fix brush position is not under mouse cursor

Jacques Lucke noreply at git.blender.org
Mon May 2 11:37:08 CEST 2022


Commit: b54c6a20aaf58136e2447e6fdd939e4052256115
Author: Jacques Lucke
Date:   Mon May 2 11:36:27 2022 +0200
Branches: master
https://developer.blender.org/rBb54c6a20aaf58136e2447e6fdd939e4052256115

Curves: fix brush position is not under mouse cursor

This was mostly noticable in the case of the Delete brush, when
clicking somewhere in empty space. It used the closest point on
a curve as brush position.

===================================================================

M	source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc

===================================================================

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
index 945bb09c0c6..3d2d4f8527e 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_3d_brush.cc
@@ -116,8 +116,11 @@ static std::optional<float3> find_curves_brush_position(const CurvesGeometry &cu
 
             const float distance_sq_re = math::distance_squared(brush_pos_re, closest_re);
 
+            float3 brush_position_cu;
+            closest_to_line_segment_v3(brush_position_cu, closest_cu, ray_start_cu, ray_end_cu);
+
             BrushPositionCandidate candidate;
-            candidate.position_cu = closest_cu;
+            candidate.position_cu = brush_position_cu;
             candidate.depth_sq_cu = depth_sq_cu;
             candidate.distance_sq_re = distance_sq_re;



More information about the Bf-blender-cvs mailing list