| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qt3dquick3dcoreplugin.h" |
| 41 | |
| 42 | #include <Qt3DCore/qarmature.h> |
| 43 | #include <Qt3DCore/qabstractskeleton.h> |
| 44 | #include <Qt3DCore/qskeletonloader.h> |
| 45 | #include <Qt3DCore/qtransform.h> |
| 46 | #include <Qt3DCore/qjoint.h> |
| 47 | #include <QtCore/qvariantanimation.h> |
| 48 | |
| 49 | #include <Qt3DQuick/private/quick3dnodev9_p.h> |
| 50 | #include <Qt3DQuick/private/quick3dentity_p.h> |
| 51 | #include <Qt3DQuick/private/quick3dentityloader_p.h> |
| 52 | #include <Qt3DQuick/private/quick3dnodeinstantiator_p.h> |
| 53 | #include <Qt3DQuick/private/quick3djoint_p.h> |
| 54 | #include <Qt3DQuick/private/qquaternionanimation_p.h> |
| 55 | #include <Qt3DQuick/private/qt3dquick_global_p.h> |
| 56 | |
| 57 | #include <QtQml/qqml.h> |
| 58 | |
| 59 | QT_BEGIN_NAMESPACE |
| 60 | |
| 61 | void Qt3DQuick3DCorePlugin::registerTypes(const char *uri) |
| 62 | { |
| 63 | Qt3DCore::Quick::Quick3D_initialize(); |
| 64 | |
| 65 | qmlRegisterUncreatableType<Qt3DCore::QComponent>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Component3D" , reason: QLatin1String("" )); |
| 66 | |
| 67 | Qt3DCore::Quick::registerExtendedType<Qt3DCore::QEntity, Qt3DCore::Quick::Quick3DEntity>(className: "QEntity" , quickName: "Qt3D.Core/Entity" , uri, major: 2, minor: 0, name: "Entity" ); |
| 68 | qmlRegisterType<Qt3DCore::Quick::Quick3DEntityLoader>(uri, versionMajor: 2, versionMinor: 0, qmlName: "EntityLoader" ); |
| 69 | qmlRegisterType<Qt3DCore::Quick::Quick3DEntityLoader, 12>(uri, versionMajor: 2, versionMinor: 12, qmlName: "EntityLoader" ); |
| 70 | qmlRegisterType<Qt3DCore::Quick::Quick3DNodeInstantiator>(uri, versionMajor: 2, versionMinor: 0, qmlName: "NodeInstantiator" ); |
| 71 | qmlRegisterType<Qt3DCore::QTransform>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Transform" ); |
| 72 | qmlRegisterType<Qt3DCore::QTransform, 14>(uri, versionMajor: 2, versionMinor: 14, qmlName: "Transform" ); |
| 73 | qmlRegisterType<Qt3DCore::QArmature>(uri, versionMajor: 2, versionMinor: 10, qmlName: "Armature" ); |
| 74 | qmlRegisterUncreatableType<Qt3DCore::QAbstractSkeleton>(uri, versionMajor: 2, versionMinor: 10, qmlName: "AbstractSkeleton" , QStringLiteral("AbstractSkeleton is an abstract base class" )); |
| 75 | qmlRegisterType<Qt3DCore::QSkeletonLoader>(uri, versionMajor: 2, versionMinor: 10, qmlName: "SkeletonLoader" ); |
| 76 | |
| 77 | qmlRegisterType<Qt3DCore::Quick::QQuaternionAnimation>(uri, versionMajor: 2, versionMinor: 0, qmlName: "QuaternionAnimation" ); |
| 78 | qRegisterAnimationInterpolator<QQuaternion>(func: Qt3DCore::Quick::q_quaternionInterpolator); |
| 79 | |
| 80 | // Ideally we want to make Node an uncreatable type |
| 81 | // We would need qmlRegisterUncreatableExtendedType for that |
| 82 | qmlRegisterExtendedUncreatableType<Qt3DCore::QNode, Qt3DCore::Quick::Quick3DNode>(uri, versionMajor: 2, versionMinor: 0, qmlName: "Node" , QStringLiteral("Node is a base class" )); |
| 83 | qmlRegisterExtendedUncreatableType<Qt3DCore::QNode, Qt3DCore::Quick::Quick3DNodeV9, 9>(uri, versionMajor: 2, versionMinor: 9, qmlName: "Node" , QStringLiteral("Node is a base class" )); |
| 84 | |
| 85 | Qt3DCore::Quick::registerExtendedType<Qt3DCore::QJoint, Qt3DCore::Quick::Quick3DJoint>(className: "QJoint" , quickName: "Qt3D.Core/Joint" , uri, major: 2, minor: 10, name: "Joint" ); |
| 86 | |
| 87 | // Auto-increment the import to stay in sync with ALL future Qt minor versions |
| 88 | qmlRegisterModule(uri, versionMajor: 2, QT_VERSION_MINOR); |
| 89 | } |
| 90 | |
| 91 | Qt3DQuick3DCorePlugin::~Qt3DQuick3DCorePlugin() |
| 92 | { |
| 93 | Qt3DCore::Quick::Quick3D_uninitialize(); |
| 94 | } |
| 95 | |
| 96 | QT_END_NAMESPACE |
| 97 | |