diff --git a/Source/Editor/Utilities/EditorUtilities.cpp b/Source/Editor/Utilities/EditorUtilities.cpp index 1b271d3d1..3111b1685 100644 --- a/Source/Editor/Utilities/EditorUtilities.cpp +++ b/Source/Editor/Utilities/EditorUtilities.cpp @@ -537,8 +537,6 @@ bool EditorUtilities::GetTexture(const Guid& textureId, TextureData& textureData AssetReference texture = Content::LoadAsync(textureId); if (texture) { - // Note: this could load texture asset data but using Texture API is easier - if (texture->WaitForLoaded()) { LOG(Warning, "Waiting for the texture to be loaded failed."); @@ -546,7 +544,6 @@ bool EditorUtilities::GetTexture(const Guid& textureId, TextureData& textureData else { // TODO: disable streaming for a texture or set max quality override - int32 waits = 1000; const auto targetResidency = texture->StreamingTexture()->GetMaxResidency(); ASSERT(targetResidency > 0); @@ -555,18 +552,17 @@ bool EditorUtilities::GetTexture(const Guid& textureId, TextureData& textureData Platform::Sleep(10); } - ASSERT(texture->IsLoaded()); - if (texture->GetTexture()->DownloadData(textureData)) - { - LOG(Warning, "Loading texture data failed."); - } - else - { + // Get texture data from GPU + if (!texture->GetTexture()->DownloadData(textureData)) return false; - } + + // Get texture data from asset + if (!texture->GetTextureData(textureData)) + return false; + + LOG(Warning, "Loading texture data failed."); } } - return true; }