summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-08-24 16:19:12 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-09-02 18:10:25 +0000
commit1f67c7a92a0080e4f2cbd0d387d3447521571b77 (patch)
tree693850348c1cb0bd29bc9ba2fdb6aebef86b074d /src/animation
parentc8f28a88e73ff5e9f612cd55eec40196bd68d8cd (diff)
Mirror QSkeletonMapping properties to ChannelMapping backend node
Change-Id: Idb6aa59ae65351d8aa8bca31dd68a350bcb46973 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/channelmapping.cpp9
-rw-r--r--src/animation/backend/channelmapping_p.h9
-rw-r--r--src/animation/frontend/qskeletonmapping_p.h1
3 files changed, 18 insertions, 1 deletions
diff --git a/src/animation/backend/channelmapping.cpp b/src/animation/backend/channelmapping.cpp
index 79abe11f5..bf5be8383 100644
--- a/src/animation/backend/channelmapping.cpp
+++ b/src/animation/backend/channelmapping.cpp
@@ -37,6 +37,7 @@
#include "channelmapping_p.h"
#include <Qt3DAnimation/qchannelmapping.h>
#include <Qt3DAnimation/private/qchannelmapping_p.h>
+#include <Qt3DAnimation/private/qskeletonmapping_p.h>
#include <Qt3DAnimation/private/animationlogging_p.h>
#include <Qt3DAnimation/private/qchannelmappingcreatedchange_p.h>
#include <Qt3DCore/qpropertyupdatedchange.h>
@@ -55,6 +56,7 @@ ChannelMapping::ChannelMapping()
, m_propertyName(nullptr)
, m_callback(nullptr)
, m_callbackFlags(0)
+ , m_skeletonId()
{
}
@@ -76,7 +78,9 @@ void ChannelMapping::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePt
}
case QChannelMappingCreatedChangeBase::SkeletonMapping: {
- // TODO: Add support for QSkeletonChannelMapping
+ const auto typedChange = qSharedPointerCast<QChannelMappingCreatedChange<QSkeletonMappingData>>(change);
+ const auto &data = typedChange->data;
+ m_skeletonId = data.skeletonId;
break;
}
@@ -97,6 +101,7 @@ void ChannelMapping::cleanup()
m_propertyName = nullptr;
m_callback = nullptr;
m_callbackFlags = 0;
+ m_skeletonId = Qt3DCore::QNodeId();
}
void ChannelMapping::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
@@ -118,6 +123,8 @@ void ChannelMapping::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_callback = static_cast<QAnimationCallback *>(change->value().value<void *>());
else if (change->propertyName() == QByteArrayLiteral("callbackFlags"))
m_callbackFlags = QAnimationCallback::Flags(change->value().toInt());
+ else if (change->propertyName() == QByteArrayLiteral("skeleton"))
+ m_skeletonId = change->value().value<Qt3DCore::QNodeId>();
break;
}
diff --git a/src/animation/backend/channelmapping_p.h b/src/animation/backend/channelmapping_p.h
index f2dde0c74..1be89cc88 100644
--- a/src/animation/backend/channelmapping_p.h
+++ b/src/animation/backend/channelmapping_p.h
@@ -93,16 +93,25 @@ public:
void setCallbackFlags(QAnimationCallback::Flags flags) { m_callbackFlags = flags; }
QAnimationCallback::Flags callbackFlags() const { return m_callbackFlags; }
+ void setSkeletonId(Qt3DCore::QNodeId skeletonId) { m_skeletonId = skeletonId; }
+ Qt3DCore::QNodeId skeletonId() const { return m_skeletonId; }
+
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+ // Properties from QChannelMapping
QString m_channelName;
Qt3DCore::QNodeId m_targetId;
QString m_property;
int m_type;
const char *m_propertyName;
+
+ // TODO: Properties from QCallbackMapping
QAnimationCallback *m_callback;
QAnimationCallback::Flags m_callbackFlags;
+
+ // Properties from QSkeletonMapping
+ Qt3DCore::QNodeId m_skeletonId;
};
} // namespace Animation
diff --git a/src/animation/frontend/qskeletonmapping_p.h b/src/animation/frontend/qskeletonmapping_p.h
index 19f9c70ae..af8382b23 100644
--- a/src/animation/frontend/qskeletonmapping_p.h
+++ b/src/animation/frontend/qskeletonmapping_p.h
@@ -52,6 +52,7 @@
//
#include <Qt3DAnimation//private/qabstractchannelmapping_p.h>
+#include <Qt3DAnimation/qskeletonmapping.h>
QT_BEGIN_NAMESPACE