From: Mikko Rasa Date: Sun, 1 Jul 2018 22:10:58 +0000 (+0300) Subject: Add getter for animation duration X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bfeb6c6404659fffb1222e084b0bd08cccb4e67d;p=libs%2Fgl.git Add getter for animation duration --- diff --git a/source/animation.cpp b/source/animation.cpp index f0e2630a..b58a4ea7 100644 --- a/source/animation.cpp +++ b/source/animation.cpp @@ -114,6 +114,14 @@ void Animation::add_event(const Time::TimeDelta &t, const string &n, const Varia events.push_back(event); } +const Time::TimeDelta &Animation::get_duration() const +{ + if(keyframes.empty()) + return Time::zero; + + return keyframes.back().time; +} + void Animation::set_looping(bool l) { looping = l; diff --git a/source/animation.h b/source/animation.h index e3fb79ee..b9e9fe1f 100644 --- a/source/animation.h +++ b/source/animation.h @@ -149,6 +149,8 @@ private: public: void add_event(const Time::TimeDelta &, const std::string &, const Variant & = Variant()); + const Msp::Time::TimeDelta &get_duration() const; + void set_looping(bool); };