From bfeb6c6404659fffb1222e084b0bd08cccb4e67d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 2 Jul 2018 01:10:58 +0300 Subject: [PATCH 1/1] Add getter for animation duration --- source/animation.cpp | 8 ++++++++ source/animation.h | 2 ++ 2 files changed, 10 insertions(+) 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); }; -- 2.43.0