diff options
-rw-r--r-- | src/animation/backend/animationutils.cpp | 2 | ||||
-rw-r--r-- | src/animation/frontend/qchannelmapping.cpp | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index c0287e9f2..c12ad99f7 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -61,6 +61,7 @@ int componentsForType(int type) { int componentCount = 1; switch (type) { + case QMetaType::Float: case QVariant::Double: componentCount = 1; break; @@ -237,6 +238,7 @@ QVector<Qt3DCore::QSceneChangePtr> preparePropertyChanges(Qt3DCore::QNodeId anim // Build the new value from the channel/fcurve evaluation results QVariant v; switch (mappingData.type) { + case QMetaType::Float: case QVariant::Double: { v = QVariant::fromValue(channelResults[mappingData.channelIndices[0]]); break; diff --git a/src/animation/frontend/qchannelmapping.cpp b/src/animation/frontend/qchannelmapping.cpp index b3d3816a0..90504d942 100644 --- a/src/animation/frontend/qchannelmapping.cpp +++ b/src/animation/frontend/qchannelmapping.cpp @@ -74,6 +74,15 @@ void QChannelMappingPrivate::updatePropertyNameAndType() QMetaProperty mp = mo->property(propertyIndex); propertyName = mp.name(); type = mp.userType(); + if (type == QMetaType::QVariant) { + QVariant currentValue = m_target->property(mp.name()); + if (!currentValue.isNull()) { + type = currentValue.userType(); + } else { + qWarning("QChannelMapping: Attempted to target QVariant property with no value set." + "Set a value first in order to be able to determine the type."); + } + } } if (m_type != type) { |