summaryrefslogtreecommitdiffstats
path: root/src/quick3d/quick3danimation
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-01-29 09:43:53 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-01-29 09:39:53 +0000
commitddc85a1244c49fbe1873fa2c83e74dfb485d3598 (patch)
treef0d50b3ee02b23a530d3eb47d375368e95876204 /src/quick3d/quick3danimation
parent181d5e5ef4314833e23518aa1addf7e44eed6429 (diff)
Register QAbstractClipBlendNode and QLerpBlend to QML
Change-Id: Ifc3d4d8a66b763323a3ff6a3b840ae0e1a9f9c0d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick3d/quick3danimation')
-rw-r--r--src/quick3d/quick3danimation/items/items.pri6
-rw-r--r--src/quick3d/quick3danimation/items/quick3dabstractclipblendnode.cpp92
-rw-r--r--src/quick3d/quick3danimation/items/quick3dabstractclipblendnode_p.h89
3 files changed, 185 insertions, 2 deletions
diff --git a/src/quick3d/quick3danimation/items/items.pri b/src/quick3d/quick3danimation/items/items.pri
index c57a44de8..0c3511902 100644
--- a/src/quick3d/quick3danimation/items/items.pri
+++ b/src/quick3d/quick3danimation/items/items.pri
@@ -1,7 +1,9 @@
SOURCES += \
- $$PWD/quick3dchannelmapper.cpp
+ $$PWD/quick3dchannelmapper.cpp \
+ $$PWD/quick3dabstractclipblendnode.cpp
HEADERS += \
- $$PWD/quick3dchannelmapper_p.h
+ $$PWD/quick3dchannelmapper_p.h \
+ $$PWD/quick3dabstractclipblendnode_p.h
INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3danimation/items/quick3dabstractclipblendnode.cpp b/src/quick3d/quick3danimation/items/quick3dabstractclipblendnode.cpp
new file mode 100644
index 000000000..7a709c2d6
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/quick3dabstractclipblendnode.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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 "quick3dabstractclipblendnode_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+namespace Quick {
+
+Quick3DAbstractClipBlendNode::Quick3DAbstractClipBlendNode(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QAnimationClip> Quick3DAbstractClipBlendNode::clipList()
+{
+ return QQmlListProperty<QAnimationClip>(this, 0,
+ &Quick3DAbstractClipBlendNode::appendClip,
+ &Quick3DAbstractClipBlendNode::clipCount,
+ &Quick3DAbstractClipBlendNode::clipAt,
+ &Quick3DAbstractClipBlendNode::clearClips);
+}
+
+void Quick3DAbstractClipBlendNode::appendClip(QQmlListProperty<QAnimationClip> *list, QAnimationClip *clip)
+{
+ Quick3DAbstractClipBlendNode *extension = qobject_cast<Quick3DAbstractClipBlendNode *>(list->object);
+ extension->parentAbstractClipBlendNode()->addClip(clip);
+}
+
+QAnimationClip *Quick3DAbstractClipBlendNode::clipAt(QQmlListProperty<QAnimationClip> *list, int index)
+{
+ Quick3DAbstractClipBlendNode *extension = qobject_cast<Quick3DAbstractClipBlendNode *>(list->object);
+ return extension->parentAbstractClipBlendNode()->clips().at(index);
+}
+
+int Quick3DAbstractClipBlendNode::clipCount(QQmlListProperty<QAnimationClip> *list)
+{
+ Quick3DAbstractClipBlendNode *extension = qobject_cast<Quick3DAbstractClipBlendNode *>(list->object);
+ return extension->parentAbstractClipBlendNode()->clips().count();
+}
+
+void Quick3DAbstractClipBlendNode::clearClips(QQmlListProperty<QAnimationClip> *list)
+{
+ Quick3DAbstractClipBlendNode *extension = qobject_cast<Quick3DAbstractClipBlendNode *>(list->object);
+ const QVector<QAnimationClip *> clips = extension->parentAbstractClipBlendNode()->clips();
+ for (QAnimationClip *clip : clips)
+ extension->parentAbstractClipBlendNode()->removeClip(clip);
+}
+
+} // Quick
+} // Animation
+} // Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3danimation/items/quick3dabstractclipblendnode_p.h b/src/quick3d/quick3danimation/items/quick3dabstractclipblendnode_p.h
new file mode 100644
index 000000000..bfb1825a7
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/quick3dabstractclipblendnode_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 QT3DANIMATION_ANIMATION_QUICK3DABSTRACTCLIPBLENDNODE_P_H
+#define QT3DANIMATION_ANIMATION_QUICK3DABSTRACTCLIPBLENDNODE_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/private/qt3dquickanimation_global_p.h>
+#include <Qt3DAnimation/qabstractclipblendnode.h>
+#include <Qt3DAnimation/qanimationclip.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+namespace Quick {
+
+class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT Quick3DAbstractClipBlendNode : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QAnimationClip> clips READ clipList CONSTANT)
+
+public:
+ explicit Quick3DAbstractClipBlendNode(QObject *parent = nullptr);
+
+ inline QAbstractClipBlendNode *parentAbstractClipBlendNode() const { return qobject_cast<QAbstractClipBlendNode *>(parent()); }
+ QQmlListProperty<QAnimationClip> clipList();
+
+private:
+ static void appendClip(QQmlListProperty<QAnimationClip> *list, QAnimationClip *clip);
+ static QAnimationClip *clipAt(QQmlListProperty<QAnimationClip> *list, int index);
+ static int clipCount(QQmlListProperty<QAnimationClip> *list);
+ static void clearClips(QQmlListProperty<QAnimationClip> *list);
+};
+
+} // Quick
+} // Animation
+} // Qt3DAnimation
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_ANIMATION_QUICK3DABSTRACTCLIPBLENDNODE_P_H