]> git.tdb.fi Git - libs/gl.git/commitdiff
Add getter for animation duration
authorMikko Rasa <tdb@tdb.fi>
Sun, 1 Jul 2018 22:10:58 +0000 (01:10 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 1 Jul 2018 22:10:58 +0000 (01:10 +0300)
source/animation.cpp
source/animation.h

index f0e2630a502f6f43339ef7cbd1be8bcbe3aed7a3..b58a4ea77e0e0c3193c2eec31074aa91912b72c7 100644 (file)
@@ -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;
index e3fb79ee3aff2bdcf019e79c03628066aed605c2..b9e9fe1f3d1bd25e7a10efd3c0d7648eadd75000 100644 (file)
@@ -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);
 };