X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fanimation%2Fkeyframe.cpp;h=d1f1a7ea298251818b60d2b4c401edd0f0b07a91;hp=f610de2d42afbd08dd118cf97e7f54afa75da7de;hb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266 diff --git a/source/animation/keyframe.cpp b/source/animation/keyframe.cpp index f610de2d..d1f1a7ea 100644 --- a/source/animation/keyframe.cpp +++ b/source/animation/keyframe.cpp @@ -1,4 +1,5 @@ #include +#include #include "keyframe.h" #include "pose.h" @@ -7,13 +8,6 @@ using namespace std; namespace Msp { namespace GL { -// Avoid synthesizing RefPtr c'tor and d'tor in files including keyframe.h -KeyFrame::KeyFrame() -{ } - -KeyFrame::~KeyFrame() -{ } - void KeyFrame::set_transform(const Transform &t) { transform = t; @@ -33,7 +27,6 @@ void KeyFrame::set_uniform(const string &n, const AnimatedUniform &u) void KeyFrame::set_pose(const Pose &p) { pose = &p; - pose.keep(); } @@ -47,19 +40,8 @@ KeyFrame::AnimatedUniform::AnimatedUniform(unsigned s, float v0, float v1, float } -KeyFrame::Loader::Loader(KeyFrame &k): - DataFile::CollectionObjectLoader(k, 0) -{ - init(); -} - -KeyFrame::Loader::Loader(KeyFrame &k, Collection &c): - DataFile::CollectionObjectLoader(k, &c) -{ - init(); -} - -void KeyFrame::Loader::init() +KeyFrame::Loader::Loader(KeyFrame &k, Collection *c): + DataFile::CollectionObjectLoader(k, c) { add("pose", &Loader::pose); add("pose", &Loader::pose_inline); @@ -73,17 +55,22 @@ void KeyFrame::Loader::init() add("scaling", &Loader::scaling); } +void KeyFrame::Loader::set_inline_base_name(const string &n) +{ + inline_base_name = n; +} + void KeyFrame::Loader::pose(const string &n) { obj.pose = &get_collection().get(n); - obj.pose.keep(); } void KeyFrame::Loader::pose_inline() { RefPtr p = new Pose; load_sub(*p, get_collection()); - obj.pose = p; + get_collection().add((inline_base_name.empty() ? FS::basename(get_source()) : inline_base_name)+".pose", p.get()); + obj.pose = p.release(); } void KeyFrame::Loader::position(float x, float y, float z)