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