1// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
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 QT3DCORE_QSKELETONLOADER_H
5#define QT3DCORE_QSKELETONLOADER_H
6
7#include <Qt3DCore/qabstractskeleton.h>
8#include <Qt3DCore/qjoint.h>
9#include <Qt3DCore/qt3dcore_global.h>
10#include <QtCore/qurl.h>
11
12QT_BEGIN_NAMESPACE
13
14namespace Qt3DCore {
15
16class QSkeletonLoaderPrivate;
17
18class Q_3DCORESHARED_EXPORT QSkeletonLoader : public QAbstractSkeleton
19{
20 Q_OBJECT
21 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
22 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
23 Q_PROPERTY(bool createJointsEnabled READ isCreateJointsEnabled WRITE setCreateJointsEnabled NOTIFY createJointsEnabledChanged)
24 Q_PROPERTY(Qt3DCore::QJoint* rootJoint READ rootJoint NOTIFY rootJointChanged)
25
26public:
27 explicit QSkeletonLoader(Qt3DCore::QNode *parent = nullptr);
28 explicit QSkeletonLoader(const QUrl &source,
29 Qt3DCore::QNode *parent = nullptr);
30 ~QSkeletonLoader();
31
32 enum Status {
33 NotReady = 0,
34 Ready,
35 Error
36 };
37 Q_ENUM(Status) // LCOV_EXCL_LINE
38
39 QUrl source() const;
40 Status status() const;
41 bool isCreateJointsEnabled() const;
42 Qt3DCore::QJoint* rootJoint() const;
43
44public Q_SLOTS:
45 void setSource(const QUrl &source);
46 void setCreateJointsEnabled(bool enabled);
47
48Q_SIGNALS:
49 void sourceChanged(const QUrl &source);
50 void statusChanged(Status status);
51 void createJointsEnabledChanged(bool createJointsEnabled);
52 void rootJointChanged(Qt3DCore::QJoint* rootJoint);
53
54protected:
55 explicit QSkeletonLoader(QSkeletonLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr);
56
57private:
58 Q_DECLARE_PRIVATE(QSkeletonLoader)
59 void setRootJoint(QJoint *rootJoint); // Needed for lifetime management of created joints
60};
61
62} // namespace Qt3DCore
63
64QT_END_NAMESPACE
65
66#endif // QT3DCORE_QSKELETONLOADER_H
67

source code of qt3d/src/core/transforms/qskeletonloader.h