From 343fc1999fad27a198710914c0ec141c2e90fa3f Mon Sep 17 00:00:00 2001 From: Tommy Walton <82672795+amzn-tommy@users.noreply.github.com> Date: Tue, 18 May 2021 10:52:41 -0700 Subject: [PATCH] ATOM-15346 : Morph target buffer only found on first Atom mesh (merge from 1.0->main) Instead of assuming the first submesh will always have a reference to the morph target buffer, search the submeshes to find the first one that does. --- .../EMotionFXAtom/Code/Source/ActorAsset.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp index 3594802dab..8dc7f9387c 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp @@ -500,7 +500,16 @@ namespace AZ skinnedMeshLod.SetIndexBufferAsset(mesh0.GetIndexBufferAssetView().GetBufferAsset()); skinnedMeshLod.SetStaticBufferAsset(mesh0.GetSemanticBufferAssetView(Name{ "UV" })->GetBufferAsset(), SkinnedMeshStaticVertexStreams::UV_0); - const RPI::BufferAssetView* morphBufferAssetView = mesh0.GetSemanticBufferAssetView(Name{ "MORPHTARGET_VERTEXDELTAS" }); + const RPI::BufferAssetView* morphBufferAssetView = nullptr; + for (const auto& mesh : modelLodAsset->GetMeshes()) + { + morphBufferAssetView = mesh.GetSemanticBufferAssetView(Name{ "MORPHTARGET_VERTEXDELTAS" }); + if (morphBufferAssetView) + { + break; + } + } + if (morphBufferAssetView) { ProcessMorphsForLod(actor, morphBufferAssetView->GetBufferAsset(), lodIndex, fullFileName, skinnedMeshLod);