Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make this compile on ue5.0.3 #1

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions BlockadeLabsSkyboxAi/Config/FilterPlugin.ini
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "InputDialogWidget.h"

#include "CustomMessageDialog.h"

DEFINE_LOG_CATEGORY(InputDialogWidget);

void SInputDialogWidget::Construct(const FArguments &InArgs)
Expand Down Expand Up @@ -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")),
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Expand Down Expand Up @@ -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"))),
Expand Down Expand Up @@ -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?")),
Expand Down
Original file line number Diff line number Diff line change
@@ -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
};
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "HttpModule.h"
#include "SKyboxAiHttpClient.h"
#include "Interfaces/IHttpResponse.h"
#include "Misc/FileHelper.h"

DEFINE_LOG_CATEGORY(SkyboxAiApi);

Expand Down
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
10 changes: 10 additions & 0 deletions BlockadeLabsSkyboxAi/Source/SkyboxAiApi/Public/SkyboxProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 24 additions & 2 deletions BlockadeLabsSkyboxAi/Source/SkyboxAiApi/SkyboxAiApi.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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

Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand Down