diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-01-14 14:46:54 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-01-20 19:37:51 +0000 |
commit | 7a67669d8ebcd5d76fa8f6e37bf4ffd208f01353 (patch) | |
tree | 77d808d4ff5080532dcf16959eceba89d077baa4 | |
parent | 0b14e6df4cbc6ffc3f82d996c95dac063f80609b (diff) |
Add skeleton quick3danimation library
Change-Id: If4a76a4ab9840545b2f6ae71929e815cf6a1adaf
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
-rw-r--r-- | src/quick3d/quick3danimation/qt3dquickanimation_global.cpp | 61 | ||||
-rw-r--r-- | src/quick3d/quick3danimation/qt3dquickanimation_global.h | 59 | ||||
-rw-r--r-- | src/quick3d/quick3danimation/qt3dquickanimation_global_p.h | 86 | ||||
-rw-r--r-- | src/quick3d/quick3danimation/qt3dquickanimationnodefactory.cpp | 76 | ||||
-rw-r--r-- | src/quick3d/quick3danimation/qt3dquickanimationnodefactory_p.h | 89 | ||||
-rw-r--r-- | src/quick3d/quick3danimation/quick3danimation.pro | 28 | ||||
-rw-r--r-- | src/src.pro | 5 | ||||
-rw-r--r-- | sync.profile | 1 |
8 files changed, 405 insertions, 0 deletions
diff --git a/src/quick3d/quick3danimation/qt3dquickanimation_global.cpp b/src/quick3d/quick3danimation/qt3dquickanimation_global.cpp new file mode 100644 index 000000000..45f80d9a6 --- /dev/null +++ b/src/quick3d/quick3danimation/qt3dquickanimation_global.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qt3dquickanimation_global_p.h" +#include "qt3dquickanimationnodefactory_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DAnimation { +namespace Quick { + +void Quick3DAnimation_initialize() +{ + Qt3DCore::QAbstractNodeFactory::registerNodeFactory(QuickAnimationNodeFactory::instance()); +} + +void Quick3DAnimation_registerType(const char *className, const char *quickName, int major, int minor) +{ + QuickAnimationNodeFactory::instance()->registerType(className, quickName, major, minor); +} + +} // namespace Quick +} // namespace Qt3DAnimation + +QT_END_NAMESPACE diff --git a/src/quick3d/quick3danimation/qt3dquickanimation_global.h b/src/quick3d/quick3danimation/qt3dquickanimation_global.h new file mode 100644 index 000000000..962321b2f --- /dev/null +++ b/src/quick3d/quick3danimation/qt3dquickanimation_global.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DQUICKANIMATION_GLOBAL_H +#define QT3DQUICKANIMATION_GLOBAL_H + +#include <Qt3DCore/qt3dcore_global.h> + +QT_BEGIN_NAMESPACE + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# if defined(QT_BUILD_3DQUICKANIMATION_LIB) +# define QT3DQUICKANIMATIONSHARED_EXPORT Q_DECL_EXPORT +# else +# define QT3DQUICKANIMATIONSHARED_EXPORT Q_DECL_IMPORT +# endif +#else +# define QT3DQUICKANIMATIONSHARED_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QT3DQUICKANIMATION_GLOBAL_H diff --git a/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h b/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h new file mode 100644 index 000000000..89d755931 --- /dev/null +++ b/src/quick3d/quick3danimation/qt3dquickanimation_global_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DQUICKANIMATION_GLOBAL_P_H +#define QT3DQUICKANIMATION_GLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <Qt3DQuickAnimation/qt3dquickanimation_global.h> +#include <QtQml/qqml.h> + +#define QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QT3DQUICKANIMATIONSHARED_EXPORT + +QT_BEGIN_NAMESPACE + +namespace Qt3DAnimation { +namespace Quick { + +QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT void Quick3DAnimation_initialize(); +QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT void Quick3DAnimation_registerType(const char *className, const char *quickName, int major, int minor); + +template<class T, class E> void registerExtendedType(const char *className, const char *quickName, + const char *uri, int major, int minor, const char *name) +{ + qmlRegisterExtendedType<T, E>(uri, major, minor, name); + Quick3DAnimation_registerType(className, quickName, major, minor); +} + +template<class T> void registerType(const char *className, const char *quickName, + const char *uri, int major, int minor, const char *name) +{ + qmlRegisterType<T>(uri, major, minor, name); + Quick3DAnimation_registerType(className, quickName, major, minor); +} + +} // Quick +} // Qt3DAnimation + +QT_END_NAMESPACE + +#endif // QT3DQUICKANIMATION_GLOBAL_P_H diff --git a/src/quick3d/quick3danimation/qt3dquickanimationnodefactory.cpp b/src/quick3d/quick3danimation/qt3dquickanimationnodefactory.cpp new file mode 100644 index 000000000..4fd7d30cc --- /dev/null +++ b/src/quick3d/quick3danimation/qt3dquickanimationnodefactory.cpp @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qt3dquickanimationnodefactory_p.h" +#include <private/qqmlmetatype_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DAnimation { + +Q_GLOBAL_STATIC(QuickAnimationNodeFactory, quick_animation_node_factory) + +QuickAnimationNodeFactory *QuickAnimationNodeFactory::instance() +{ + return quick_animation_node_factory(); +} + +void QuickAnimationNodeFactory::registerType(const char *className, const char *quickName, int major, int minor) +{ + m_types.insert(className, Type(quickName, major, minor)); +} + +Qt3DCore::QNode *QuickAnimationNodeFactory::createNode(const char *type) +{ + if (!m_types.contains(type)) + return nullptr; + + Type &typeInfo(m_types[type]); + + if (!typeInfo.resolved) { + typeInfo.resolved = true; + typeInfo.t = QQmlMetaType::qmlType(QString::fromLatin1(typeInfo.quickName), typeInfo.version.first, typeInfo.version.second); + } + + return typeInfo.t ? qobject_cast<Qt3DCore::QNode *>(typeInfo.t->create()) : nullptr; +} + +} // namespace Qt3DAnimation + +QT_END_NAMESPACE diff --git a/src/quick3d/quick3danimation/qt3dquickanimationnodefactory_p.h b/src/quick3d/quick3danimation/qt3dquickanimationnodefactory_p.h new file mode 100644 index 000000000..5c7a828ed --- /dev/null +++ b/src/quick3d/quick3danimation/qt3dquickanimationnodefactory_p.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUICKANIMATIONERNODEFACTORY_H +#define QUICKANIMATIONERNODEFACTORY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qabstractnodefactory_p.h> +#include <QtCore/qhash.h> + +QT_BEGIN_NAMESPACE + +class QQmlType; + +namespace Qt3DAnimation { + +class QuickAnimationNodeFactory : public Qt3DCore::QAbstractNodeFactory +{ +public: + Qt3DCore::QNode *createNode(const char *type) Q_DECL_OVERRIDE; + + void registerType(const char *className, const char *quickName, int major, int minor); + + static QuickAnimationNodeFactory *instance(); + +private: + struct Type { + Type() : t(nullptr), resolved(false) { } + Type(const char *quickName, int major, int minor) + : quickName(quickName), version(major, minor), t(nullptr), resolved(false) { } + QByteArray quickName; + QPair<int, int> version; + QQmlType *t; + bool resolved; + }; + QHash<QByteArray, Type> m_types; +}; + +} // namespace Qt3DAnimation + +QT_END_NAMESPACE + +#endif // QUICKANIMATIONERNODEFACTORY_H diff --git a/src/quick3d/quick3danimation/quick3danimation.pro b/src/quick3d/quick3danimation/quick3danimation.pro new file mode 100644 index 000000000..213ba564b --- /dev/null +++ b/src/quick3d/quick3danimation/quick3danimation.pro @@ -0,0 +1,28 @@ +TARGET = Qt3DQuickAnimation +MODULE = 3dquickanimation + +QT += core core-private qml qml-private 3dcore 3drender 3danimation 3dquick 3dquick-private 3dcore-private 3drender-private +CONFIG -= precompile_header + +# Qt3D is free of Q_FOREACH - make sure it stays that way: +DEFINES += QT_NO_FOREACH + +gcov { + CONFIG += static + QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage + QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage +} + +SOURCES += \ + qt3dquickanimation_global.cpp \ + qt3dquickanimationnodefactory.cpp + +HEADERS += \ + qt3dquickanimationnodefactory_p.h \ + qt3dquickanimation_global_p.h \ + qt3dquickanimation_global.h + +# otherwise mingw headers do not declare common functions like ::strcasecmp +win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x + +load(qt_module) diff --git a/src/src.pro b/src/src.pro index 4cd1c1277..8498d6293 100644 --- a/src/src.pro +++ b/src/src.pro @@ -36,6 +36,10 @@ src_quick3d_input.subdir = $$PWD/quick3d/quick3dinput src_quick3d_input.target = sub-quick3d-input src_quick3d_input.depends = src_input src_quick3d_core +src_quick3d_animation.subdir = $$PWD/quick3d/quick3danimation +src_quick3d_animation.target = sub-quick3d-animation +src_quick3d_animation.depends = src_animation src_quick3d_core src_quick3d_render + src_quick3d_extras.subdir = $$PWD/quick3d/quick3dextras src_quick3d_extras.target = sub-quick3d-extras src_quick3d_extras.depends = src_render src_logic src_input src_quick3d_core @@ -81,6 +85,7 @@ SUBDIRS += \ src_quick3d_core_imports \ src_quick3d_render \ src_quick3d_input \ + src_quick3d_animation \ src_quick3d_extras \ src_quick3d_imports_render \ src_quick3d_imports_scene3d \ diff --git a/sync.profile b/sync.profile index 4179a5972..27b98417e 100644 --- a/sync.profile +++ b/sync.profile @@ -5,6 +5,7 @@ "Qt3DQuickRender" => "$basedir/src/quick3d/quick3drender", "Qt3DInput" => "$basedir/src/input", "Qt3DAnimation" => "$basedir/src/animation", + "Qt3DQuickAnimation" => "$basedir/src/quick3d/quick3danimation", "Qt3DQuickInput" => "$basedir/src/quick3d/quick3dinput", "Qt3DLogic" => "$basedir/src/logic", "Qt3DExtras" => "$basedir/src/extras", |