summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-09-22 13:47:59 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-09-26 10:53:14 +0000
commit8f2ced29ceedacd2f23f19af1813a5f351b43eec (patch)
treeb41134d97a4bd3aabc597d60196806a5b6390bc8 /src
parenta56240c13ea84f678085131e7ee52c2402361a07 (diff)
Actually get matching clip indices for components
Rather than assuming they are in order. The blended clip animator code path now behaves the same as the simple QClipAnimator in that it can handle clips with channel components not in the expected order. We can now look at making both share a common code path. Change-Id: I61848e07b4f418ba9f4c56f56f4f49c9a5fbd588 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/animation/backend/animationutils.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index db49078cf..4d9fc4d30 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -502,7 +502,6 @@ ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &ta
ComponentIndices format;
format.resize(indexCount);
-
// Iterate through the target channels
const int channelCount = targetChannels.size();
auto formatIt = format.begin();
@@ -510,18 +509,18 @@ ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &ta
// Find the index of the channel from the clip
const ChannelNameAndType &targetChannel = targetChannels[i];
const int clipChannelIndex = clip->channelIndex(targetChannel.name);
-
- // TODO: Ensure channel in the clip has enough components to map to the type.
- // Requires some improvements to the clip data structure first.
- // TODO: I don't think we need the targetIndices, only the number of components
- // for each target channel. Check once blend tree is complete.
const int componentCount = targetIndices[i].size();
if (clipChannelIndex != -1) {
// Found a matching channel in the clip. Get the base channel
// component index and populate the format indices for this channel.
const int baseIndex = clip->channelComponentBaseIndex(clipChannelIndex);
- std::iota(formatIt, formatIt + componentCount, baseIndex);
+
+ // Within this group, match channel names with index ordering
+ const auto channelIndices = channelComponentsToIndices(clip->channels()[clipChannelIndex],
+ targetChannel.type,
+ baseIndex);
+ std::copy(channelIndices.begin(), channelIndices.end(), formatIt);
} else {
// No such channel in this clip. We'll use default values when