]> git.tdb.fi Git - libs/gl.git/commitdiff
Require the first keyframe of an animation to be at zero offset
authorMikko Rasa <tdb@tdb.fi>
Mon, 2 Jul 2018 11:43:02 +0000 (14:43 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 2 Jul 2018 11:43:02 +0000 (14:43 +0300)
Having empty space at the start of an animation produces unexpected
results.

source/animation.cpp

index b58a4ea77e0e0c3193c2eec31074aa91912b72c7..02a2d371c71c1d32baff99aa3a120429d8c90d91 100644 (file)
@@ -61,6 +61,8 @@ void Animation::add_keyframe(const Time::TimeDelta &t, const KeyFrame &kf, float
 
 void Animation::add_keyframe(const Time::TimeDelta &t, const RefPtr<const KeyFrame> &kf, float ss, float es)
 {
+       if(keyframes.empty() && t!=Time::zero)
+               throw invalid_argument("Animation::add_keyframe");
        if(!keyframes.empty() && t<keyframes.back().time)
                throw invalid_argument("Animation::add_keyframe");