After running into an issue packaging some code that included the open file dialog for windows platforms, I just want a clarification on what is or is not allowed in a final product. The EULA mentions “The Product may not contain any Engine Tools or any Marketplace Content Distributed in uncooked source format.”, and that Engine Tools refers to “any code and modules in either the Developer or Editor folders, including in object code format, whether statically or dynamically linked”.
This means that any calls to that code is not allowed? I’m currently using a bit of code (based on some code I found somewhere else on the forums) that is using IImageWrapper.h and IImageWrapperModule.h to dynamically load photographs for display. Does this mean I need to remove that and find another solution?
The code in question:
TArray<uint8> FileData;
IImageWrapperModule& ImageWrapperModule = FModuleManager::LoadModuleChecked<IImageWrapperModule>(FName("ImageWrapper"));
IImageWrapperPtr ImageWrapper;
if (path.EndsWith("png") || path.EndsWith("PNG"))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString("Using PNG loader"));
ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::PNG);
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString("Using JPEG loader"));
ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::JPEG);
}
UTexture2D* mytex;
//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString("Attempting to load file: ") + path);
if (FFileHelper::LoadFileToArray(FileData, *path, 0))
{
if (ImageWrapper.IsValid() && ImageWrapper->SetCompressed(FileData.GetData(), FileData.Num()))
{
const TArray<uint8>* UncompressedBGRA = NULL;
if (ImageWrapper->GetRaw(ERGBFormat::BGRA, 8, UncompressedBGRA))
{
mytex = UTexture2D::CreateTransient(ImageWrapper->GetWidth(), ImageWrapper->GetHeight(), PF_B8G8R8A8);
void* TextureData = mytex->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
FMemory::Memcpy(TextureData, UncompressedBGRA->GetData(), UncompressedBGRA->Num());
mytex->PlatformData->Mips[0].BulkData.Unlock();
mytex->UpdateResource();
USlateBrushAsset::StaticClass();
USlateBrushAsset* NewSlateBrushAsset = CastChecked<USlateBrushAsset>(StaticConstructObject(USlateBrushAsset::StaticClass(), GetTransientPackage(), NAME_None, EObjectFlags::RF_NoFlags));
NewSlateBrushAsset->Brush = mytex != NULL ? FSlateDynamicImageBrush(mytex, FVector2D(mytex->GetImportedSize()), NAME_None) : FSlateBrush();
NewSlateBrushAsset->Brush.ImageSize.X = mytex->PlatformData->SizeX;
NewSlateBrushAsset->Brush.ImageSize.Y = mytex->PlatformData->SizeY;
BrushLibrary.Add(path, NewSlateBrushAsset);
NewSlateBrushAsset->AddToRoot();
return NewSlateBrushAsset;
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Couldn't get texture data"));
}
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Problem with ImageWrapper"));
}
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("Failed to load file: ")+path);
}