| 95 | } |
| 96 | |
| 97 | bool EditorUtilities::GetTexture(const Guid& textureId, TextureData& textureData) |
| 98 | { |
| 99 | AssetReference<Texture> texture = Content::LoadAsync<Texture>(textureId); |
| 100 | if (texture) |
| 101 | { |
| 102 | if (texture->WaitForLoaded()) |
| 103 | { |
| 104 | LOG(Warning, "Waiting for the texture to be loaded failed."); |
| 105 | } |
| 106 | else |
| 107 | { |
| 108 | const bool useGPU = texture->IsVirtual(); |
| 109 | if (useGPU) |
| 110 | { |
| 111 | int32 waits = 1000; |
| 112 | const auto targetResidency = texture->StreamingTexture()->GetMaxResidency(); |
| 113 | ASSERT(targetResidency > 0); |
| 114 | while (targetResidency != texture->StreamingTexture()->GetCurrentResidency() && waits-- > 0) |
| 115 | { |
| 116 | Platform::Sleep(10); |
| 117 | } |
| 118 | |
| 119 | // Get texture data from GPU |
| 120 | if (!texture->GetTexture()->DownloadData(textureData)) |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | // Get texture data from asset |
| 125 | if (!texture->GetTextureData(textureData)) |
| 126 | return false; |
| 127 | |
| 128 | LOG(Warning, "Loading texture data failed."); |
| 129 | } |
| 130 | } |
| 131 | return true; |
| 132 | } |
| 133 | |
| 134 | bool EditorUtilities::ExportApplicationImage(const Guid& iconId, int32 width, int32 height, PixelFormat format, const String& path, ApplicationImageType type) |
| 135 | { |
no test coverage detected