X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimation.cpp;h=6c9e179dc749dc16642b5b755f6afd7e36fecf2b;hp=ab9d6e6085c35a36d1f430b652586411e7849047;hb=a9c375e17065bcc429b430bd8211a9ee845159a5;hpb=a4549c55a6d47129bd9e42c6a49a671b759ce6d9 diff --git a/source/animation.cpp b/source/animation.cpp index ab9d6e60..6c9e179d 100644 --- a/source/animation.cpp +++ b/source/animation.cpp @@ -23,6 +23,8 @@ Animation::~Animation() void Animation::set_armature(const Armature &a) { + if(!keyframes.empty() && &a!=armature) + throw invalid_operation("Animation::set_armature"); armature = &a; } @@ -64,9 +66,14 @@ void Animation::add_keyframe(const Time::TimeDelta &t, const RefPtrget_pose() && armature && kf->get_pose()->get_armature()!=armature) + throw invalid_argument("Animation::add_keyframe"); bool realloc = (keyframes.size()>=keyframes.capacity()); + if(kf->get_pose() && !armature) + armature = kf->get_pose()->get_armature(); + keyframes.push_back(TimedKeyFrame()); TimedKeyFrame &tkf = keyframes.back(); tkf.time = t;