Fix for ReadMesh error reporting

This commit is contained in:
hultonha
2021-04-16 17:30:06 +01:00
parent 102a0e5dc8
commit f552fc7ccd
5 changed files with 38 additions and 20 deletions
@@ -118,12 +118,15 @@ namespace WhiteBox
stream->Read(size, whiteBoxData.data());
auto whiteBoxMesh = WhiteBox::Api::CreateWhiteBoxMesh();
const bool success = WhiteBox::Api::ReadMesh(*whiteBoxMesh, whiteBoxData);
const auto result = WhiteBox::Api::ReadMesh(*whiteBoxMesh, whiteBoxData);
// if result is not 'Full', then whiteBoxMeshAsset could be empty which is most likely an error
// as no data was loaded from the asset, or it was not correctly read in stream->Read(..)
const auto success = result == Api::ReadResult::Full;
if (success)
{
whiteBoxMeshAsset->SetMesh(AZStd::move(whiteBoxMesh));
whiteBoxMeshAsset->SetWhiteBoxData(whiteBoxData);
whiteBoxMeshAsset->SetWhiteBoxData(AZStd::move(whiteBoxData));
}
return success ? AZ::Data::AssetHandler::LoadResult::LoadComplete