Simplified the code around MaterialAsset::ApplyVersionUpdates()

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
santorac
2021-10-21 00:07:36 -07:00
parent 1633ced656
commit 46061eb302
10 changed files with 119 additions and 36 deletions
@@ -210,13 +210,15 @@ namespace AZ
bool changesWereApplied = false;
for (int i = 0; i < aznumeric_cast<int>(m_materialTypeAsset->GetVersion() - m_materialTypeVersion); ++i)
for (const MaterialVersionUpdate& versionUpdate : m_materialTypeAsset->GetMaterialVersionUpdateList())
{
const auto& versionUpdate = m_materialTypeAsset->GetMaterialVersionUpdate(m_materialTypeVersion + i + 1);
if (versionUpdate.ApplyVersionUpdates(*this))
if (m_materialTypeVersion < versionUpdate.GetVersion())
{
changesWereApplied = true;
if (versionUpdate.ApplyVersionUpdates(*this))
{
changesWereApplied = true;
m_materialTypeVersion = versionUpdate.GetVersion();
}
}
}