summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-09-27 11:22:37 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-09-29 19:49:30 +0000
commitaee10edf33ccb1faf3179b23b44a2ad48bf4d0f0 (patch)
tree26a0b71d7b1aa0bd6df9efe26dd388641d404245
parenteee010020351c8aac94671dc6f34b17116f1f684 (diff)
Remove unused buildPropertyMappings() overload and tests
Everything goes through the other overload now. Change-Id: Id0c196a6967a9f83e47092ca1fc7f4ab4ebe9309 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
-rw-r--r--src/animation/backend/animationutils.cpp56
-rw-r--r--src/animation/backend/animationutils_p.h5
-rw-r--r--tests/auto/animation/animationutils/tst_animationutils.cpp73
3 files changed, 1 insertions, 133 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index 4d9fc4d30..7051fd4d4 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -308,62 +308,6 @@ QVector<Qt3DCore::QSceneChangePtr> preparePropertyChanges(Qt3DCore::QNodeId anim
return changes;
}
-//TODO: Remove this and use new implementation below for both the unblended
-// and blended animation cases.
-QVector<MappingData> buildPropertyMappings(Handler *handler,
- const AnimationClip *clip,
- const ChannelMapper *mapper)
-{
- QVector<MappingData> mappingDataVec;
- ChannelMappingManager *mappingManager = handler->channelMappingManager();
- const QVector<Channel> &channels = clip->channels();
-
- // Iterate over the mappings in the mapper object
- const auto mappingIds = mapper->mappingIds();
- for (const Qt3DCore::QNodeId mappingId : mappingIds) {
- // Get the mapping object
- ChannelMapping *mapping = mappingManager->lookupResource(mappingId);
- Q_ASSERT(mapping);
-
- // Populate the data we need, easy stuff first
- MappingData mappingData;
- mappingData.targetId = mapping->targetId();
- mappingData.propertyName = mapping->propertyName();
- mappingData.type = mapping->type();
-
- if (mappingData.type == static_cast<int>(QVariant::Invalid)) {
- qWarning() << "Unknown type for node id =" << mappingData.targetId
- << "and property =" << mapping->property();
- continue;
- }
-
- // Now the tricky part. Mapping the channel indices onto the property type.
- // Try to find a ChannelGroup with matching name
- const QString channelName = mapping->channelName();
- int channelGroupIndex = 0;
- bool foundMatch = false;
- for (const Channel &channel : channels) {
- if (channel.name == channelName) {
- foundMatch = true;
- const int channelBaseIndex = clip->channelComponentBaseIndex(channelGroupIndex);
-
- // Within this group, match channel names with index ordering
- mappingData.channelIndices = channelComponentsToIndices(channel, mappingData.type, channelBaseIndex);
-
- // Store the mapping data
- mappingDataVec.push_back(mappingData);
-
- if (foundMatch)
- break;
- }
-
- ++channelGroupIndex;
- }
- }
-
- return mappingDataVec;
-}
-
QVector<MappingData> buildPropertyMappings(const QVector<ChannelMapping*> &channelMappings,
const QVector<ChannelNameAndType> &channelNamesAndTypes,
const QVector<ComponentIndices> &channelComponentIndices)
diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h
index f8fcbafa7..c702ab5c4 100644
--- a/src/animation/backend/animationutils_p.h
+++ b/src/animation/backend/animationutils_p.h
@@ -157,11 +157,6 @@ QVector<Qt3DCore::QSceneChangePtr> preparePropertyChanges(Qt3DCore::QNodeId anim
bool finalFrame);
Q_AUTOTEST_EXPORT
-QVector<MappingData> buildPropertyMappings(Handler *handler,
- const AnimationClip *clip,
- const ChannelMapper *mapper);
-
-Q_AUTOTEST_EXPORT
QVector<MappingData> buildPropertyMappings(const QVector<ChannelMapping *> &channelMappings,
const QVector<ChannelNameAndType> &channelNamesAndTypes,
const QVector<ComponentIndices> &channelComponentIndices);
diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp
index e1c52ed10..36e954a85 100644
--- a/tests/auto/animation/animationutils/tst_animationutils.cpp
+++ b/tests/auto/animation/animationutils/tst_animationutils.cpp
@@ -241,77 +241,6 @@ public:
private Q_SLOTS:
void checkBuildPropertyMappings_data()
{
- QTest::addColumn<Handler *>("handler");
- QTest::addColumn<QVector<ChannelMapping *>>("channelMappings");
- QTest::addColumn<ChannelMapper *>("channelMapper");
- QTest::addColumn<AnimationClip *>("clip");
- QTest::addColumn<QVector<MappingData>>("expectedMappingData");
-
- auto handler = new Handler;
- auto channelMapping = createChannelMapping(handler,
- QLatin1String("Location"),
- Qt3DCore::QNodeId::createId(),
- QLatin1String("translation"),
- "translation",
- static_cast<int>(QVariant::Vector3D));
- QVector<ChannelMapping *> channelMappings;
- channelMappings.push_back(channelMapping);
-
- // ... a channel mapper...
- auto channelMapper = createChannelMapper(handler, QVector<Qt3DCore::QNodeId>() << channelMapping->peerId());
-
- // ...and an animation clip
- auto clip = createAnimationClipLoader(handler, QUrl("qrc:/clip1.json"));
-
- QVector<MappingData> mappingData;
- MappingData mapping;
- mapping.targetId = channelMapping->targetId();
- mapping.propertyName = channelMapping->propertyName(); // Location
- mapping.type = channelMapping->type();
- mapping.channelIndices = QVector<int>() << 0 << 1 << 2; // Location X, Y, Z
- mappingData.push_back(mapping);
-
- QTest::newRow("clip1.json") << handler
- << channelMappings
- << channelMapper
- << clip
- << mappingData;
- }
-
- void checkBuildPropertyMappings()
- {
- // GIVEN
- QFETCH(Handler *, handler);
- QFETCH(QVector<ChannelMapping *>, channelMappings);
- QFETCH(ChannelMapper *, channelMapper);
- QFETCH(AnimationClip *, clip);
- QFETCH(QVector<MappingData>, expectedMappingData);
-
- // WHEN
- // Build the mapping data for the above configuration
- QVector<MappingData> mappingData = buildPropertyMappings(handler, clip, channelMapper);
-
- // THEN
- QCOMPARE(mappingData.size(), expectedMappingData.size());
- for (int i = 0; i < mappingData.size(); ++i) {
- const auto mapping = mappingData[i];
- const auto expectedMapping = expectedMappingData[i];
-
- QCOMPARE(mapping.targetId, expectedMapping.targetId);
- QCOMPARE(mapping.propertyName, expectedMapping.propertyName);
- QCOMPARE(mapping.type, expectedMapping.type);
- QCOMPARE(mapping.channelIndices.size(), expectedMapping.channelIndices.size());
- for (int j = 0; j < mapping.channelIndices.size(); ++j) {
- QCOMPARE(mapping.channelIndices[j], expectedMapping.channelIndices[j]);
- }
- }
-
- // Cleanup
- delete handler;
- }
-
- void checkBuildPropertyMappings2_data()
- {
QTest::addColumn<QVector<ChannelMapping *>>("channelMappings");
QTest::addColumn<QVector<ChannelNameAndType>>("channelNamesAndTypes");
QTest::addColumn<QVector<ComponentIndices>>("channelComponentIndices");
@@ -477,7 +406,7 @@ private Q_SLOTS:
}
}
- void checkBuildPropertyMappings2()
+ void checkBuildPropertyMappings()
{
// GIVEN
QFETCH(QVector<ChannelMapping *>, channelMappings);