#include <cmath>
#include <msp/core/maputils.h>
#include <msp/datafile/collection.h>
+#include <msp/fs/utils.h>
#include <msp/interpolate/bezierspline.h>
+#include <msp/strings/format.h>
#include "animation.h"
#include "animationeventobserver.h"
#include "armature.h"
Animation::~Animation()
{
+ for(vector<TimedKeyFrame>::iterator i=keyframes.begin(); i!=keyframes.end(); ++i)
+ if(i->owned)
+ delete i->keyframe;
for(vector<Curve *>::iterator i=curves.begin(); i!=curves.end(); ++i)
delete *i;
}
TimedKeyFrame tkf;
tkf.time = t;
tkf.keyframe = kf;
- if(!owned)
- tkf.keyframe.keep();
tkf.control = c;
+ tkf.owned = owned;
keyframes.push_back(tkf);
{
RefPtr<KeyFrame> kf = new KeyFrame;
if(coll)
- load_sub(*kf, get_collection());
+ {
+ KeyFrame::Loader ldr(*kf, get_collection());
+ ldr.set_inline_base_name(format("%s/%d.kframe", FS::basename(get_source()), obj.keyframes.size()));
+ load_sub_with(ldr);
+ }
else
load_sub(*kf);