summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-01-23 10:56:01 +0000
committerSean Harmer <sean.harmer@kdab.com>2017-01-27 12:34:51 +0000
commitc1e425920331325f889053b921e66ea572234784 (patch)
tree75c205d117776a55d24be851fee0e40af4bfe3fe /src
parent0070276340e15872362858928d6858ae31e07f7e (diff)
Add API to map animation channels to properties
Change-Id: I98aecf101eb052979f7a2e98c8bfcf899f27fb02 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/animation/backend/backend.pri8
-rw-r--r--src/animation/backend/channelmapper.cpp99
-rw-r--r--src/animation/backend/channelmapper_p.h88
-rw-r--r--src/animation/backend/channelmapping.cpp96
-rw-r--r--src/animation/backend/channelmapping_p.h90
-rw-r--r--src/animation/backend/handle_types_p.h4
-rw-r--r--src/animation/backend/handler.cpp10
-rw-r--r--src/animation/backend/handler_p.h12
-rw-r--r--src/animation/backend/managers_p.h24
-rw-r--r--src/animation/frontend/frontend.pri10
-rw-r--r--src/animation/frontend/qanimationaspect.cpp8
-rw-r--r--src/animation/frontend/qchannelmapper.cpp122
-rw-r--r--src/animation/frontend/qchannelmapper.h74
-rw-r--r--src/animation/frontend/qchannelmapper_p.h79
-rw-r--r--src/animation/frontend/qchannelmapping.cpp137
-rw-r--r--src/animation/frontend/qchannelmapping.h86
-rw-r--r--src/animation/frontend/qchannelmapping_p.h81
-rw-r--r--src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp5
-rw-r--r--src/quick3d/quick3danimation/items/items.pri7
-rw-r--r--src/quick3d/quick3danimation/items/quick3dchannelmapper.cpp92
-rw-r--r--src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h88
-rw-r--r--src/quick3d/quick3danimation/quick3danimation.pro2
22 files changed, 1217 insertions, 5 deletions
diff --git a/src/animation/backend/backend.pri b/src/animation/backend/backend.pri
index 86b2b9e15..1c1ccdb58 100644
--- a/src/animation/backend/backend.pri
+++ b/src/animation/backend/backend.pri
@@ -15,7 +15,9 @@ HEADERS += \
$$PWD/blendedclipanimator_p.h \
$$PWD/conductedclipanimator_p.h \
$$PWD/backendnode_p.h \
- $$PWD/loadanimationclipjob_p.h
+ $$PWD/loadanimationclipjob_p.h \
+ $$PWD/channelmapping_p.h \
+ $$PWD/channelmapper_p.h
SOURCES += \
$$PWD/animationclip.cpp \
@@ -27,4 +29,6 @@ SOURCES += \
$$PWD/blendedclipanimator.cpp \
$$PWD/conductedclipanimator.cpp \
$$PWD/backendnode.cpp \
- $$PWD/loadanimationclipjob.cpp
+ $$PWD/loadanimationclipjob.cpp \
+ $$PWD/channelmapping.cpp \
+ $$PWD/channelmapper.cpp
diff --git a/src/animation/backend/channelmapper.cpp b/src/animation/backend/channelmapper.cpp
new file mode 100644
index 000000000..0e5555096
--- /dev/null
+++ b/src/animation/backend/channelmapper.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "channelmapper_p.h"
+#include <Qt3DAnimation/qchannelmapper.h>
+#include <Qt3DAnimation/private/qchannelmapper_p.h>
+#include <Qt3DAnimation/private/animationlogging_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+
+ChannelMapper::ChannelMapper()
+ : BackendNode(ReadOnly)
+ , m_mappingIds()
+{
+}
+
+void ChannelMapper::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QChannelMapperData>>(change);
+ const auto &data = typedChange->data;
+ m_mappingIds = data.mappingIds;
+}
+
+void ChannelMapper::cleanup()
+{
+ setEnabled(false);
+ m_mappingIds.clear();
+}
+
+void ChannelMapper::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ switch (e->type()) {
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("mappings")) {
+ m_mappingIds.push_back(change->addedNodeId());
+ setDirty(Handler::ChannelMappingsDirty);
+ }
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("mappings")) {
+ m_mappingIds.removeOne(change->removedNodeId());
+ setDirty(Handler::ChannelMappingsDirty);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+} // namespace Animation
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/animation/backend/channelmapper_p.h b/src/animation/backend/channelmapper_p.h
new file mode 100644
index 000000000..66654d56d
--- /dev/null
+++ b/src/animation/backend/channelmapper_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_ANIMATION_CHANNELMAPPER_P_H
+#define QT3DANIMATION_ANIMATION_CHANNELMAPPER_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 <Qt3DAnimation/private/backendnode_p.h>
+#include <Qt3DAnimation/private/fcurve_p.h>
+
+#include <Qt3DCore/qnodeid.h>
+
+#include <QtCore/qvector.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+
+class Handler;
+
+class Q_AUTOTEST_EXPORT ChannelMapper : public BackendNode
+{
+public:
+ ChannelMapper();
+
+ void cleanup();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ QVector<Qt3DCore::QNodeId> mappingIds() const { return m_mappingIds; }
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_mappingIds;
+};
+
+} // namespace Animation
+} // namespace Qt3DAnimation
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_ANIMATION_CHANNELMAPPER_P_H
diff --git a/src/animation/backend/channelmapping.cpp b/src/animation/backend/channelmapping.cpp
new file mode 100644
index 000000000..f28ab17ae
--- /dev/null
+++ b/src/animation/backend/channelmapping.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "channelmapping_p.h"
+#include <Qt3DAnimation/qchannelmapping.h>
+#include <Qt3DAnimation/private/qchannelmapping_p.h>
+#include <Qt3DAnimation/private/animationlogging_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+
+ChannelMapping::ChannelMapping()
+ : BackendNode(ReadOnly)
+ , m_channelName()
+ , m_targetId()
+ , m_property()
+{
+}
+
+void ChannelMapping::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QChannelMappingData>>(change);
+ const auto &data = typedChange->data;
+ m_channelName = data.channelName;
+ m_targetId = data.targetId;
+ m_property = data.property;
+}
+
+void ChannelMapping::cleanup()
+{
+ setEnabled(false);
+ m_channelName.clear();
+ m_targetId = Qt3DCore::QNodeId();
+ m_property.clear();
+}
+
+void ChannelMapping::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ switch (e->type()) {
+ case Qt3DCore::PropertyUpdated: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("channelName"))
+ m_channelName = change->value().toString();
+ else if (change->propertyName() == QByteArrayLiteral("target"))
+ m_targetId = change->value().value<Qt3DCore::QNodeId>();
+ else if (change->propertyName() == QByteArrayLiteral("property"))
+ m_property = change->value().toString();
+ break;
+ }
+
+ default:
+ break;
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+} // namespace Animation
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/animation/backend/channelmapping_p.h b/src/animation/backend/channelmapping_p.h
new file mode 100644
index 000000000..958998520
--- /dev/null
+++ b/src/animation/backend/channelmapping_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_ANIMATION_CHANNELMAPPING_P_H
+#define QT3DANIMATION_ANIMATION_CHANNELMAPPING_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 <Qt3DAnimation/private/backendnode_p.h>
+#include <Qt3DAnimation/private/fcurve_p.h>
+
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+
+class Handler;
+
+class Q_AUTOTEST_EXPORT ChannelMapping : public BackendNode
+{
+public:
+ ChannelMapping();
+
+ void cleanup();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ QString channelName() const { return m_channelName; }
+ Qt3DCore::QNodeId targetId() const { return m_targetId; }
+ QString property() const { return m_property; }
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QString m_channelName;
+ Qt3DCore::QNodeId m_targetId;
+ QString m_property;
+};
+
+} // namespace Animation
+} // namespace Qt3DAnimation
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_ANIMATION_CHANNELMAPPING_P_H
diff --git a/src/animation/backend/handle_types_p.h b/src/animation/backend/handle_types_p.h
index 5147a984a..f2c6774d2 100644
--- a/src/animation/backend/handle_types_p.h
+++ b/src/animation/backend/handle_types_p.h
@@ -62,11 +62,15 @@ class AnimationClip;
class ClipAnimator;
class BlendedClipAnimator;
class ConductedClipAnimator;
+class ChannelMapping;
+class ChannelMapper;
typedef Qt3DCore::QHandle<AnimationClip, 16> HAnimationClip;
typedef Qt3DCore::QHandle<ClipAnimator, 16> HClipAnimator;
typedef Qt3DCore::QHandle<BlendedClipAnimator, 12> HBlendedClipAnimator;
typedef Qt3DCore::QHandle<ConductedClipAnimator, 8> HConductedClipAnimator;
+typedef Qt3DCore::QHandle<ChannelMapping, 16> HChannelMapping;
+typedef Qt3DCore::QHandle<ChannelMapper, 16> HChannelMapper;
} // namespace Animation
} // namespace Qt3DAnimation
diff --git a/src/animation/backend/handler.cpp b/src/animation/backend/handler.cpp
index da0df67d1..f1b25ef4d 100644
--- a/src/animation/backend/handler.cpp
+++ b/src/animation/backend/handler.cpp
@@ -49,6 +49,8 @@ Handler::Handler()
, m_clipAnimatorManager(new ClipAnimatorManager)
, m_blendedClipAnimatorManager(new BlendedClipAnimatorManager)
, m_conductedClipAnimatorManager(new ConductedClipAnimatorManager)
+ , m_channelMappingManager(new ChannelMappingManager)
+ , m_channelMapperManager(new ChannelMapperManager)
, m_loadAnimationClipJob(new LoadAnimationClipJob)
{
m_loadAnimationClipJob->setHandler(this);
@@ -66,6 +68,12 @@ void Handler::setDirty(DirtyFlag flag, Qt3DCore::QNodeId nodeId)
m_dirtyAnimationClips.push_back(handle);
break;
}
+
+ case ChannelMappingsDirty: {
+ const auto handle = m_channelMapperManager->lookupHandle(nodeId);
+ m_dirtyChannelMappers.push_back(handle);
+ break;
+ }
}
}
@@ -105,6 +113,8 @@ QVector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time)
m_dirtyAnimationClips.clear();
}
+ // TODO: Queue up a job to update the channel mapping table
+
return jobs;
}
diff --git a/src/animation/backend/handler_p.h b/src/animation/backend/handler_p.h
index abcea1f7e..bcf7d4b77 100644
--- a/src/animation/backend/handler_p.h
+++ b/src/animation/backend/handler_p.h
@@ -71,6 +71,10 @@ class BlendedClipAnimator;
class BlendedClipAnimatorManager;
class ConductedClipAnimator;
class ConductedClipAnimatorManager;
+class ChannelMapping;
+class ChannelMappingManager;
+class ChannelMapper;
+class ChannelMapperManager;
class LoadAnimationClipJob;
@@ -81,7 +85,8 @@ public:
~Handler();
enum DirtyFlag {
- AnimationClipDirty
+ AnimationClipDirty,
+ ChannelMappingsDirty
};
void setDirty(DirtyFlag flag, Qt3DCore::QNodeId nodeId);
@@ -92,6 +97,8 @@ public:
ClipAnimatorManager *clipAnimatorManager() const Q_DECL_NOTHROW { return m_clipAnimatorManager.data(); }
BlendedClipAnimatorManager *blendedClipAnimatorManager() const Q_DECL_NOTHROW { return m_blendedClipAnimatorManager.data(); }
ConductedClipAnimatorManager *conductedClipAnimatorManager() const Q_DECL_NOTHROW { return m_conductedClipAnimatorManager.data(); }
+ ChannelMappingManager *channelMappingManager() const Q_DECL_NOTHROW { return m_channelMappingManager.data(); }
+ ChannelMapperManager *channelMapperManager() const Q_DECL_NOTHROW { return m_channelMapperManager.data(); }
QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time);
@@ -100,8 +107,11 @@ private:
QScopedPointer<ClipAnimatorManager> m_clipAnimatorManager;
QScopedPointer<BlendedClipAnimatorManager> m_blendedClipAnimatorManager;
QScopedPointer<ConductedClipAnimatorManager> m_conductedClipAnimatorManager;
+ QScopedPointer<ChannelMappingManager> m_channelMappingManager;
+ QScopedPointer<ChannelMapperManager> m_channelMapperManager;
QVector<HAnimationClip> m_dirtyAnimationClips;
+ QVector<HChannelMapper> m_dirtyChannelMappers;
QVector<HClipAnimator> m_runningClipAnimators;
QSharedPointer<LoadAnimationClipJob> m_loadAnimationClipJob;
diff --git a/src/animation/backend/managers_p.h b/src/animation/backend/managers_p.h
index 5bcc9a52e..eb34ee5cd 100644
--- a/src/animation/backend/managers_p.h
+++ b/src/animation/backend/managers_p.h
@@ -57,6 +57,8 @@
#include <Qt3DAnimation/private/blendedclipanimator_p.h>
#include <Qt3DAnimation/private/clipanimator_p.h>
#include <Qt3DAnimation/private/conductedclipanimator_p.h>
+#include <Qt3DAnimation/private/channelmapping_p.h>
+#include <Qt3DAnimation/private/channelmapper_p.h>
#include <Qt3DCore/private/qresourcemanager_p.h>
QT_BEGIN_NAMESPACE
@@ -104,6 +106,26 @@ public:
ConductedClipAnimatorManager() {}
};
+class ChannelMappingManager : public Qt3DCore::QResourceManager<
+ ChannelMapping,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy>
+{
+public:
+ ChannelMappingManager() {}
+};
+
+class ChannelMapperManager : public Qt3DCore::QResourceManager<
+ ChannelMapper,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy>
+{
+public:
+ ChannelMapperManager() {}
+};
+
} // namespace Animation
} // namespace Qt3DAnimation
@@ -111,6 +133,8 @@ Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::AnimationClip, Q_REQUIRES_CLEA
Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::ClipAnimator, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::BlendedClipAnimator, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::ConductedClipAnimator, Q_REQUIRES_CLEANUP)
+Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::ChannelMapping, Q_REQUIRES_CLEANUP)
+Q_DECLARE_RESOURCE_INFO(Qt3DAnimation::Animation::ChannelMapper, Q_REQUIRES_CLEANUP)
QT_END_NAMESPACE
diff --git a/src/animation/frontend/frontend.pri b/src/animation/frontend/frontend.pri
index bbffd1c9a..d9187f1f0 100644
--- a/src/animation/frontend/frontend.pri
+++ b/src/animation/frontend/frontend.pri
@@ -10,7 +10,11 @@ HEADERS += \
$$PWD/qblendedclipanimator.h \
$$PWD/qblendedclipanimator_p.h \
$$PWD/qconductedclipanimator.h \
- $$PWD/qconductedclipanimator_p.h
+ $$PWD/qconductedclipanimator_p.h \
+ $$PWD/qchannelmapper.h \
+ $$PWD/qchannelmapper_p.h \
+ $$PWD/qchannelmapping.h \
+ $$PWD/qchannelmapping_p.h
SOURCES += \
$$PWD/qanimationaspect.cpp \
@@ -18,6 +22,8 @@ SOURCES += \
$$PWD/qabstractclipblendnode.cpp \
$$PWD/qclipanimator.cpp \
$$PWD/qblendedclipanimator.cpp \
- $$PWD/qconductedclipanimator.cpp
+ $$PWD/qconductedclipanimator.cpp \
+ $$PWD/qchannelmapper.cpp \
+ $$PWD/qchannelmapping.cpp
INCLUDEPATH += $$PWD
diff --git a/src/animation/frontend/qanimationaspect.cpp b/src/animation/frontend/qanimationaspect.cpp
index abc3b2b2b..82c633220 100644
--- a/src/animation/frontend/qanimationaspect.cpp
+++ b/src/animation/frontend/qanimationaspect.cpp
@@ -43,6 +43,8 @@
#include <Qt3DAnimation/qblendedclipanimator.h>
#include <Qt3DAnimation/qclipanimator.h>
#include <Qt3DAnimation/qconductedclipanimator.h>
+#include <Qt3DAnimation/qchannelmapping.h>
+#include <Qt3DAnimation/qchannelmapper.h>
#include <Qt3DAnimation/private/handler_p.h>
#include <Qt3DAnimation/private/managers_p.h>
#include <Qt3DAnimation/private/nodefunctor_p.h>
@@ -97,6 +99,12 @@ QAnimationAspect::QAnimationAspect(QAnimationAspectPrivate &dd, QObject *parent)
registerBackendType<QConductedClipAnimator>(
QSharedPointer<Animation::NodeFunctor<Animation::ConductedClipAnimator, Animation::ConductedClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->conductedClipAnimatorManager()));
+ registerBackendType<QChannelMapping>(
+ QSharedPointer<Animation::NodeFunctor<Animation::ChannelMapping, Animation::ChannelMappingManager>>::create(d->m_handler.data(),
+ d->m_handler->channelMappingManager()));
+ registerBackendType<QChannelMapper>(
+ QSharedPointer<Animation::NodeFunctor<Animation::ChannelMapper, Animation::ChannelMapperManager>>::create(d->m_handler.data(),
+ d->m_handler->channelMapperManager()));
}
/*! \internal */
diff --git a/src/animation/frontend/qchannelmapper.cpp b/src/animation/frontend/qchannelmapper.cpp
new file mode 100644
index 000000000..ee2e54267
--- /dev/null
+++ b/src/animation/frontend/qchannelmapper.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qchannelmapper.h"
+#include "qchannelmapper_p.h"
+#include <Qt3DAnimation/qchannelmapping.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+
+QChannelMapperPrivate::QChannelMapperPrivate()
+ : Qt3DCore::QNodePrivate()
+{
+}
+
+QChannelMapper::QChannelMapper(Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(*new QChannelMapperPrivate, parent)
+{
+}
+
+QChannelMapper::QChannelMapper(QChannelMapperPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(dd, parent)
+{
+}
+
+QChannelMapper::~QChannelMapper()
+{
+}
+
+void QChannelMapper::addMapping(QChannelMapping *mapping)
+{
+ Q_ASSERT(mapping);
+ Q_D(QChannelMapper);
+ if (!d->m_mappings.contains(mapping)) {
+ d->m_mappings.append(mapping);
+
+ // Ensures proper bookkeeping
+ d->registerDestructionHelper(mapping, &QChannelMapper::removeMapping, d->m_mappings);
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!mapping->parent())
+ mapping->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), mapping);
+ change->setPropertyName("mappings");
+ d->notifyObservers(change);
+ }
+ }
+}
+
+void QChannelMapper::removeMapping(QChannelMapping *mapping)
+{
+ Q_ASSERT(mapping);
+ Q_D(QChannelMapper);
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), mapping);
+ change->setPropertyName("mappings");
+ d->notifyObservers(change);
+ }
+ d->m_mappings.removeOne(mapping);
+ // Remove bookkeeping connection
+ d->unregisterDestructionHelper(mapping);
+}
+
+QVector<QChannelMapping *> QChannelMapper::mappings() const
+{
+ Q_D(const QChannelMapper);
+ return d->m_mappings;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QChannelMapper::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QChannelMapperData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QChannelMapper);
+ data.mappingIds = Qt3DCore::qIdsForNodes(d->m_mappings);
+ return creationChange;
+}
+
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/animation/frontend/qchannelmapper.h b/src/animation/frontend/qchannelmapper.h
new file mode 100644
index 000000000..399d92d5d
--- /dev/null
+++ b/src/animation/frontend/qchannelmapper.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_QCHANNELMAPPER_H
+#define QT3DANIMATION_QCHANNELMAPPER_H
+
+#include <Qt3DAnimation/qt3danimation_global.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+
+class QChannelMapperPrivate;
+class QChannelMapping;
+
+class QT3DANIMATIONSHARED_EXPORT QChannelMapper : public Qt3DCore::QNode
+{
+ Q_OBJECT
+
+public:
+ explicit QChannelMapper(Qt3DCore::QNode *parent = nullptr);
+ ~QChannelMapper();
+
+ void addMapping(QChannelMapping *mapping);
+ void removeMapping(QChannelMapping *mapping);
+ QVector<QChannelMapping *> mappings() const;
+
+protected:
+ QChannelMapper(QChannelMapperPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QChannelMapper)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_QCHANNELMAPPER_H
diff --git a/src/animation/frontend/qchannelmapper_p.h b/src/animation/frontend/qchannelmapper_p.h
new file mode 100644
index 000000000..d05ea3277
--- /dev/null
+++ b/src/animation/frontend/qchannelmapper_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_QCHANNELMAPPER_P_H
+#define QT3DANIMATION_QCHANNELMAPPER_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 <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+
+class QChannelMapping;
+
+class QChannelMapperPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QChannelMapperPrivate();
+
+ Q_DECLARE_PUBLIC(QChannelMapper)
+
+ QVector<QChannelMapping *> m_mappings;
+};
+
+struct QChannelMapperData
+{
+ QVector<Qt3DCore::QNodeId> mappingIds;
+};
+
+} // namespace Qt3DAnimation
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_QCHANNELMAPPER_P_H
diff --git a/src/animation/frontend/qchannelmapping.cpp b/src/animation/frontend/qchannelmapping.cpp
new file mode 100644
index 000000000..a920ad6e0
--- /dev/null
+++ b/src/animation/frontend/qchannelmapping.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qchannelmapping.h"
+#include "qchannelmapping_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+
+QChannelMappingPrivate::QChannelMappingPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_channelName()
+ , m_target(nullptr)
+ , m_property()
+{
+}
+
+QChannelMapping::QChannelMapping(Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(*new QChannelMappingPrivate, parent)
+{
+}
+
+QChannelMapping::QChannelMapping(QChannelMappingPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(dd, parent)
+{
+}
+
+QChannelMapping::~QChannelMapping()
+{
+}
+
+QString QChannelMapping::channelName() const
+{
+ Q_D(const QChannelMapping);
+ return d->m_channelName;
+}
+
+Qt3DCore::QNode *QChannelMapping::target() const
+{
+ Q_D(const QChannelMapping);
+ return d->m_target;
+}
+
+QString QChannelMapping::property() const
+{
+ Q_D(const QChannelMapping);
+ return d->m_property;
+}
+
+void QChannelMapping::setChannelName(const QString &channelName)
+{
+ Q_D(QChannelMapping);
+ if (d->m_channelName == channelName)
+ return;
+
+ d->m_channelName = channelName;
+ emit channelNameChanged(channelName);
+}
+
+void QChannelMapping::setTarget(Qt3DCore::QNode *target)
+{
+ Q_D(QChannelMapping);
+ if (d->m_target == target)
+ return;
+
+ if (d->m_target)
+ d->unregisterDestructionHelper(d->m_target);
+
+ if (target && !target->parent())
+ target->setParent(this);
+ d->m_target = target;
+
+ // Ensures proper bookkeeping
+ if (d->m_target)
+ d->registerDestructionHelper(d->m_target, &QChannelMapping::setTarget, d->m_target);
+
+ emit targetChanged(target);
+}
+
+void QChannelMapping::setProperty(const QString &property)
+{
+ Q_D(QChannelMapping);
+ if (d->m_property == property)
+ return;
+
+ d->m_property = property;
+ emit propertyChanged(property);
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QChannelMapping::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QChannelMappingData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QChannelMapping);
+ data.channelName = d->m_channelName;
+ data.targetId = Qt3DCore::qIdForNode(d->m_target);
+ data.property = d->m_property;
+ return creationChange;
+}
+
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/animation/frontend/qchannelmapping.h b/src/animation/frontend/qchannelmapping.h
new file mode 100644
index 000000000..0c4ca07f4
--- /dev/null
+++ b/src/animation/frontend/qchannelmapping.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_QCHANNELMAPPING_H
+#define QT3DANIMATION_QCHANNELMAPPING_H
+
+#include <Qt3DAnimation/qt3danimation_global.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+
+class QChannelMappingPrivate;
+
+class QT3DANIMATIONSHARED_EXPORT QChannelMapping : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QString channelName READ channelName WRITE setChannelName NOTIFY channelNameChanged)
+ Q_PROPERTY(Qt3DCore::QNode *target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
+
+public:
+ explicit QChannelMapping(Qt3DCore::QNode *parent = nullptr);
+ ~QChannelMapping();
+
+ QString channelName() const;
+ Qt3DCore::QNode *target() const;
+ QString property() const;
+
+public Q_SLOTS:
+ void setChannelName(const QString &channelName);
+ void setTarget(Qt3DCore::QNode *target);
+ void setProperty(const QString &property);
+
+Q_SIGNALS:
+ void channelNameChanged(QString channelName);
+ void targetChanged(Qt3DCore::QNode *target);
+ void propertyChanged(QString property);
+
+protected:
+ QChannelMapping(QChannelMappingPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QChannelMapping)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_QCHANNELMAPPING_H
diff --git a/src/animation/frontend/qchannelmapping_p.h b/src/animation/frontend/qchannelmapping_p.h
new file mode 100644
index 000000000..736805375
--- /dev/null
+++ b/src/animation/frontend/qchannelmapping_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_QCHANNELMAPPING_P_H
+#define QT3DANIMATION_QCHANNELMAPPING_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 <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+
+class QChannelMappingPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QChannelMappingPrivate();
+
+ Q_DECLARE_PUBLIC(QChannelMapping)
+
+ QString m_channelName;
+ Qt3DCore::QNode *m_target;
+ QString m_property;
+};
+
+struct QChannelMappingData
+{
+ QString channelName;
+ Qt3DCore::QNodeId targetId;
+ QString property;
+};
+
+} // namespace Qt3DAnimation
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_QCHANNELMAPPING_P_H
diff --git a/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp b/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp
index efaee2509..537c49b21 100644
--- a/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp
+++ b/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp
@@ -42,7 +42,9 @@
#include <Qt3DAnimation/qblendedclipanimator.h>
#include <Qt3DAnimation/qclipanimator.h>
#include <Qt3DAnimation/qconductedclipanimator.h>
+#include <Qt3DAnimation/qchannelmapping.h>
#include <Qt3DQuickAnimation/private/qt3dquickanimation_global_p.h>
+#include <Qt3DQuickAnimation/private/quick3dchannelmapper_p.h>
QT_BEGIN_NAMESPACE
@@ -55,6 +57,9 @@ void Qt3DQuick3DAnimationPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DAnimation::QClipAnimator>(uri, 2, 2, "ClipAnimator");
qmlRegisterType<Qt3DAnimation::QBlendedClipAnimator>(uri, 2, 2, "BlendedClipAnimator");
qmlRegisterType<Qt3DAnimation::QConductedClipAnimator>(uri, 2, 2, "ConductedClipAnimator");
+ qmlRegisterType<Qt3DAnimation::QChannelMapping>(uri, 2, 2, "ChannelMapping");
+ qmlRegisterExtendedType<Qt3DAnimation::QChannelMapper,
+ Qt3DAnimation::Animation::Quick::Quick3DChannelMapper>(uri, 2, 2, "ChannelMapper");
}
QT_END_NAMESPACE
diff --git a/src/quick3d/quick3danimation/items/items.pri b/src/quick3d/quick3danimation/items/items.pri
new file mode 100644
index 000000000..c57a44de8
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/items.pri
@@ -0,0 +1,7 @@
+SOURCES += \
+ $$PWD/quick3dchannelmapper.cpp
+
+HEADERS += \
+ $$PWD/quick3dchannelmapper_p.h
+
+INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3danimation/items/quick3dchannelmapper.cpp b/src/quick3d/quick3danimation/items/quick3dchannelmapper.cpp
new file mode 100644
index 000000000..55eb04be1
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/quick3dchannelmapper.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 "quick3dchannelmapper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+namespace Quick {
+
+Quick3DChannelMapper::Quick3DChannelMapper(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QChannelMapping> Quick3DChannelMapper::qmlMappings()
+{
+ return QQmlListProperty<QChannelMapping>(this, 0,
+ &Quick3DChannelMapper::appendMapping,
+ &Quick3DChannelMapper::mappingCount,
+ &Quick3DChannelMapper::mappingAt,
+ &Quick3DChannelMapper::clearMappings);
+}
+
+void Quick3DChannelMapper::appendMapping(QQmlListProperty<QChannelMapping> *list, QChannelMapping *mapping)
+{
+ Quick3DChannelMapper *extension = qobject_cast<Quick3DChannelMapper *>(list->object);
+ extension->parentMapper()->addMapping(mapping);
+}
+
+QChannelMapping *Quick3DChannelMapper::mappingAt(QQmlListProperty<QChannelMapping> *list, int index)
+{
+ Quick3DChannelMapper *extension = qobject_cast<Quick3DChannelMapper *>(list->object);
+ return extension->parentMapper()->mappings().at(index);
+}
+
+int Quick3DChannelMapper::mappingCount(QQmlListProperty<QChannelMapping> *list)
+{
+ Quick3DChannelMapper *extension = qobject_cast<Quick3DChannelMapper *>(list->object);
+ return extension->parentMapper()->mappings().count();
+}
+
+void Quick3DChannelMapper::clearMappings(QQmlListProperty<QChannelMapping> *list)
+{
+ Quick3DChannelMapper *extension = qobject_cast<Quick3DChannelMapper *>(list->object);
+ const auto mappings = extension->parentMapper()->mappings();
+ for (QChannelMapping *mapping : mappings)
+ extension->parentMapper()->removeMapping(mapping);
+}
+
+} // namespace Quick
+} // namespace Animation
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h b/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h
new file mode 100644
index 000000000..fddaae72d
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/quick3dchannelmapper_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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_QUICK_QUICK3DBASICANIMATION_H
+#define QT3DANIMATION_ANIMATION_QUICK_QUICK3DBASICANIMATION_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/qchannelmapping.h>
+#include <Qt3DAnimation/qchannelmapper.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Animation {
+namespace Quick {
+
+class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT Quick3DChannelMapper : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QChannelMapping> mappings READ qmlMappings CONSTANT)
+public:
+ explicit Quick3DChannelMapper(QObject *parent = nullptr);
+
+ inline QChannelMapper *parentMapper() const { return qobject_cast<QChannelMapper *>(parent()); }
+ QQmlListProperty<QChannelMapping> qmlMappings();
+
+private:
+ static void appendMapping(QQmlListProperty<QChannelMapping> *list, QChannelMapping *mapping);
+ static QChannelMapping *mappingAt(QQmlListProperty<QChannelMapping> *list, int index);
+ static int mappingCount(QQmlListProperty<QChannelMapping> *list);
+ static void clearMappings(QQmlListProperty<QChannelMapping> *list);
+};
+
+} // namespace Quick
+} // namespace Animation
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_ANIMATION_QUICK_QUICK3DBASICANIMATION_H
diff --git a/src/quick3d/quick3danimation/quick3danimation.pro b/src/quick3d/quick3danimation/quick3danimation.pro
index 213ba564b..770cbcdb1 100644
--- a/src/quick3d/quick3danimation/quick3danimation.pro
+++ b/src/quick3d/quick3danimation/quick3danimation.pro
@@ -25,4 +25,6 @@ HEADERS += \
# otherwise mingw headers do not declare common functions like ::strcasecmp
win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
+include(./items/items.pri)
+
load(qt_module)