From: Mikko Rasa Date: Mon, 26 Aug 2019 11:53:21 +0000 (+0300) Subject: Produce a linear animation curve if there's only one keyframe X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a3c795f7b07afa3e8838ad143f8df7a8d10f1ad4;p=libs%2Fgl.git 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. --- 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)); }