Added a popup class for graph validation.
This commit is contained in:
parent
9dec4a1c91
commit
6261a7eddc
@ -234,7 +234,6 @@ FComboInputSlateStyle::FComboInputSlateStyle() : FSlateStyleSet("ComboInputEdito
|
|||||||
this->Set("MDSStyleSet.Node.Icon.small", new IMAGE_BRUSH(TEXT("DialogueNodeIcon"), Icon12));
|
this->Set("MDSStyleSet.Node.Icon.small", new IMAGE_BRUSH(TEXT("DialogueNodeIcon"), Icon12));
|
||||||
|
|
||||||
this->Set("MDSStyleSet.Icon.Close", new IMAGE_BRUSH(TEXT("CloseIcon"), Icon12));
|
this->Set("MDSStyleSet.Icon.Close", new IMAGE_BRUSH(TEXT("CloseIcon"), Icon12));
|
||||||
this->Set("MDSStyleSet.Icon.SupportDiscord", new IMAGE_BRUSH(TEXT("DiscordIcon"), Icon12));
|
|
||||||
this->Set("MDSStyleSet.Icon.HeartIcon", new IMAGE_BRUSH(TEXT("HeartIcon"), Icon12));
|
this->Set("MDSStyleSet.Icon.HeartIcon", new IMAGE_BRUSH(TEXT("HeartIcon"), Icon12));
|
||||||
this->Set("MDSStyleSet.Icon.UBIcon", new IMAGE_BRUSH(TEXT("UnrealBucketIcon"), Icon12));
|
this->Set("MDSStyleSet.Icon.UBIcon", new IMAGE_BRUSH(TEXT("UnrealBucketIcon"), Icon12));
|
||||||
this->Set("MDSStyleSet.Icon.MoneyIcon", new IMAGE_BRUSH(TEXT("MoneyIcon"), Icon12));
|
this->Set("MDSStyleSet.Icon.MoneyIcon", new IMAGE_BRUSH(TEXT("MoneyIcon"), Icon12));
|
||||||
|
|||||||
@ -0,0 +1,147 @@
|
|||||||
|
#include "Popups/ComboInputPopup_GraphValidation.h"
|
||||||
|
|
||||||
|
#include "ComboInputEditor.h"
|
||||||
|
#include "Helpers/ComboActionGraphColors.h"
|
||||||
|
#include "Interfaces/IPluginManager.h"
|
||||||
|
#include "Settings/ComboActionGraphEditorSettings.h"
|
||||||
|
#include "Widgets/Layout/SScrollBox.h"
|
||||||
|
#include "Widgets/Text/SRichTextBlock.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "ComboInputPopup_GraphValidation"
|
||||||
|
|
||||||
|
|
||||||
|
void ComboInputPopup_GraphValidation::OnBrowserLinkClicked(const FSlateHyperlinkRun::FMetadata &Metadata)
|
||||||
|
{
|
||||||
|
const FString *URL = Metadata.Find(TEXT("href"));
|
||||||
|
|
||||||
|
if (URL)
|
||||||
|
{
|
||||||
|
FPlatformProcess::LaunchURL(**URL, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TSharedPtr<SWindow> ComboInputPopup_GraphValidation::Open(const TArray<FText> ValidationMessages)
|
||||||
|
{
|
||||||
|
if (!FSlateApplication::Get().CanDisplayWindows())
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FComboInputEditorModule &Module = FModuleManager::GetModuleChecked<FComboInputEditorModule>("ComboInputEditor");
|
||||||
|
const TSharedPtr<FSlateStyleSet> &EditorStyle = Module.Get().GetComboInputEditorStyleSet();
|
||||||
|
|
||||||
|
const TSharedRef<SBorder> WindowContent = SNew(SBorder)
|
||||||
|
.BorderImage(EditorStyle->GetBrush("MDSStyleSet.Node.TextSoftEdges"))
|
||||||
|
.BorderBackgroundColor
|
||||||
|
(
|
||||||
|
ComboActionGraphColors::ValidationGraph::DarkTheme
|
||||||
|
)
|
||||||
|
.Padding(FMargin(8.0f, 8.0f));
|
||||||
|
|
||||||
|
TSharedPtr<SWindow> Window = SNew(SWindow)
|
||||||
|
.AutoCenter(EAutoCenter::PreferredWorkArea)
|
||||||
|
.SupportsMaximize(false)
|
||||||
|
.SupportsMinimize(false)
|
||||||
|
.SizingRule(ESizingRule::FixedSize)
|
||||||
|
.ClientSize(FVector2D(650, 750))
|
||||||
|
.Title(FText::FromString("Combo Action Graph Validation"))
|
||||||
|
.IsTopmostWindow(true)
|
||||||
|
[
|
||||||
|
WindowContent
|
||||||
|
];
|
||||||
|
|
||||||
|
const FSlateFontInfo Heading1Font = FCoreStyle::GetDefaultFontStyle("Bold", 24);
|
||||||
|
const FSlateFontInfo Heading2Font = FCoreStyle::GetDefaultFontStyle("Bold", 18);
|
||||||
|
const FSlateFontInfo NormalFont = FCoreStyle::GetDefaultFontStyle("Regular", 12);
|
||||||
|
|
||||||
|
const TSharedRef<SScrollBox> ListOfMessages = SNew(SScrollBox);
|
||||||
|
for (auto Itr : ValidationMessages)
|
||||||
|
{
|
||||||
|
ListOfMessages->AddSlot()
|
||||||
|
[
|
||||||
|
SNew(SBox)
|
||||||
|
.Padding(FMargin(0.f, 3.5f, 0.f, 3.5f))
|
||||||
|
[
|
||||||
|
SNew(SRichTextBlock)
|
||||||
|
.Text(Itr)
|
||||||
|
.TextStyle(FAppStyle::Get(), "NormalText")
|
||||||
|
.DecoratorStyleSet(&FAppStyle::Get())
|
||||||
|
.AutoWrapText(true)
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ValidationMessages.Num() == 0)
|
||||||
|
{
|
||||||
|
ListOfMessages->AddSlot()
|
||||||
|
[
|
||||||
|
SNew(STextBlock)
|
||||||
|
.Text(FText::FromString("There are no issues with your graph. You can close this window."))
|
||||||
|
.TextStyle(FAppStyle::Get(), "NormalText")
|
||||||
|
.AutoWrapText(true)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
const TSharedRef<SVerticalBox> InnerContent =
|
||||||
|
SNew(SVerticalBox)
|
||||||
|
+ SVerticalBox::Slot()
|
||||||
|
.FillHeight(1.0)
|
||||||
|
.Padding(10)
|
||||||
|
[
|
||||||
|
SNew(SBorder)
|
||||||
|
.Padding(10)
|
||||||
|
.BorderImage(FAppStyle::GetBrush("ToolPanel.DarkGroupBorder"))
|
||||||
|
[
|
||||||
|
ListOfMessages
|
||||||
|
]
|
||||||
|
]
|
||||||
|
+ SVerticalBox::Slot()
|
||||||
|
.AutoHeight()
|
||||||
|
.Padding(10)
|
||||||
|
[
|
||||||
|
SNew(SHorizontalBox)
|
||||||
|
+ SHorizontalBox::Slot().FillWidth(1.0f)
|
||||||
|
[
|
||||||
|
SNew(SButton)
|
||||||
|
.HAlign(HAlign_Center)
|
||||||
|
.OnClicked_Lambda([Window]()
|
||||||
|
{
|
||||||
|
Window->RequestDestroyWindow();
|
||||||
|
|
||||||
|
return FReply::Handled();
|
||||||
|
})
|
||||||
|
[
|
||||||
|
SNew(SHorizontalBox)
|
||||||
|
+ SHorizontalBox::Slot()
|
||||||
|
.AutoWidth()
|
||||||
|
[
|
||||||
|
SNew(STextBlock)
|
||||||
|
.Text(FText::FromString("Close window"))
|
||||||
|
]
|
||||||
|
|
||||||
|
+ SHorizontalBox::Slot()
|
||||||
|
[
|
||||||
|
SNew(SSpacer)
|
||||||
|
.Size(FVector2D(5, 0))
|
||||||
|
]
|
||||||
|
|
||||||
|
+ SHorizontalBox::Slot()
|
||||||
|
.AutoWidth()
|
||||||
|
[
|
||||||
|
SNew(SImage)
|
||||||
|
.ColorAndOpacity(FLinearColor::Red)
|
||||||
|
.Image(EditorStyle->GetBrush("MDSStyleSet.Icon.Close"))
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
const int32 A = InnerContent.Get().GetAllChildren()->Num();
|
||||||
|
|
||||||
|
WindowContent->SetContent(InnerContent);
|
||||||
|
Window = FSlateApplication::Get().AddWindow(Window.ToSharedRef());
|
||||||
|
|
||||||
|
return Window;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Framework/Text/SlateHyperlinkRun.h"
|
||||||
|
|
||||||
|
|
||||||
|
class SScrollBox;
|
||||||
|
|
||||||
|
class ComboInputPopup_GraphValidation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static TSharedPtr<SWindow> Open(const TArray<FText> ValidationMessages);
|
||||||
|
static void OnBrowserLinkClicked(const FSlateHyperlinkRun::FMetadata &Metadata);
|
||||||
|
};
|
||||||
@ -95,7 +95,6 @@ private:
|
|||||||
TArray<TSharedPtr<IAssetTypeActions>> CreatedAssetTypeActions;
|
TArray<TSharedPtr<IAssetTypeActions>> CreatedAssetTypeActions;
|
||||||
|
|
||||||
TSharedPtr<class FSlateStyleSet> ComboInputEditorStyleSet;
|
TSharedPtr<class FSlateStyleSet> ComboInputEditorStyleSet;
|
||||||
TSharedPtr<class FSlateStyleSet> ComboActionGraphEditorStyleSet;
|
|
||||||
TSharedPtr<struct FGraphPanelNodeFactory> ComboActionGraphPanelNodeFactory;
|
TSharedPtr<struct FGraphPanelNodeFactory> ComboActionGraphPanelNodeFactory;
|
||||||
TSharedPtr<class FAssetTypeActions_ComboActionGraph> ComboActionGraphAssetActions;
|
TSharedPtr<class FAssetTypeActions_ComboActionGraph> ComboActionGraphAssetActions;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user