From 74efeafbfa0bee0cd821424c99d9a0e8e298be47 Mon Sep 17 00:00:00 2001 From: odinn1984 Date: Mon, 13 Nov 2023 01:58:49 +0200 Subject: [PATCH] feat: make this compile on ue5.0.3 --- BlockadeLabsSkyboxAi/Config/FilterPlugin.ini | 8 ++++++ .../Private/CustomMessageDialog.cpp | 16 ++++++++++++ .../Private/InputDialogWidget.cpp | 4 ++- .../Private/SSkyboxAIWidget.cpp | 6 +++-- .../Public/CustomMessageDialog.h | 26 +++++++++++++++++++ .../Public/SSkyboxAIWidget.h | 20 ++++++++++++-- .../Private/SKyboxAiHttpClient.cpp | 1 - .../SkyboxAiApi/Private/SkyboxAiApi.cpp | 1 + .../SkyboxAiApi/Public/SKyboxAiHttpClient.h | 6 +++++ .../SkyboxAiApi/Public/SkyboxProvider.h | 10 +++++++ .../Source/SkyboxAiApi/SkyboxAiApi.Build.cs | 26 +++++++++++++++++-- README.md | 26 ++++++++++--------- 12 files changed, 130 insertions(+), 20 deletions(-) create mode 100644 BlockadeLabsSkyboxAi/Config/FilterPlugin.ini create mode 100644 BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/CustomMessageDialog.cpp create mode 100644 BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/CustomMessageDialog.h diff --git a/BlockadeLabsSkyboxAi/Config/FilterPlugin.ini b/BlockadeLabsSkyboxAi/Config/FilterPlugin.ini new file mode 100644 index 0000000..ccebca2 --- /dev/null +++ b/BlockadeLabsSkyboxAi/Config/FilterPlugin.ini @@ -0,0 +1,8 @@ +[FilterPlugin] +; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and +; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively. +; +; Examples: +; /README.txt +; /Extras/... +; /Binaries/ThirdParty/*.dll diff --git a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/CustomMessageDialog.cpp b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/CustomMessageDialog.cpp new file mode 100644 index 0000000..4e42ce0 --- /dev/null +++ b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/CustomMessageDialog.cpp @@ -0,0 +1,16 @@ +#include "CustomMessageDialog.h" + +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 0 + +EAppReturnType::Type FCustomMessageDialog::Open( + EAppMsgCategory MessageCategory, + EAppMsgType::Type MessageType, + const FText &Message, + const FText &Title) +{ + const FText *TitlePtr = &Title; + + return FMessageDialog::Open(MessageType, Message, TitlePtr); +} + +#endif diff --git a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/InputDialogWidget.cpp b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/InputDialogWidget.cpp index 12891bb..9bb3c54 100644 --- a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/InputDialogWidget.cpp +++ b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/InputDialogWidget.cpp @@ -1,5 +1,7 @@ #include "InputDialogWidget.h" +#include "CustomMessageDialog.h" + DEFINE_LOG_CATEGORY(InputDialogWidget); void SInputDialogWidget::Construct(const FArguments &InArgs) @@ -34,7 +36,7 @@ void SInputDialogWidget::Construct(const FArguments &InArgs) { if (!IsInputValid()) { - FMessageDialog::Open( + FCustomMessageDialog::Open( EAppMsgCategory::Error, EAppMsgType::Ok, FText::FromString(TEXT("ID must be >= 0")), diff --git a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/SSkyboxAIWidget.cpp b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/SSkyboxAIWidget.cpp index 68b3764..a877c17 100644 --- a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/SSkyboxAIWidget.cpp +++ b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Private/SSkyboxAIWidget.cpp @@ -1,11 +1,13 @@ #include "SSkyboxAiWidget.h" #include "BlockadeLabsSkyboxAiSettings.h" +#include "CustomMessageDialog.h" #include "ImagineProvider.h" #include "InputDialogWidget.h" #include "Framework/Notifications/NotificationManager.h" #include "SkyboxAiApi.h" #include "Widgets/Input/SMultiLineEditableTextBox.h" #include "Widgets/Input/SSearchBox.h" +#include "Async/Async.h" DEFINE_LOG_CATEGORY(SkyboxAiWidget); @@ -580,7 +582,7 @@ bool SSkyboxAiWidget::ValidateGenerateData() const if (!bSuccess) { - FMessageDialog::Open( + FCustomMessageDialog::Open( EAppMsgCategory::Error, EAppMsgType::Ok, FText::FromString(FString::Join(ErrorMessage, TEXT("\r\n"))), @@ -982,7 +984,7 @@ FReply SSkyboxAiWidget::OnRefreshLists() { if (!bStartingUp) { - auto Answer = FMessageDialog::Open( + const auto Answer = FCustomMessageDialog::Open( EAppMsgCategory::Error, EAppMsgType::OkCancel, FText::FromString(TEXT("Refreshing lists will revert to default selection, are you sure?")), diff --git a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/CustomMessageDialog.h b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/CustomMessageDialog.h new file mode 100644 index 0000000..6c225d2 --- /dev/null +++ b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/CustomMessageDialog.h @@ -0,0 +1,26 @@ +#pragma once + +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 0 + +enum class EAppMsgCategory : uint8 +{ + Warning, + Error, + Success, + Info, +}; + +#endif + +struct FCustomMessageDialog : FMessageDialog +{ +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 0 + + static EAppReturnType::Type Open( + EAppMsgCategory MessageCategory, + EAppMsgType::Type MessageType, + const FText &Message, + const FText &Title); + +#endif +}; diff --git a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/SSkyboxAIWidget.h b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/SSkyboxAIWidget.h index 26fc307..7a40419 100644 --- a/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/SSkyboxAIWidget.h +++ b/BlockadeLabsSkyboxAi/Source/BlockadeLabsSkyboxAi/Public/SSkyboxAIWidget.h @@ -30,10 +30,26 @@ struct FSkyboxAiWidgetData { bool bEnrichPrompt = false; - FText Prompt; - FText NegativeText; + FText Prompt = FText::FromString(TEXT("")); + FText NegativeText = FText::FromString(TEXT("")); FSkyboxAiStylesTuple Category; FSkyboxAiExportTypesTuple ExportType; + + FSkyboxAiWidgetData() {} + + FSkyboxAiWidgetData( + bool bEnrichPrompt, + const FText &Prompt, + const FText &NegativeText, + const FSkyboxAiStylesTuple &Category, + const FSkyboxAiExportTypesTuple &ExportType) + : bEnrichPrompt(bEnrichPrompt), + Prompt(Prompt), + NegativeText(NegativeText), + Category(Category), + ExportType(ExportType) + { + } }; class SSkyboxAiWidget : public SCompoundWidget diff --git a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SKyboxAiHttpClient.cpp b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SKyboxAiHttpClient.cpp index d4b8f7c..3dcf4d7 100644 --- a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SKyboxAiHttpClient.cpp +++ b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SKyboxAiHttpClient.cpp @@ -2,7 +2,6 @@ #include "BlockadeLabsSkyboxAiSettings.h" #include "HttpModule.h" #include "SkyboxAiApi.h" -#include "Interfaces/IHttpRequest.h" #include "Interfaces/IHttpResponse.h" DEFINE_LOG_CATEGORY(SkyboxAiHttpClient); diff --git a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SkyboxAiApi.cpp b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SkyboxAiApi.cpp index 06fcf22..2e45692 100644 --- a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SkyboxAiApi.cpp +++ b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Private/SkyboxAiApi.cpp @@ -5,6 +5,7 @@ #include "HttpModule.h" #include "SKyboxAiHttpClient.h" #include "Interfaces/IHttpResponse.h" +#include "Misc/FileHelper.h" DEFINE_LOG_CATEGORY(SkyboxAiApi); diff --git a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SKyboxAiHttpClient.h b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SKyboxAiHttpClient.h index ce8eb0c..901d18e 100644 --- a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SKyboxAiHttpClient.h +++ b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SKyboxAiHttpClient.h @@ -1,7 +1,13 @@ #pragma once #include "CoreMinimal.h" + +#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 3 #include "HttpFwd.h" +#elif ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION == 0 +#include "Interfaces/IHttpRequest.h" +#endif + #include "JsonObjectConverter.h" #include "SkyboxAiHttpClient.generated.h" diff --git a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SkyboxProvider.h b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SkyboxProvider.h index 859c9b9..0de0196 100644 --- a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SkyboxProvider.h +++ b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SkyboxProvider.h @@ -16,6 +16,16 @@ struct FSkyboxListEntry int PromptMaxLen; int NegativeTextMaxLen; + FSkyboxListEntry(FString InName) + : Name(InName), ImageUrl(TEXT("")), PromptMaxLen(0), NegativeTextMaxLen(0) + { + } + + FSkyboxListEntry(FString InName, FString InImageUrl, int InPromptMaxLen, int InNegativeTextMaxLen) + : Name(InName), ImageUrl(InImageUrl), PromptMaxLen(InPromptMaxLen), NegativeTextMaxLen(InNegativeTextMaxLen) + { + } + bool operator==(const FSkyboxListEntry &Other) const { return Name.Equals(Other.Name); diff --git a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/SkyboxAiApi.Build.cs b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/SkyboxAiApi.Build.cs index 4c748a2..db907b8 100644 --- a/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/SkyboxAiApi.Build.cs +++ b/BlockadeLabsSkyboxAi/Source/SkyboxAiApi/SkyboxAiApi.Build.cs @@ -43,15 +43,37 @@ public SkyboxAiApi(ReadOnlyTargetRules Target) : base(Target) "ToolMenus", "CoreUObject", "Engine", - "Http", "Json", "JsonUtilities", "DeveloperSettings", - "MessageLog", + "MessageLog" // ... add private dependencies that you statically link with here ... } ); + BuildVersion Version; + + if (BuildVersion.TryRead(BuildVersion.GetDefaultFileName(), out Version)) + { + if (Version.MajorVersion == 5 && Version.MinorVersion == 0) + { + PrivateDependencyModuleNames.AddRange( + new string[] + { + "HTTP" + } + ); + } + else if (Version.MajorVersion == 5 && Version.MinorVersion >= 2) + { + PrivateDependencyModuleNames.AddRange( + new string[] + { + "Http" + } + ); + } + } DynamicallyLoadedModuleNames.AddRange( new string[] diff --git a/README.md b/README.md index caece7c..569c1e9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This is a tool that integrates with [SkyboxAI](https://skybox.blockadelabs.com/) by [Blockade Labs](https://www.blockadelabs.com/) +**This is not an official plugin made by Blockade Labs, it's a community plugin**. To see official SDK's and Libraries please visit [Blockade Labs API Documentation](https://api-documentation.blockadelabs.com/api/sdk.html) + The purpose of this plugin is to allow you to request to generate a sky box and then automatically download it and put it in your project with an option to disable features that are premium (to reduce UI clutter and show only things that you can use) If you are looking for information about the implementation of the API that is used in this plugin please visit the [API docs](./BlockadeLabsSkyboxAi/Source/SkyboxAiApi/README.md) @@ -14,6 +16,7 @@ If you are interested in knowing more about Blockade Labs and Skybox AI please t - [Table Of Content](#table-of-content) - [Requirements](#requirements) - [Important Notes](#important-notes) + - [Supported Platforms](#supported-platforms) - [Setting Up The Plugin](#setting-up-the-plugin) - [Plugin Settings](#plugin-settings) - [Using The Plugin](#using-the-plugin) @@ -30,18 +33,7 @@ If you are interested in knowing more about Blockade Labs and Skybox AI please t For this plugin to work you will need to have a SkyboxAI account and an API key, please visit [SkyboxAI API Membership](https://skybox.blockadelabs.com/api-membership) page to see their pricing and create an account -This plugin was tested on the following versions of Unreal Engine: - -- [ ] 5.0 -- [ ] 5.1 -- [ ] 5.2 -- [x] 5.3 - -This plugin was tested on the following platforms: - -- [x] Windows -- [ ] Linux -- [ ] OSX +You might need to install a specific .NET runtime depending on your UE version ## Important Notes @@ -51,6 +43,15 @@ Since this file contains **SENSITIVE INFORMATION** please make sure to **NEVER** There are many solutions for secret management, please use one of them if you want to use this plugin as part of some automatic process +## Supported Platforms + +| Engine Version | Windows | Linux | OSX | +| -------------- | ------- | ----- | --- | +| **5.0** | YES | NO | NO | +| **5.1** | NO | NO | NO | +| **5.2** | NO | NO | NO | +| **5.3** | YES | NO | NO | + ## Setting Up The Plugin To setup the plugin please follow the following steps: @@ -155,6 +156,7 @@ This plugin is currently missing a few features that are available on SkyboxAI, - [ ] Download depth map [On the TODO list] - [ ] 3D features - [ ] Control image +- [ ] Preview Support for Pusher / Webhooks will not be implemented