From a71ee7eb3a3c2e3b2f4d9defa80505eb6196ed4c Mon Sep 17 00:00:00 2001 From: Chris Santora Date: Tue, 20 Jul 2021 13:43:24 -0700 Subject: [PATCH] Fixed the MaterialAssignmentId version converter to properly handle the default material assignment slot. Signed-off-by: santorac <55155825+santorac@users.noreply.github.com> --- .../Common/Code/Source/Material/MaterialAssignmentId.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialAssignmentId.cpp b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialAssignmentId.cpp index 5db6c4c15c..b8a03af6d1 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialAssignmentId.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialAssignmentId.cpp @@ -33,7 +33,14 @@ namespace AZ // No need to early-return, the object will still load successfully, it will just report more errors about the unrecognized element. } - classElement.AddElementWithData(context, "materialSlotStableId", materialAssetId.m_subId); + if (materialAssetId.IsValid()) + { + classElement.AddElementWithData(context, "materialSlotStableId", materialAssetId.m_subId); + } + else + { + classElement.AddElementWithData(context, "materialSlotStableId", RPI::ModelMaterialSlot::InvalidStableId); + } } return true;