diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-08-26 17:31:10 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-09-02 18:10:40 +0000 |
commit | 88d63171992f957ddbc6e46b094504ac2ea9aeba (patch) | |
tree | e94fe4d7c8c00ebafd1fbd9c5974a6170a7349b0 /src/animation/backend | |
parent | bbc14b772c323476a5cc41c1da06921f4e3dbf3e (diff) | |
download | qt3d-88d63171992f957ddbc6e46b094504ac2ea9aeba.tar.gz |
Extend generateClipFormatIndices() to handle jointIndex
AnimationClip now matches on name and jointIndex if jointIndex is valid.
Change-Id: Id2b3f41bf465a847048537583fc244743c0d026b
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation/backend')
-rw-r--r-- | src/animation/backend/animationclip.cpp | 6 | ||||
-rw-r--r-- | src/animation/backend/animationclip_p.h | 2 | ||||
-rw-r--r-- | src/animation/backend/animationutils.cpp | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/animation/backend/animationclip.cpp b/src/animation/backend/animationclip.cpp index 6a3c3c15b..0f90ff493 100644 --- a/src/animation/backend/animationclip.cpp +++ b/src/animation/backend/animationclip.cpp @@ -239,12 +239,14 @@ void AnimationClip::setDuration(float duration) notifyObservers(e); } -int AnimationClip::channelIndex(const QString &channelName) const +int AnimationClip::channelIndex(const QString &channelName, int jointIndex) const { const int channelCount = m_channels.size(); for (int i = 0; i < channelCount; ++i) { - if (m_channels[i].name == channelName) + if (m_channels[i].name == channelName + && (jointIndex == -1 || m_channels[i].jointIndex == jointIndex)) { return i; + } } return -1; } diff --git a/src/animation/backend/animationclip_p.h b/src/animation/backend/animationclip_p.h index 7ff79c01a..5e5d54ac8 100644 --- a/src/animation/backend/animationclip_p.h +++ b/src/animation/backend/animationclip_p.h @@ -80,7 +80,7 @@ public: void loadAnimation(); void setDuration(float duration); float duration() const { return m_duration; } - int channelIndex(const QString &channelName) const; + int channelIndex(const QString &channelName, int jointIndex) const; int channelCount() const { return m_channelComponentCount; } int channelComponentBaseIndex(int channelGroupIndex) const; diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index 8fe31bc24..f421a8025 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -577,7 +577,8 @@ ComponentIndices generateClipFormatIndices(const QVector<ChannelNameAndType> &ta for (int i = 0; i < channelCount; ++i) { // Find the index of the channel from the clip const ChannelNameAndType &targetChannel = targetChannels[i]; - const int clipChannelIndex = clip->channelIndex(targetChannel.name); + const int clipChannelIndex = clip->channelIndex(targetChannel.name, + targetChannel.jointIndex); // TODO: Ensure channel in the clip has enough components to map to the type. // Requires some improvements to the clip data structure first. |