Fixed an issue with Actors where the material slot IDs were incorrect, and caused the displayed slot labels to be all "<unknown>" (and likely other issues).

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
This commit is contained in:
Chris Santora
2021-07-20 12:16:12 -07:00
committed by santorac
parent 28671c8546
commit 3daf3f7d7a
4 changed files with 12 additions and 14 deletions
@@ -503,16 +503,18 @@ namespace AZ
const AZStd::vector< SkinnedSubMeshProperties>& subMeshProperties = inputLod.GetSubMeshProperties();
for (const SkinnedSubMeshProperties& submesh : subMeshProperties)
{
AZ_Error("AtomActorInstance", submesh.m_material, "Actor does not have a valid default material in lod %d", lodIndex);
if (submesh.m_material)
Data::Asset<RPI::MaterialAsset> materialAsset = submesh.m_materialSlot.m_defaultMaterialAsset;
AZ_Error("AtomActorInstance", materialAsset, "Actor does not have a valid default material in lod %d", lodIndex);
if (materialAsset)
{
if (!submesh.m_material->IsReady())
if (!materialAsset->IsReady())
{
// Start listening for the material's OnAssetReady event.
// AtomActorInstance::Create is called on the main thread, so there should be no need to synchronize with the OnAssetReady event handler
// since those events will also come from the main thread
m_waitForMaterialLoadIds.insert(submesh.m_material->GetId());
Data::AssetBus::MultiHandler::BusConnect(submesh.m_material->GetId());
m_waitForMaterialLoadIds.insert(materialAsset->GetId());
Data::AssetBus::MultiHandler::BusConnect(materialAsset->GetId());
}
}
}