summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-08-27 16:30:43 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-10-03 09:01:45 +0000
commitd6f4bf986c1363e4d553e0d5a624d371fcb87364 (patch)
treeefc60ef879e36cc5ec3d7235b7e439f4f5061794 /src/animation
parent81877f4e463d9da86bc65feade213da5e7226915 (diff)
Clear channel component indices for those not present in animation
This allows us to only create MappingData objects for those channels for which we actually have animation data. There is no point, and even more importantly, it is dangerous to try to do so as we will overwrite the existing data of the target properties. TODO: Fix this on 5.9 and forward merge to 5.10 Change-Id: Idb9d2fdef0e3297c0f35ad8c4af01b777321674d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/animationutils.cpp9
-rw-r--r--src/animation/backend/animationutils_p.h2
-rw-r--r--src/animation/backend/findrunningclipanimatorsjob.cpp2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index a1224f69a..d05d96f38 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -460,6 +460,12 @@ QVector<MappingData> buildPropertyMappings(const QVector<ChannelMapping*> &chann
// Try to find matching channel name and type
const int index = channelNamesAndTypes.indexOf(nameAndType);
+
+ // Do we have any animation data for this channel? If not, don't bother
+ // adding a mapping for it.
+ if (channelComponentIndices[index].isEmpty())
+ continue;
+
if (index != -1) {
// We got one!
mappingData.propertyName = channelNameToPropertyName[nameAndType.name];
@@ -613,7 +619,7 @@ QVector<Qt3DCore::QNodeId> gatherValueNodesToEvaluate(Handler *handler,
}
ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &targetChannels,
- const QVector<ComponentIndices> &targetIndices,
+ QVector<ComponentIndices> &targetIndices,
const AnimationClip *clip)
{
Q_ASSERT(targetChannels.size() == targetIndices.size());
@@ -650,6 +656,7 @@ ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &ta
// No such channel in this clip. We'll use default values when
// mapping from the clip to the formatted clip results.
std::fill(formatIt, formatIt + componentCount, -1);
+ targetIndices[i].clear();
}
formatIt += componentCount;
diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h
index a225e9311..86c9fdd52 100644
--- a/src/animation/backend/animationutils_p.h
+++ b/src/animation/backend/animationutils_p.h
@@ -227,7 +227,7 @@ QVector<Qt3DCore::QNodeId> gatherValueNodesToEvaluate(Handler *handler,
Q_AUTOTEST_EXPORT
ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &targetChannels,
- const QVector<ComponentIndices> &targetIndices,
+ QVector<ComponentIndices> &targetIndices,
const AnimationClip *clip);
Q_AUTOTEST_EXPORT
diff --git a/src/animation/backend/findrunningclipanimatorsjob.cpp b/src/animation/backend/findrunningclipanimatorsjob.cpp
index 41454004d..16b84359e 100644
--- a/src/animation/backend/findrunningclipanimatorsjob.cpp
+++ b/src/animation/backend/findrunningclipanimatorsjob.cpp
@@ -81,7 +81,7 @@ void FindRunningClipAnimatorsJob::run()
const QVector<ChannelNameAndType> channelNamesAndTypes
= buildRequiredChannelsAndTypes(m_handler, mapper);
- const QVector<ComponentIndices> channelComponentIndices
+ QVector<ComponentIndices> channelComponentIndices
= assignChannelComponentIndices(channelNamesAndTypes);
const AnimationClip *clip = m_handler->animationClipLoaderManager()->lookupResource(clipAnimator->clipId());