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-07-25 19:53:06 +0300
committerHans Goudey <h.goudey@me.com>2022-07-25 19:53:22 +0300
commit739136caca5cbe73d0478583d44a3d0d36137b42 (patch)
tree45d2c61beafb2b8b4a2019deb90d1eebe420cd29
parentf26aa186b26f46dad08536d95b126afb42abd2f3 (diff)
Fix: Assert in resample curve node with single point curve
-rw-r--r--source/blender/geometry/intern/resample_curves.cc16
1 files changed, 12 insertions, 4 deletions
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<float> 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