Core/Animation: Fix RemoveSequence not shifting indices and deleting name
This commit is contained in:
parent
62a165126e
commit
d9ad489820
|
|
@ -27,9 +27,9 @@ namespace Nz
|
|||
|
||||
struct NAZARA_CORE_API AnimationParams : ResourceParameters
|
||||
{
|
||||
// La frame de fin à charger
|
||||
// Last frame to load (maximum)
|
||||
std::size_t endFrame = 0xFFFFFFFF;
|
||||
// La frame de début à charger
|
||||
// First frame to load
|
||||
std::size_t startFrame = 0;
|
||||
// Reference skeleton
|
||||
const Skeleton* skeleton = nullptr;
|
||||
|
|
|
|||
|
|
@ -272,10 +272,8 @@ namespace Nz
|
|||
return;
|
||||
}
|
||||
|
||||
auto sequenceIt = m_impl->sequences.begin();
|
||||
std::advance(sequenceIt, it->second);
|
||||
|
||||
m_impl->sequences.erase(sequenceIt);
|
||||
RemoveSequence(it->second);
|
||||
m_impl->sequenceMap.erase(it);
|
||||
}
|
||||
|
||||
void Animation::RemoveSequence(std::size_t index)
|
||||
|
|
@ -283,10 +281,14 @@ namespace Nz
|
|||
NazaraAssert(m_impl, "Animation not created");
|
||||
NazaraAssert(index < m_impl->sequences.size(), "Sequence index out of range");
|
||||
|
||||
auto it = m_impl->sequences.begin();
|
||||
std::advance(it, index);
|
||||
m_impl->sequences.erase(m_impl->sequences.begin() + index);
|
||||
|
||||
m_impl->sequences.erase(it);
|
||||
// Shift indices
|
||||
for (auto& it : m_impl->sequenceMap)
|
||||
{
|
||||
if (it.second > index)
|
||||
it.second--;
|
||||
}
|
||||
}
|
||||
|
||||
Animation& Animation::operator=(Animation&&) noexcept = default;
|
||||
|
|
|
|||
Loading…
Reference in New Issue