diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-08-27 16:30:43 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-10-03 09:01:45 +0000 |
commit | d6f4bf986c1363e4d553e0d5a624d371fcb87364 (patch) | |
tree | efc60ef879e36cc5ec3d7235b7e439f4f5061794 /src/animation/backend/animationutils.cpp | |
parent | 81877f4e463d9da86bc65feade213da5e7226915 (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/backend/animationutils.cpp')
-rw-r--r-- | src/animation/backend/animationutils.cpp | 9 |
1 files changed, 8 insertions, 1 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; |