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-04-07 00:13:06 +0300
committerHans Goudey <h.goudey@me.com>2022-04-07 00:13:06 +0300
commit74db0f3d5fa18e1992a716e2e38e910965dab28f (patch)
tree18d6fe1db54a9fdeea6e3aa82162b5618ccc2d7b /source/blender/blenkernel/BKE_curves.hh
parenteb470bfbfe0a3f3e17176f320487f0caa299459e (diff)
Fix: Curve parameter node broken for Bezier curves after refactor
The last length value was not initialized, and all length values were moved one position towards the front of each curve incorrectly. Also fix an assert when a curve only had a single point.
Diffstat (limited to 'source/blender/blenkernel/BKE_curves.hh')
-rw-r--r--source/blender/blenkernel/BKE_curves.hh4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index b233a89c56d..4117f8b9bdc 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -643,7 +643,9 @@ inline Span<float> CurvesGeometry::evaluated_lengths_for_curve(const int curve_i
inline float CurvesGeometry::evaluated_length_total_for_curve(const int curve_index,
const bool cyclic) const
{
- return this->evaluated_lengths_for_curve(curve_index, cyclic).last();
+ const Span<float> lengths = this->evaluated_lengths_for_curve(curve_index, cyclic);
+ /* Check for curves that have no evaluated segments. */
+ return lengths.is_empty() ? 0.0f : lengths.last();
}
/** \} */