diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-31 20:00:24 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-31 20:00:24 +0300 |
commit | a1830859fa98d529a2eae709b2557a91f1bbe9e7 (patch) | |
tree | 7ae959d2351cfbabe0f28a6077096b197b3911c1 /source/blender/blenkernel/intern | |
parent | 96f20ddc1e84e0f5036ea1bdda8381f037069f77 (diff) |
Curves: Add soft selection in sculpt mode
This commit adds a float selection to curve control points or curves,
a sculpt tool to paint the selection, and uses the selection influence
in the existing sculpt brushes.
The selection is the inverse of the "mask" from mesh sculpt mode
currently. That change is described in more detail here: T97903
Since some sculpt tools are really "per curve" tools, they use the
average point selection of all of their points. The delete brush
considers a curve selected if any of its points have a non-zero
selection.
There is a new option to choose the selection domain, which affects how
painting the selection works. You can also turn the selection off by
clicking on the active domain.
Sculpt brushes can be faster when the selection is small, because
finding selected curves or points is generally faster than the
existing brush intersection and distance checks.
The main limitation currently is that we can't see the selection in the
viewport by default. For now, to see the selection one has to add a
simple material to the curves object as shown in the differential
revision. And one has to switch to Material Preview in the 3d view.
Differential Revision: https://developer.blender.org/D14934
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/curves_geometry.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 0fd58a52f81..07e50eea88c 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -37,6 +37,8 @@ static const std::string ATTR_NURBS_WEIGHT = "nurbs_weight"; static const std::string ATTR_NURBS_KNOTS_MODE = "knots_mode"; static const std::string ATTR_SURFACE_TRIANGLE_INDEX = "surface_triangle_index"; static const std::string ATTR_SURFACE_TRIANGLE_COORDINATE = "surface_triangle_coordinate"; +static const std::string ATTR_SELECTION_POINT_FLOAT = ".selection_point_float"; +static const std::string ATTR_SELECTION_CURVE_FLOAT = ".selection_curve_float"; /* -------------------------------------------------------------------- */ /** \name Constructors/Destructor @@ -438,6 +440,26 @@ MutableSpan<float2> CurvesGeometry::surface_triangle_coords_for_write() return get_mutable_attribute<float2>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_TRIANGLE_COORDINATE); } +VArray<float> CurvesGeometry::selection_point_float() const +{ + return get_varray_attribute<float>(*this, ATTR_DOMAIN_POINT, ATTR_SELECTION_POINT_FLOAT, 1.0f); +} + +MutableSpan<float> CurvesGeometry::selection_point_float_for_write() +{ + return get_mutable_attribute<float>(*this, ATTR_DOMAIN_POINT, ATTR_SELECTION_POINT_FLOAT, 1.0f); +} + +VArray<float> CurvesGeometry::selection_curve_float() const +{ + return get_varray_attribute<float>(*this, ATTR_DOMAIN_CURVE, ATTR_SELECTION_CURVE_FLOAT, 1.0f); +} + +MutableSpan<float> CurvesGeometry::selection_curve_float_for_write() +{ + return get_mutable_attribute<float>(*this, ATTR_DOMAIN_CURVE, ATTR_SELECTION_CURVE_FLOAT, 1.0f); +} + /** \} */ /* -------------------------------------------------------------------- */ |