| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DANIMATION_QANIMATIONCONTROLLER_H |
| 5 | #define QT3DANIMATION_QANIMATIONCONTROLLER_H |
| 6 | |
| 7 | #include <Qt3DAnimation/qkeyframeanimation.h> |
| 8 | #include <Qt3DAnimation/qanimationgroup.h> |
| 9 | #include <Qt3DCore/qentity.h> |
| 10 | |
| 11 | #include <Qt3DAnimation/qt3danimation_global.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | namespace Qt3DAnimation { |
| 16 | |
| 17 | class QAnimationControllerPrivate; |
| 18 | |
| 19 | class Q_3DANIMATIONSHARED_EXPORT QAnimationController : public QObject |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | Q_PROPERTY(int activeAnimationGroup READ activeAnimationGroup WRITE setActiveAnimationGroup NOTIFY activeAnimationGroupChanged) |
| 23 | Q_PROPERTY(float position READ position WRITE setPosition NOTIFY positionChanged) |
| 24 | Q_PROPERTY(float positionScale READ positionScale WRITE setPositionScale NOTIFY positionScaleChanged) |
| 25 | Q_PROPERTY(float positionOffset READ positionOffset WRITE setPositionOffset NOTIFY positionOffsetChanged) |
| 26 | Q_PROPERTY(Qt3DCore::QEntity *entity READ entity WRITE setEntity NOTIFY entityChanged) |
| 27 | Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged) |
| 28 | |
| 29 | public: |
| 30 | QAnimationController(QObject *parent = nullptr); |
| 31 | |
| 32 | QList<Qt3DAnimation::QAnimationGroup *> animationGroupList(); |
| 33 | |
| 34 | int activeAnimationGroup() const; |
| 35 | float position() const; |
| 36 | float positionScale() const; |
| 37 | float positionOffset() const; |
| 38 | Qt3DCore::QEntity *entity() const; |
| 39 | bool recursive() const; |
| 40 | |
| 41 | void setAnimationGroups(const QList<Qt3DAnimation::QAnimationGroup *> &animationGroups); |
| 42 | void addAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroups); |
| 43 | void removeAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroups); |
| 44 | |
| 45 | Q_INVOKABLE int getAnimationIndex(const QString &name) const; |
| 46 | Q_INVOKABLE Qt3DAnimation::QAnimationGroup *getGroup(int index) const; |
| 47 | |
| 48 | public Q_SLOTS: |
| 49 | void setActiveAnimationGroup(int index); |
| 50 | void setPosition(float position); |
| 51 | void setPositionScale(float scale); |
| 52 | void setPositionOffset(float offset); |
| 53 | void setEntity(Qt3DCore::QEntity *entity); |
| 54 | void setRecursive(bool recursive); |
| 55 | |
| 56 | Q_SIGNALS: |
| 57 | void activeAnimationGroupChanged(int index); |
| 58 | void positionChanged(float position); |
| 59 | void positionScaleChanged(float scale); |
| 60 | void positionOffsetChanged(float offset); |
| 61 | void entityChanged(Qt3DCore::QEntity *entity); |
| 62 | void recursiveChanged(bool recursive); |
| 63 | |
| 64 | private: |
| 65 | Q_DECLARE_PRIVATE(QAnimationController) |
| 66 | }; |
| 67 | |
| 68 | } // Qt3DAnimation |
| 69 | |
| 70 | QT_END_NAMESPACE |
| 71 | |
| 72 | #endif // QT3DANIMATION_QANIMATIONCONTROLLER_H |
| 73 |
