From a892181432e1c29b21c3ca3896002ae7552bd7ea Mon Sep 17 00:00:00 2001 From: santorac <55155825+santorac@users.noreply.github.com> Date: Sat, 23 Oct 2021 00:02:31 -0700 Subject: [PATCH] Minor updates in response to code review feedback. Signed-off-by: santorac <55155825+santorac@users.noreply.github.com> --- .../Source/Material/EditorMaterialComponentInspector.cpp | 6 ++---- .../Code/Source/Material/MaterialComponentController.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp index 4ef96a13dd..9af3b41b12 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp @@ -352,7 +352,7 @@ namespace AZ m_editData.m_materialPropertyOverrideMap, m_entityId, &MaterialComponentRequestBus::Events::GetPropertyOverrides, m_materialAssignmentId); - // Apply any automatic property renames so that the material inspector will be property initialized with the right values + // Apply any automatic property renames so that the material inspector will be properly initialized with the right values // for properties that have new names. { AZStd::vector> renamedProperties; @@ -364,10 +364,8 @@ namespace AZ renamedProperties.emplace_back(propertyOverridePair.first, name); } } - for (auto& renamePair : renamedProperties) + for (const auto& [oldName, newName] : renamedProperties) { - const Name& oldName = renamePair.first; - const Name& newName = renamePair.second; m_editData.m_materialPropertyOverrideMap[newName] = m_editData.m_materialPropertyOverrideMap[oldName]; m_editData.m_materialPropertyOverrideMap.erase(oldName); } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialComponentController.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialComponentController.cpp index 335434758b..07082a87d5 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialComponentController.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/MaterialComponentController.cpp @@ -428,11 +428,9 @@ namespace AZ ++propertiesUpdated; } } - - for (auto& pair : renamedProperties) + + for (const auto& [oldName, newName] : renamedProperties) { - const Name& oldName = pair.first; - const Name& newName = pair.second; materialAssignment.m_propertyOverrides[newName] = materialAssignment.m_propertyOverrides[oldName]; materialAssignment.m_propertyOverrides.erase(oldName); }