summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/channelmapping.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-03-28 08:31:42 +0100
committerPaul Lemire <paul.lemire@kdab.com>2019-04-03 13:00:08 +0000
commitf0f5a2de1da2e05e3587d2a6486687ebbe649339 (patch)
tree80cfacbe85d1a88571c169d38dc495b3df687937 /src/animation/backend/channelmapping.cpp
parent03234c59244ed77cb8eea5fca6b93741f40ca59d (diff)
Animations: handle variable length properties
For that we know determine the expected number of channel components for a given property in the frontend where we have access to both the type and the value rather than in the backend using the type only. Change-Id: I75aca20d43dd1b3db316c303af041acd557c07e4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/channelmapping.cpp')
-rw-r--r--src/animation/backend/channelmapping.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/animation/backend/channelmapping.cpp b/src/animation/backend/channelmapping.cpp
index ecae8bbae..d8572a074 100644
--- a/src/animation/backend/channelmapping.cpp
+++ b/src/animation/backend/channelmapping.cpp
@@ -55,6 +55,7 @@ ChannelMapping::ChannelMapping()
, m_targetId()
, m_property()
, m_type(static_cast<int>(QVariant::Invalid))
+ , m_componentCount(0)
, m_propertyName(nullptr)
, m_callback(nullptr)
, m_callbackFlags(0)
@@ -74,6 +75,7 @@ void ChannelMapping::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePt
m_targetId = data.targetId;
m_property = data.property;
m_type = data.type;
+ m_componentCount = data.componentCount;
m_propertyName = data.propertyName;
m_mappingType = ChannelMappingType;
break;
@@ -108,6 +110,7 @@ void ChannelMapping::cleanup()
m_property.clear();
m_type = static_cast<int>(QVariant::Invalid);
m_propertyName = nullptr;
+ m_componentCount = 0;
m_callback = nullptr;
m_callbackFlags = 0;
m_skeletonId = Qt3DCore::QNodeId();
@@ -128,6 +131,8 @@ void ChannelMapping::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_type = change->value().toInt();
else if (change->propertyName() == QByteArrayLiteral("propertyName"))
m_propertyName = static_cast<const char *>(const_cast<const void *>(change->value().value<void *>()));
+ else if (change->propertyName() == QByteArrayLiteral("componentCount"))
+ m_componentCount = change->value().toInt();
else if (change->propertyName() == QByteArrayLiteral("callback"))
m_callback = static_cast<QAnimationCallback *>(change->value().value<void *>());
else if (change->propertyName() == QByteArrayLiteral("callbackFlags"))