Trying to add a combo graph editor.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#include "ComboActionGraphEditorSettings.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "ComboActionGraphEditorSettings"
|
||||
|
||||
|
||||
UComboActionGraphEditorSettings::UComboActionGraphEditorSettings()
|
||||
{
|
||||
NodeType = EComboActionNodeType::SoftCorners;
|
||||
NodeTheme = EComboActionNodeTheme::DarkTheme;
|
||||
ArrowType = EComboActionArrowType::HollowArrow;
|
||||
|
||||
CategoryName = TEXT("Combo Input");
|
||||
SectionName = TEXT("Combo Input (Editor)");
|
||||
|
||||
AutoLayoutStrategy = EComboActionAutoLayoutStrategyType::Tree;
|
||||
|
||||
bFirstPassOnly = false;
|
||||
bRandomInit = false;
|
||||
OptimalDistance = 100.f;
|
||||
MaxIteration = 50;
|
||||
InitTemperature = 10.f;
|
||||
CoolDownRate = 10.f;
|
||||
|
||||
WireWidth = 0.8f;
|
||||
//WireStyle = EWiringStyle::EWS_Simple;
|
||||
//BubbleDrawRule = EBubbleDrawRule::EBDR_OnSelected;
|
||||
|
||||
bAllowRenameNodes = true;
|
||||
bDisplayAutomaticNames = false;
|
||||
|
||||
bShowDetailedInfo_InheritsDecorators = true;
|
||||
bShowDetailedInfo_NumDecorators = true;
|
||||
DecoratorsInfoStyle = EComboActionDecoratorsInfoStyle::Unified;
|
||||
|
||||
bAllowNativeDecoratorsEdit = false;
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@@ -0,0 +1,292 @@
|
||||
// ©2023 Batty Bovine Productions, LLC. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DeveloperSettings.h"
|
||||
|
||||
#include "ComboActionGraphEditorSettings.generated.h"
|
||||
|
||||
|
||||
#pragma region Enums
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionAutoLayoutStrategyType : uint8
|
||||
{
|
||||
Tree UMETA(DisplayName="Tree"),
|
||||
ForceDirected UMETA(DisplayName="Force Directed"),
|
||||
|
||||
Default UMETA(Hidden)
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionWiringStyle : uint8
|
||||
{
|
||||
Vanilla UMETA(DisplayName="Vanilla"),
|
||||
Simple UMETA(DisplayName="90° Angle"),
|
||||
Complex UMETA(DisplayName="45° Angle"),
|
||||
|
||||
Default UMETA(Hidden)
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionBubbleDrawRule : uint8
|
||||
{
|
||||
Always UMETA(DisplayName="Always"),
|
||||
OnSelected UMETA(DisplayName="When Selected")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionNodeTheme : uint8
|
||||
{
|
||||
DarkTheme UMETA(DisplayName="Dark Theme"),
|
||||
LightTheme UMETA(DisplayName="Light Theme")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionDecoratorsInfoStyle : uint8
|
||||
{
|
||||
Stack UMETA(DisplayName="Stack"),
|
||||
Unified UMETA(DisplayName="Unified")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionNodeType : uint8
|
||||
{
|
||||
SoftCorners UMETA(DisplayName="Soft Corners"),
|
||||
HardCorners UMETA(DisplayName="Hard Corners")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EComboActionArrowType : uint8
|
||||
{
|
||||
SimpleArrow UMETA(DisplayName="Simple Arrow"),
|
||||
HollowArrow UMETA(DisplayName="Hollow Arrow"),
|
||||
FancyArrow UMETA(DisplayName="Fancy Arrow"),
|
||||
Bubble UMETA(DisplayName="Bubble"),
|
||||
None UMETA(DisplayName="Nothing")
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
/**
|
||||
* Combo Action Graph global settings.
|
||||
*/
|
||||
UCLASS(config = MounteaSettings)
|
||||
class COMBOINPUT_API UComboActionGraphEditorSettings : public UDeveloperSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UComboActionGraphEditorSettings();
|
||||
|
||||
private:
|
||||
|
||||
#pragma region GraphNodes
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings")
|
||||
EComboActionNodeType NodeType;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings")
|
||||
EComboActionNodeTheme NodeTheme;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings|DecoratorsInfo")
|
||||
uint8 bShowDetailedInfo_NumDecorators : 1;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings|DecoratorsInfo")
|
||||
uint8 bShowDetailedInfo_InheritsDecorators : 1;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings")
|
||||
EComboActionDecoratorsInfoStyle DecoratorsInfoStyle;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings")
|
||||
bool bDisplayAutomaticNames;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings")
|
||||
bool bAllowRenameNodes;
|
||||
|
||||
/**
|
||||
* Select a Node Class and specify Override Colour for this Node type.
|
||||
* Only non-abstract classes are allowed!
|
||||
*/
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings", meta=(ShowTreeView))
|
||||
TMap<TSoftClassPtr<class UComboActionGraphNode>, FLinearColor> OverrideNodeBackgroundColours;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GraphDecorators
|
||||
|
||||
// Enables 'Edit' button for Native Code Decorators
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodesSettings")
|
||||
bool bAllowNativeDecoratorsEdit;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GraphWiring
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", meta=(UIMin=0.1f, ClampMin=0.1f, UIMax=1.5f, ClampMax=1.5f))
|
||||
float WireWidth;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring") //, meta=(ConfigRestartRequired=true))
|
||||
EComboActionArrowType ArrowType;
|
||||
|
||||
/* Advanced Wiring doesn't work now
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!"))
|
||||
bool bUseAdvancedWiring;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
EWiringStyle WireStyle;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
uint32 HorizontalOffset = 16;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
EBubbleDrawRule BubbleDrawRule;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
int32 BubbleZoomThreshold;
|
||||
|
||||
// Space between bubbles on the wires. Default: 20.0
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta = (ClampMin = "10.0", ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
float BubbleSpace = 20.0f;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta = (ClampMin = "10.0", ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
float BubbleSize = 2.0f;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta = (ClampMin = "10.0", ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
float BubbleSpeed = 2.0f;
|
||||
|
||||
// Disable the offset for pins. Default: false
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
bool DisablePinOffset = false;
|
||||
|
||||
// Fix default zoomed-out wire displacement. Default: true
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "NodeWiring", AdvancedDisplay, meta=(ToolTip="Work in Progress!", EditCondition="bUseAdvancedWiring"))
|
||||
bool FixZoomDisplacement = true;
|
||||
|
||||
*/
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GraphArrange
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, Category = "AutoArrange")
|
||||
float OptimalDistance;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, AdvancedDisplay, Category = "AutoArrange")
|
||||
EComboActionAutoLayoutStrategyType AutoLayoutStrategy;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, AdvancedDisplay, Category = "AutoArrange")
|
||||
int32 MaxIteration;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, AdvancedDisplay, Category = "AutoArrange")
|
||||
bool bFirstPassOnly;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, AdvancedDisplay, Category = "AutoArrange")
|
||||
bool bRandomInit;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, AdvancedDisplay, Category = "AutoArrange")
|
||||
float InitTemperature;
|
||||
|
||||
UPROPERTY(config, EditDefaultsOnly, AdvancedDisplay, Category = "AutoArrange")
|
||||
float CoolDownRate;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual FText GetSectionText() const override
|
||||
{
|
||||
return NSLOCTEXT("ComboActionGraphEditorSystem", "ComboActionGraphEditorSection", "Combo Action Graph (Editor)");
|
||||
}
|
||||
|
||||
virtual FText GetSectionDescription() const override
|
||||
{
|
||||
return NSLOCTEXT("ComboActionGraphEditorSystem", "ComboActionGraphEditorDescription", "Default values for Mountea Plugins (Editor).");
|
||||
}
|
||||
|
||||
virtual FName GetContainerName() const override
|
||||
{
|
||||
return "Project";
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
#pragma region GraphNodes_Getters
|
||||
|
||||
EComboActionNodeTheme GetNodeTheme() const { return NodeTheme; }
|
||||
EComboActionNodeType GetNodeType() const { return NodeType; }
|
||||
bool ShowDetailedInfo_NumDecorators() const { return bShowDetailedInfo_NumDecorators; }
|
||||
bool ShowDetailedInfo_InheritsDecorators() const { return bShowDetailedInfo_InheritsDecorators; }
|
||||
bool ShowAutomaticNames() const { return bDisplayAutomaticNames; }
|
||||
EComboActionDecoratorsInfoStyle GetDecoratorsStyle() const { return DecoratorsInfoStyle; }
|
||||
bool AllowRenameNodes() const { return bAllowRenameNodes; }
|
||||
|
||||
bool FindNodeBackgroundColourOverride(const TSoftClassPtr<class UComboActionGraphNode> NodeClass, FLinearColor& BackgroundColour)
|
||||
{
|
||||
if (OverrideNodeBackgroundColours.Contains(NodeClass))
|
||||
{
|
||||
BackgroundColour = *OverrideNodeBackgroundColours.Find(NodeClass);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GraphDecorators_Getters
|
||||
|
||||
bool IsNativeDecoratorsEditAllowed() const { return bAllowNativeDecoratorsEdit; }
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region GraphWiring_Getters
|
||||
|
||||
float GetWireWidth() const { return this->WireWidth; }
|
||||
|
||||
EComboActionArrowType GetArrowType() const { return this->ArrowType; }
|
||||
|
||||
/*
|
||||
bool AllowAdvancedWiring() const
|
||||
{ return bUseAdvancedWiring; };
|
||||
|
||||
EWiringStyle GetWireStyle() const
|
||||
{ return WireStyle; };
|
||||
|
||||
int32 GetHorizontalOffset() const
|
||||
{ return HorizontalOffset; };
|
||||
|
||||
EBubbleDrawRule GetBubbleDrawRule() const
|
||||
{ return BubbleDrawRule; };
|
||||
|
||||
int32 GetBubbleZoomThreshold() const
|
||||
{ return BubbleZoomThreshold; };
|
||||
|
||||
float GetBubbleSpace() const
|
||||
{ return BubbleSpace; };
|
||||
|
||||
float GetBubbleSpeed() const
|
||||
{ return BubbleSpeed; };
|
||||
|
||||
float GetBubbleSize() const
|
||||
{ return BubbleSize; };
|
||||
*/
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region GraphArrange_Getters
|
||||
|
||||
EComboActionAutoLayoutStrategyType GetAutoLayoutStrategy() const { return this->AutoLayoutStrategy; }
|
||||
float GetOptimalDistance() const { return this->OptimalDistance; }
|
||||
int32 GetMaxIteration() const { return this->MaxIteration; }
|
||||
bool IsFirstPassOnly() const { return this->bFirstPassOnly; }
|
||||
bool IsRandomInit() const { return this->bRandomInit; }
|
||||
float GetInitTemperature() const { return this->InitTemperature; }
|
||||
float GetCoolDownRate() const { return this->CoolDownRate; }
|
||||
|
||||
#pragma endregion
|
||||
};
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
// Copyright Dominik Pavlicek 2023. All Rights Reserved.
|
||||
|
||||
#include "FComboActionGraphEditorStyle.h"
|
||||
|
||||
#include "Interfaces/IPluginManager.h"
|
||||
#include "Misc/Paths.h"
|
||||
#include "Styling/SlateStyleRegistry.h"
|
||||
|
||||
#define IMAGE_BRUSH(RelativePath, ...) FSlateImageBrush(StyleSet->RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__)
|
||||
#define BOX_BRUSH(RelativePath, ...) FSlateBoxBrush(StyleSet->RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__)
|
||||
#define DEFAULT_FONT(...) FCoreStyle::GetDefaultFontStyle(__VA_ARGS__)
|
||||
|
||||
|
||||
TSharedPtr<FSlateStyleSet> FComboActionGraphEditorStyle::StyleSet = nullptr;
|
||||
|
||||
void FComboActionGraphEditorStyle::Initialize()
|
||||
{
|
||||
if (!StyleSet.IsValid() )
|
||||
{
|
||||
Create();
|
||||
FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get());
|
||||
}
|
||||
}
|
||||
|
||||
void FComboActionGraphEditorStyle::Shutdown()
|
||||
{
|
||||
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet.Get());
|
||||
ensure(StyleSet.IsUnique());
|
||||
StyleSet.Reset();
|
||||
}
|
||||
|
||||
void FComboActionGraphEditorStyle::Create()
|
||||
{
|
||||
const FVector2D Icon12x12(12.0f, 12.0f);
|
||||
const FVector2D Icon16x16(16.0f, 16.0f);
|
||||
const FVector2D Icon40x40(40.0f, 40.0f);
|
||||
const FVector2D Icon64x64(64.0f, 64.0f);
|
||||
const FVector2D Icon128x128(128.f, 128.f);
|
||||
const FVector2D Icon200x70(200.f, 70.f);
|
||||
|
||||
StyleSet = MakeShareable(new FSlateStyleSet(GetAppStyleSetName()));
|
||||
StyleSet->SetContentRoot(IPluginManager::Get().FindPlugin("ComboInput")->GetBaseDir() / TEXT("Resources"));
|
||||
StyleSet->SetCoreContentRoot(IPluginManager::Get().FindPlugin("ComboInput")->GetBaseDir() / TEXT("Content"));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.AutoArrange.small", new IMAGE_BRUSH(TEXT("AutoArrangeIcon"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.AutoArrange", new IMAGE_BRUSH(TEXT("AutoArrangeIcon"), Icon40x40));
|
||||
StyleSet->Set("MDSStyleSet.AutoArrange.large", new IMAGE_BRUSH(TEXT("AutoArrangeIcon"), Icon64x64));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.GraphSettings.small", new IMAGE_BRUSH(TEXT("GraphSettings"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.GraphSettings", new IMAGE_BRUSH(TEXT("GraphSettings"), Icon40x40));
|
||||
StyleSet->Set("MDSStyleSet.GraphSettings.large", new IMAGE_BRUSH(TEXT("GraphSettings"), Icon64x64));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.ValidateGraph.small", new IMAGE_BRUSH(TEXT("ValidateGraph"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.ValidateGraph", new IMAGE_BRUSH(TEXT("ValidateGraph"), Icon40x40));
|
||||
StyleSet->Set("MDSStyleSet.ValidateGraph.large", new IMAGE_BRUSH(TEXT("ValidateGraph"), Icon64x64));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Graph.NodeOverlay", new BOX_BRUSH( TEXT("NodeOverlay"), FMargin(8.0f/64.0f, 3.0f/32.0f, 0, 0) ));
|
||||
StyleSet->Set("MDSStyleSet.Graph.PinDocksOverlay", new BOX_BRUSH( TEXT("PinDocksOverlay"), FMargin(8.0f/64.0f, 3.0f/32.0f, 0, 0) ));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Graph.SimpleArrow", new IMAGE_BRUSH(TEXT("SimpleArrow"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.Graph.HollowArrow", new IMAGE_BRUSH(TEXT("HollowArrow"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.Graph.FancyArrow", new IMAGE_BRUSH(TEXT("FancyArrow"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.Graph.Bubble", new IMAGE_BRUSH(TEXT("Bubble"), Icon16x16));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Node.SoftEdges", new BOX_BRUSH( TEXT("NodeSoftCorners") , FMargin(16.f/64.f, 25.f/64.f, 16.f/64.f, 16.f/64.f) ));
|
||||
StyleSet->Set("MDSStyleSet.Node.HardEdges", new BOX_BRUSH( TEXT("NodeHardCorners") , FMargin(16.f/64.f, 25.f/64.f, 16.f/64.f, 16.f/64.f) ));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Node.TextSoftEdges", new BOX_BRUSH( TEXT("TextSoftCorners") , FMargin(16.f/64.f, 25.f/64.f, 16.f/64.f, 16.f/64.f) ));
|
||||
StyleSet->Set("MDSStyleSet.Node.TextHardEdges", new BOX_BRUSH( TEXT("TextHardCorners") , FMargin(16.f/64.f, 25.f/64.f, 16.f/64.f, 16.f/64.f) ));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Node.IndexCircle", new IMAGE_BRUSH(TEXT("IndexIcon"), Icon16x16));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Icon.OK", new IMAGE_BRUSH(TEXT("OKIcon"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.Icon.Error", new IMAGE_BRUSH(TEXT("ErroIcon"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.Icon.BulletPoint", new IMAGE_BRUSH(TEXT("CircleBox"), Icon16x16));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Graph.CornerImage", new IMAGE_BRUSH(TEXT("Icon128"), Icon128x128));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Icon.Browse", new IMAGE_BRUSH(TEXT("BrowseIcon"), Icon12x12));
|
||||
StyleSet->Set("MDSStyleSet.Icon.Edit", new IMAGE_BRUSH(TEXT("EditIcon"), Icon12x12));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Buttons.Documentation", new IMAGE_BRUSH(TEXT("Documentation"), Icon200x70));
|
||||
StyleSet->Set("MDSStyleSet.Buttons.Documentation.small", new IMAGE_BRUSH(TEXT("DocumentationIcon"), Icon12x12));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Node.Icon.large", new IMAGE_BRUSH(TEXT("DialogueNodeIcon"), Icon64x64));
|
||||
StyleSet->Set("MDSStyleSet.Node.Icon", new IMAGE_BRUSH(TEXT("DialogueNodeIcon"), Icon16x16));
|
||||
StyleSet->Set("MDSStyleSet.Node.Icon.small", new IMAGE_BRUSH(TEXT("DialogueNodeIcon"), Icon12x12));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Icon.Close", new IMAGE_BRUSH(TEXT("CloseIcon"), Icon12x12));
|
||||
StyleSet->Set("MDSStyleSet.Icon.SupportDiscord", new IMAGE_BRUSH(TEXT("DiscordIcon"), Icon12x12));
|
||||
StyleSet->Set("MDSStyleSet.Icon.HeartIcon", new IMAGE_BRUSH(TEXT("HeartIcon"), Icon12x12));
|
||||
StyleSet->Set("MDSStyleSet.Icon.UBIcon", new IMAGE_BRUSH(TEXT("UnrealBucketIcon"), Icon12x12));
|
||||
StyleSet->Set("MDSStyleSet.Icon.MoneyIcon", new IMAGE_BRUSH(TEXT("MoneyIcon"), Icon12x12));
|
||||
|
||||
const FButtonStyle MounteaButtonStyle = FButtonStyle()
|
||||
.SetNormal(BOX_BRUSH("RoundedSelection_16x", 4.0f / 16.0f, FLinearColor(1, 1, 1, 0.1f)))
|
||||
.SetHovered(BOX_BRUSH("RoundedSelection_16x", 4.0f / 16.0f, FLinearColor(1, .55f, 0, 0.2f)))
|
||||
.SetPressed(BOX_BRUSH("RoundedSelection_16x", 4.0f / 16.0f, FLinearColor(1, .55f, 0, 0.4f)));
|
||||
|
||||
StyleSet->Set("MDSStyleSet.Buttons.Style", MounteaButtonStyle);
|
||||
|
||||
{
|
||||
const FScrollBarStyle ScrollBar = GetWidgetStyle<FScrollBarStyle>( "ScrollBar" );
|
||||
|
||||
FTextBlockStyle NormalText = FTextBlockStyle()
|
||||
.SetFont(DEFAULT_FONT("Regular", FCoreStyle::RegularTextSize))
|
||||
.SetColorAndOpacity(FSlateColor::UseForeground())
|
||||
.SetShadowOffset(FVector2D::ZeroVector)
|
||||
.SetShadowColorAndOpacity(FLinearColor::Black)
|
||||
.SetHighlightColor( FLinearColor( 0.02f, 0.3f, 0.0f ) )
|
||||
.SetHighlightShape( BOX_BRUSH( "TextBlockHighlightShape", FMargin(3.f/8.f) ) );
|
||||
|
||||
FTextBlockStyle NodeTitle = FTextBlockStyle(NormalText)
|
||||
.SetFont( DEFAULT_FONT( "Bold", 14 ) )
|
||||
.SetColorAndOpacity( FLinearColor(230.0f/255.0f,230.0f/255.0f,230.0f/255.0f) )
|
||||
.SetShadowOffset( FVector2D( 2,2 ) )
|
||||
.SetShadowColorAndOpacity( FLinearColor(0.f,0.f,0.f, 0.7f) );
|
||||
StyleSet->Set( "MDSStyleSet.NodeTitle", NodeTitle );
|
||||
|
||||
FEditableTextBoxStyle NodeTitleEditableText = FEditableTextBoxStyle()
|
||||
.SetFont(NormalText.Font)
|
||||
.SetBackgroundImageNormal( BOX_BRUSH( "TextBox", FMargin(4.0f/16.0f) ) )
|
||||
.SetBackgroundImageHovered( BOX_BRUSH( "TextBox_Hovered", FMargin(4.0f/16.0f) ) )
|
||||
.SetBackgroundImageFocused( BOX_BRUSH( "TextBox_Hovered", FMargin(4.0f/16.0f) ) )
|
||||
.SetBackgroundImageReadOnly( BOX_BRUSH( "TextBox_ReadOnly", FMargin(4.0f/16.0f) ) )
|
||||
.SetScrollBarStyle( ScrollBar );
|
||||
StyleSet->Set( "MDSStyleSet.NodeTitleEditableText", NodeTitleEditableText );
|
||||
|
||||
StyleSet->Set( "MDSStyleSet.NodeTitleInlineEditableText", FInlineEditableTextBlockStyle()
|
||||
.SetTextStyle(NodeTitle)
|
||||
.SetEditableTextBoxStyle(NodeTitleEditableText)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#undef DEFAULT_FONT
|
||||
#undef BOX_BRUSH
|
||||
#undef IMAGE_BRUSH
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright Dominik Pavlicek 2023. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Styling/SlateStyle.h"
|
||||
|
||||
|
||||
class FComboActionGraphEditorStyle
|
||||
{
|
||||
public:
|
||||
|
||||
static void Create();
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
static ISlateStyle &Get()
|
||||
{
|
||||
return *(StyleSet.Get());
|
||||
}
|
||||
|
||||
static const FSlateBrush *GetBrush(FName PropertyName, const ANSICHAR *Specifier = NULL)
|
||||
{
|
||||
return StyleSet->GetBrush(PropertyName, Specifier);
|
||||
};
|
||||
|
||||
static const FName &GetAppStyleSetName()
|
||||
{
|
||||
static FName StyleSetName(TEXT("ComboActionGraphEditorStyle"));
|
||||
return StyleSetName;
|
||||
};
|
||||
|
||||
template< class T >
|
||||
static const T &GetWidgetStyle( FName PropertyName, const ANSICHAR *Specifier = NULL )
|
||||
{
|
||||
return StyleSet->GetWidgetStyle< T >( PropertyName, Specifier );
|
||||
}
|
||||
|
||||
private:
|
||||
static TSharedPtr<FSlateStyleSet> StyleSet;
|
||||
};
|
||||
Reference in New Issue
Block a user