From 65bf6fae8f421d127d9e868c3f0dd48e2dc68201 Mon Sep 17 00:00:00 2001 From: linoal <1321932+linoal@users.noreply.github.com> Date: Sat, 26 Aug 2023 03:21:15 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=AE=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=81=AB=E5=A4=B1=E6=95=97=E3=81=97=E3=81=9F=E6=99=82?= =?UTF-8?q?=E3=80=81=E7=90=86=E7=94=B1=E3=81=A8=E5=85=B1=E3=81=AB=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=82=92=E6=AE=8B=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Private/PLATEAUTextureLoader.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/PLATEAURuntime/Private/PLATEAUTextureLoader.cpp b/Source/PLATEAURuntime/Private/PLATEAUTextureLoader.cpp index 502d6fc5..fe1043b2 100644 --- a/Source/PLATEAURuntime/Private/PLATEAUTextureLoader.cpp +++ b/Source/PLATEAURuntime/Private/PLATEAUTextureLoader.cpp @@ -21,23 +21,35 @@ namespace { bool TryLoadAndUncompressImageFile(const FString& TexturePath, TArray64& OutUncompressedData, int32& OutWidth, int32& OutHeight, EPixelFormat& OutPixelFormat) { if (TexturePath.IsEmpty()) + { + UE_LOG(LogTemp, Error, TEXT("Failed to load texture : path is empty.")); return false; + } IImageWrapperModule& ImageWrapperModule = FModuleManager::Get().LoadModuleChecked(TEXT("ImageWrapper")); TArray64 Buffer; if (!FFileHelper::LoadFileToArray(Buffer, *TexturePath)) { + UE_LOG(LogTemp, Error, TEXT("Failed to load texture file : %s"), *TexturePath); return false; } const EImageFormat Format = ImageWrapperModule.DetectImageFormat(Buffer.GetData(), Buffer.Num()); if (Format == EImageFormat::Invalid) + { + UE_LOG(LogTemp, Error, TEXT("Failed to load texture : Texture format is invalid : %s"), *TexturePath); return false; + } + const auto ImageWrapper = ImageWrapperModule.CreateImageWrapper(Format); if (!ImageWrapper->SetCompressed((void*)Buffer.GetData(), Buffer.Num())) + { + UE_LOG(LogTemp, Error, TEXT("Failed to load texture : Could not set compressed : %s"), *TexturePath); return false; + } + ERGBFormat RGBFormat; const int32 BitDepth = ImageWrapper->GetBitDepth(); @@ -51,12 +63,13 @@ namespace { OutPixelFormat = PF_B8G8R8A8; RGBFormat = ERGBFormat::BGRA; } else { - //UE_LOG(LogImageUtils, Warning, TEXT("Error creating texture. Bit depth is unsupported. (%d)"), BitDepth); + UE_LOG(LogTemp, Error, TEXT("Error creating texture. Bit depth is unsupported. (%d), %s"), BitDepth, *TexturePath); return false; } if(!ImageWrapper->GetRaw(RGBFormat, BitDepth, OutUncompressedData)) { + UE_LOG(LogTemp, Error, TEXT("Failed to load texture : Failed on GetRaw : %s"), *TexturePath); return false; }