diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2017-02-17 16:27:40 +0100 |
---|---|---|
committer | Kevin Ottens <kevin.ottens@kdab.com> | 2017-02-23 12:58:12 +0000 |
commit | da43857570a7b0ecb765af7c047e049635f6399b (patch) | |
tree | 6e9f0eac7c4a7e5f3ada0b0505b1474f39f0f23f | |
parent | a7bc39881783de3db3bc122f20ce11274998a148 (diff) |
Have QBlendedClipAnimator inherit from QAbstractClipAnimator
Change-Id: I3141c9fc9f5cc3fbdd2635b45517b684f5ebdec7
Task-Id: QTBUG-58899
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r-- | src/animation/frontend/qblendedclipanimator.cpp | 66 | ||||
-rw-r--r-- | src/animation/frontend/qblendedclipanimator.h | 17 | ||||
-rw-r--r-- | src/animation/frontend/qblendedclipanimator_p.h | 13 |
3 files changed, 8 insertions, 88 deletions
diff --git a/src/animation/frontend/qblendedclipanimator.cpp b/src/animation/frontend/qblendedclipanimator.cpp index 9d3bf5ba2..971f4e1e7 100644 --- a/src/animation/frontend/qblendedclipanimator.cpp +++ b/src/animation/frontend/qblendedclipanimator.cpp @@ -46,11 +46,8 @@ QT_BEGIN_NAMESPACE namespace Qt3DAnimation { QBlendedClipAnimatorPrivate::QBlendedClipAnimatorPrivate() - : Qt3DCore::QComponentPrivate() + : Qt3DAnimation::QAbstractClipAnimatorPrivate() , m_blendTreeRoot(nullptr) - , m_mapper(nullptr) - , m_running(false) - , m_loops(1) { } @@ -80,12 +77,12 @@ QBlendedClipAnimatorPrivate::QBlendedClipAnimatorPrivate() \since 5.9 */ QBlendedClipAnimator::QBlendedClipAnimator(Qt3DCore::QNode *parent) - : Qt3DCore::QComponent(*new QBlendedClipAnimatorPrivate, parent) + : Qt3DAnimation::QAbstractClipAnimator(*new QBlendedClipAnimatorPrivate, parent) { } QBlendedClipAnimator::QBlendedClipAnimator(QBlendedClipAnimatorPrivate &dd, Qt3DCore::QNode *parent) - : Qt3DCore::QComponent(dd, parent) + : Qt3DAnimation::QAbstractClipAnimator(dd, parent) { } @@ -99,24 +96,6 @@ QAbstractClipBlendNode *QBlendedClipAnimator::blendTree() const return d->m_blendTreeRoot; } -bool QBlendedClipAnimator::isRunning() const -{ - Q_D(const QBlendedClipAnimator); - return d->m_running; -} - -QChannelMapper *QBlendedClipAnimator::channelMapper() const -{ - Q_D(const QBlendedClipAnimator); - return d->m_mapper; -} - -int QBlendedClipAnimator::loops() const -{ - Q_D(const QBlendedClipAnimator); - return d->m_loops; -} - void QBlendedClipAnimator::setBlendTree(QAbstractClipBlendNode *blendTree) { Q_D(QBlendedClipAnimator); @@ -137,45 +116,6 @@ void QBlendedClipAnimator::setBlendTree(QAbstractClipBlendNode *blendTree) emit blendTreeChanged(blendTree); } -void QBlendedClipAnimator::setRunning(bool running) -{ - Q_D(QBlendedClipAnimator); - if (d->m_running == running) - return; - - d->m_running = running; - emit runningChanged(running); -} - -void QBlendedClipAnimator::setLoops(int loops) -{ - Q_D(QBlendedClipAnimator); - if (d->m_loops == loops) - return; - - d->m_loops = loops; - emit loopsChanged(loops); -} - - -void QBlendedClipAnimator::setChannelMapper(QChannelMapper *mapping) -{ - Q_D(QBlendedClipAnimator); - if (d->m_mapper == mapping) - return; - - if (d->m_mapper) - d->unregisterDestructionHelper(d->m_mapper); - - if (mapping && !mapping->parent()) - mapping->setParent(this); - d->m_mapper = mapping; - - if (d->m_mapper) - d->registerDestructionHelper(d->m_mapper, &QBlendedClipAnimator::setChannelMapper, d->m_mapper); - emit channelMapperChanged(mapping); -} - Qt3DCore::QNodeCreatedChangeBasePtr QBlendedClipAnimator::createNodeCreationChange() const { auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QBlendedClipAnimatorData>::create(this); diff --git a/src/animation/frontend/qblendedclipanimator.h b/src/animation/frontend/qblendedclipanimator.h index be1189f4f..e09e2dbc8 100644 --- a/src/animation/frontend/qblendedclipanimator.h +++ b/src/animation/frontend/qblendedclipanimator.h @@ -41,44 +41,31 @@ #define QT3DANIMATION_QBLENDEDCLIPANIMATOR_H #include <Qt3DAnimation/qt3danimation_global.h> -#include <Qt3DCore/qcomponent.h> +#include <Qt3DAnimation/qabstractclipanimator.h> QT_BEGIN_NAMESPACE namespace Qt3DAnimation { -class QChannelMapper; class QAbstractClipBlendNode; class QBlendedClipAnimatorPrivate; -class QT3DANIMATIONSHARED_EXPORT QBlendedClipAnimator : public Qt3DCore::QComponent +class QT3DANIMATIONSHARED_EXPORT QBlendedClipAnimator : public Qt3DAnimation::QAbstractClipAnimator { Q_OBJECT Q_PROPERTY(Qt3DAnimation::QAbstractClipBlendNode *blendTree READ blendTree WRITE setBlendTree NOTIFY blendTreeChanged) - Q_PROPERTY(Qt3DAnimation::QChannelMapper *channelMapper READ channelMapper WRITE setChannelMapper NOTIFY channelMapperChanged) - Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) - Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) public: explicit QBlendedClipAnimator(Qt3DCore::QNode *parent = nullptr); ~QBlendedClipAnimator(); - bool isRunning() const; - Qt3DAnimation::QChannelMapper *channelMapper() const; QAbstractClipBlendNode *blendTree() const; - int loops() const; public Q_SLOTS: - void setRunning(bool running); - void setChannelMapper(QChannelMapper *channelMapper); void setBlendTree(QAbstractClipBlendNode * blendTree); - void setLoops(int loops); Q_SIGNALS: void blendTreeChanged(QAbstractClipBlendNode * blendTree); - void runningChanged(bool running); - void channelMapperChanged(QChannelMapper *channelMapper); - void loopsChanged(int loops); protected: QBlendedClipAnimator(QBlendedClipAnimatorPrivate &dd, Qt3DCore::QNode *parent = nullptr); diff --git a/src/animation/frontend/qblendedclipanimator_p.h b/src/animation/frontend/qblendedclipanimator_p.h index 47a8bbfd5..e874a528d 100644 --- a/src/animation/frontend/qblendedclipanimator_p.h +++ b/src/animation/frontend/qblendedclipanimator_p.h @@ -51,33 +51,26 @@ // We mean it. // -#include <Qt3DCore/private/qcomponent_p.h> +#include <Qt3DAnimation/private/qabstractclipanimator_p.h> QT_BEGIN_NAMESPACE namespace Qt3DAnimation { class QAbstractClipBlendNode; -class QChannelMapper; -class QBlendedClipAnimatorPrivate : public Qt3DCore::QComponentPrivate +class QBlendedClipAnimatorPrivate : public Qt3DAnimation::QAbstractClipAnimatorPrivate { public: QBlendedClipAnimatorPrivate(); Q_DECLARE_PUBLIC(QBlendedClipAnimator) QAbstractClipBlendNode *m_blendTreeRoot; - QChannelMapper *m_mapper; - bool m_running; - int m_loops; }; -struct QBlendedClipAnimatorData +struct QBlendedClipAnimatorData : public QAbstractClipAnimatorData { Qt3DCore::QNodeId blendTreeRootId; - Qt3DCore::QNodeId mapperId; - bool running; - int loops; }; } // namespace Qt3DAnimation |