From 739136caca5cbe73d0478583d44a3d0d36137b42 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 25 Jul 2022 11:53:06 -0500 Subject: Fix: Assert in resample curve node with single point curve --- source/blender/geometry/intern/resample_curves.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source/blender/geometry') diff --git a/source/blender/geometry/intern/resample_curves.cc b/source/blender/geometry/intern/resample_curves.cc index 29e358cc3f4..86c1980d9ee 100644 --- a/source/blender/geometry/intern/resample_curves.cc +++ b/source/blender/geometry/intern/resample_curves.cc @@ -233,10 +233,18 @@ static Curves *resample_to_uniform(const CurveComponent &src_component, for (const int i_curve : sliced_selection) { const bool cyclic = curves_cyclic[i_curve]; const IndexRange dst_points = dst_curves.points_for_curve(i_curve); - length_parameterize::sample_uniform(src_curves.evaluated_lengths_for_curve(i_curve, cyclic), - !curves_cyclic[i_curve], - sample_indices.as_mutable_span().slice(dst_points), - sample_factors.as_mutable_span().slice(dst_points)); + const Span lengths = src_curves.evaluated_lengths_for_curve(i_curve, cyclic); + if (lengths.is_empty()) { + /* Handle curves with only one evaluated point. */ + sample_indices.as_mutable_span().slice(dst_points).fill(0); + sample_factors.as_mutable_span().slice(dst_points).fill(0.0f); + } + else { + length_parameterize::sample_uniform(lengths, + !curves_cyclic[i_curve], + sample_indices.as_mutable_span().slice(dst_points), + sample_factors.as_mutable_span().slice(dst_points)); + } } /* For every attribute, evaluate attributes from every curve in the range in the original -- cgit v1.2.3