Minor code cleanup.

Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
monroegm-disable-blank-issue-2
santorac 4 years ago
parent 1b9526a1e2
commit 2657620846

@ -32,8 +32,7 @@ namespace AZ
{ {
Empty, //! No image was actually requested, the path was empty Empty, //! No image was actually requested, the path was empty
Found, //! The requested asset was found Found, //! The requested asset was found
Missing, //! The requested asset was not found, and a placeholder asset was used instead Missing //! The requested asset was not found, and a placeholder asset was used instead
MissingNoFallback //! The requested asset was not found, and a placeholder asset was not found either
}; };
//! Finds an ImageAsset referenced by a material file (or a placeholder) //! Finds an ImageAsset referenced by a material file (or a placeholder)

@ -43,6 +43,11 @@ namespace AZ
if (!imageAssetId.IsSuccess()) if (!imageAssetId.IsSuccess())
{ {
// When the AssetId cannot be found, we don't want to outright fail, because the runtime has mechanisms for displaying fallback textures which gives the
// user a better recovery workflow. On the other hand we can't just provide an empty/invalid Asset<ImageAsset> because that would be interpreted as simply
// no value was present and result in using no texture, and this would amount to a silent failure.
// So we use a randomly generated (well except for the "BADA55E7" bit ;) UUID which the runtime and tools will interpret as a missing asset and represent
// it as such.
static const Uuid InvalidAssetPlaceholderId = "{BADA55E7-1A1D-4940-B655-9D08679BD62F}"; static const Uuid InvalidAssetPlaceholderId = "{BADA55E7-1A1D-4940-B655-9D08679BD62F}";
imageAsset = Data::Asset<ImageAsset>{InvalidAssetPlaceholderId, azrtti_typeid<StreamingImageAsset>(), imageFilePath}; imageAsset = Data::Asset<ImageAsset>{InvalidAssetPlaceholderId, azrtti_typeid<StreamingImageAsset>(), imageFilePath};
return GetImageAssetResult::Missing; return GetImageAssetResult::Missing;

Loading…
Cancel
Save