diff options
author | Christian Strømme <christian.stromme@qt.io> | 2017-11-02 16:51:11 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-01-23 18:23:29 +0000 |
commit | f6699afc911da958347c6916c1eff3558ee8d431 (patch) | |
tree | e1718c9829abda29469a9955f2f275ada62713c1 /src/animation/backend/clipanimator_p.h | |
parent | a73937ac90169d77f2797633738fee27f71ad35a (diff) |
Add support for setting a time index in the ClipAnimator
This makes it possible to seek the animation clip to a specific position
in the time-line. The index is a real value between 0 and 1, where 0.0 is
the start of the clip and 1.0 is at the end of the clip
Change-Id: Ic8c57d04e4f1e0a7628713e057b5b8a41a400c5a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/clipanimator_p.h')
-rw-r--r-- | src/animation/backend/clipanimator_p.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/animation/backend/clipanimator_p.h b/src/animation/backend/clipanimator_p.h index 28c0ae51d..f4c04a4bf 100644 --- a/src/animation/backend/clipanimator_p.h +++ b/src/animation/backend/clipanimator_p.h @@ -77,12 +77,14 @@ public: bool isRunning() const { return m_running; } void setLoops(int loops) { m_loops = loops; } int loops() const { return m_loops; } + void setNormalizedLocalTime(float normalizedLocalTime); + float normalizedLocalTime() const { return m_normalizedLocalTime; } void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override; void setHandler(Handler *handler) { m_handler = handler; } // Called by jobs - bool canRun() const { return !m_clipId.isNull() && !m_mapperId.isNull() && m_running; } + bool canRun() const { return !m_clipId.isNull() && !m_mapperId.isNull(); } void setMappingData(const QVector<MappingData> &mappingData) { m_mappingData = mappingData; } QVector<MappingData> mappingData() const { return m_mappingData; } @@ -105,6 +107,14 @@ public: double lastLocalTime() const; void setLastLocalTime(double lastLocalTime); + float lastNormalizedLocalTime() { return m_lastNormalizedLocalTime; } + void setLastNormalizedLocalTime(float normalizedLocalTime); + bool isSeeking() const + { + return isValidNormalizedTime(m_normalizedLocalTime) + && !qFuzzyCompare(m_lastNormalizedLocalTime, m_normalizedLocalTime); + } + private: void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final; @@ -121,6 +131,9 @@ private: int m_currentLoop; ClipFormat m_clipFormat; + + float m_normalizedLocalTime; + float m_lastNormalizedLocalTime; }; } // namespace Animation |