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");
if(realloc)
{
for(unsigned i=1; i<keyframes.size(); ++i)
- keyframes[i].prev = &keyframes[i-1];
+ if(keyframes[i].prev)
+ keyframes[i].prev = &keyframes[i-1];
}
- else if(keyframes.size()>1)
+ if(keyframes.size()>1 && t>(&tkf-1)->time)
tkf.prev = &tkf-1;
prepare_keyframe(tkf);
event_iter(animation->events.begin()),
x(0),
end(false)
-{ }
+{
+ if(iter==animation->keyframes.end())
+ throw invalid_argument("Animation::Iterator::Iterator");
+}
Animation::Iterator &Animation::Iterator::operator+=(const Time::TimeDelta &t)
{