From a3c795f7b07afa3e8838ad143f8df7a8d10f1ad4 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 26 Aug 2019 14:53:21 +0300 Subject: [PATCH] Produce a linear animation curve if there's only one keyframe This can be useful for setting a constant value for the duration of an animation, without needing to specify the value twice. --- source/animation.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/animation.cpp b/source/animation.cpp index b1ae1157..94c96809 100644 --- a/source/animation.cpp +++ b/source/animation.cpp @@ -267,6 +267,14 @@ void Animation::create_curve(CurveTarget target, int component, const T &extract while(n_control--) knots.pop_back(); + if(knots.size()==1) + { + knots.push_back(knots.back()); + knots.push_back(knots.back()); + knots.back().x += 1; + knots.push_back(knots.back()); + } + curves.push_back(new ValueCurve(target, component, knots)); } -- 2.43.0