]> git.tdb.fi Git - libs/gl.git/blobdiff - source/animation.cpp
Produce a linear animation curve if there's only one keyframe
[libs/gl.git] / source / animation.cpp
index 37f583d5ec53b43324e67f7fcd1237a25bbefa80..94c96809214215aa890797a24a9c774ff0401f74 100644 (file)
@@ -18,9 +18,11 @@ Animation::Animation():
        looping(false)
 { }
 
-// Avoid synthesizing ~RefPtr in files including animation.h
 Animation::~Animation()
-{ }
+{
+       for(vector<Curve *>::iterator i=curves.begin(); i!=curves.end(); ++i)
+               delete *i;
+}
 
 void Animation::set_armature(const Armature &a)
 {
@@ -265,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<N>(target, component, knots));
 }