diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_curves.hh | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curves_geometry.cc | 21 |
2 files changed, 8 insertions, 31 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh index 168b17bad30..dc67f1e7403 100644 --- a/source/blender/blenkernel/BKE_curves.hh +++ b/source/blender/blenkernel/BKE_curves.hh @@ -264,22 +264,10 @@ class CurvesGeometry : public ::CurvesGeometry { MutableSpan<float> nurbs_weights_for_write(); /** - * The index of a triangle (#MLoopTri) that a curve is attached to. - * The index is -1, if the curve is not attached. + * UV coordinate for each curve that encodes where the curve is attached to the surface mesh. */ - VArray<int> surface_triangle_indices() const; - MutableSpan<int> surface_triangle_indices_for_write(); - - /** - * Barycentric coordinates of the attachment point within a triangle. - * Only the first two coordinates are stored. The third coordinate can be derived because the sum - * of the three coordinates is 1. - * - * When the triangle index is -1, this coordinate should be ignored. - * The span can be empty, when all triangle indices are -1. - */ - Span<float2> surface_triangle_coords() const; - MutableSpan<float2> surface_triangle_coords_for_write(); + Span<float2> surface_uv_coords() const; + MutableSpan<float2> surface_uv_coords_for_write(); VArray<float> selection_point_float() const; MutableSpan<float> selection_point_float_for_write(); diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index c2e67d853c9..2fa31bd4100 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -35,10 +35,9 @@ static const std::string ATTR_HANDLE_POSITION_RIGHT = "handle_right"; static const std::string ATTR_NURBS_ORDER = "nurbs_order"; 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"; +static const std::string ATTR_SURFACE_UV_COORDINATE = "surface_uv_coordinate"; /* -------------------------------------------------------------------- */ /** \name Constructors/Destructor @@ -419,24 +418,14 @@ MutableSpan<int8_t> CurvesGeometry::nurbs_knots_modes_for_write() return get_mutable_attribute<int8_t>(*this, ATTR_DOMAIN_CURVE, ATTR_NURBS_KNOTS_MODE, 0); } -VArray<int> CurvesGeometry::surface_triangle_indices() const +Span<float2> CurvesGeometry::surface_uv_coords() const { - return get_varray_attribute<int>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_TRIANGLE_INDEX, -1); + return get_span_attribute<float2>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_UV_COORDINATE); } -MutableSpan<int> CurvesGeometry::surface_triangle_indices_for_write() +MutableSpan<float2> CurvesGeometry::surface_uv_coords_for_write() { - return get_mutable_attribute<int>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_TRIANGLE_INDEX, -1); -} - -Span<float2> CurvesGeometry::surface_triangle_coords() const -{ - return get_span_attribute<float2>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_TRIANGLE_COORDINATE); -} - -MutableSpan<float2> CurvesGeometry::surface_triangle_coords_for_write() -{ - return get_mutable_attribute<float2>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_TRIANGLE_COORDINATE); + return get_mutable_attribute<float2>(*this, ATTR_DOMAIN_CURVE, ATTR_SURFACE_UV_COORDINATE); } VArray<float> CurvesGeometry::selection_point_float() const |