diff options
Diffstat (limited to 'src/animation/backend/gltfimporter.cpp')
-rw-r--r-- | src/animation/backend/gltfimporter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/animation/backend/gltfimporter.cpp b/src/animation/backend/gltfimporter.cpp index e91dd5661..ed10c3e25 100644 --- a/src/animation/backend/gltfimporter.cpp +++ b/src/animation/backend/gltfimporter.cpp @@ -474,7 +474,9 @@ GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int ani return nameAndChannels; } - if (animationIndex == -1 && !animationName.isEmpty()) { + if (m_animations.size() == 1) { + animationIndex = 0; + } else if (animationIndex < 0 && !animationName.isEmpty()) { for (int i = 0; i < m_animations.size(); ++i) { if (m_animations[i].name == animationName) { animationIndex = i; @@ -483,7 +485,7 @@ GLTFImporter::AnimationNameAndChannels GLTFImporter::createAnimationData(int ani } } - if (animationIndex >= m_animations.size()) { + if (animationIndex < 0 || animationIndex >= m_animations.size()) { qCWarning(Jobs) << "Invalid animation index. Skipping."; return nameAndChannels; } |