更新 Source/FLESHEditor/Private/FLESHEditorStyle.cpp
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
#include "Styling/CoreStyle.h"
|
#include "Styling/CoreStyle.h"
|
||||||
#include "Interfaces/IPluginManager.h"
|
#include "Interfaces/IPluginManager.h"
|
||||||
#include "SlateOptMacros.h"
|
#include "SlateOptMacros.h"
|
||||||
|
#include "Styling/SlateStyle.h"
|
||||||
|
#include "Brushes/SlateImageBrush.h"
|
||||||
|
|
||||||
TSharedPtr<FSlateStyleSet> FFLESHEditorStyle::StyleInstance = nullptr;
|
TSharedPtr<FSlateStyleSet> FFLESHEditorStyle::StyleInstance = nullptr;
|
||||||
|
|
||||||
@@ -46,47 +48,27 @@ BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|||||||
|
|
||||||
TSharedRef<FSlateStyleSet> FFLESHEditorStyle::Create()
|
TSharedRef<FSlateStyleSet> FFLESHEditorStyle::Create()
|
||||||
{
|
{
|
||||||
TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet(GetStyleSetName()));
|
TSharedRef<FSlateStyleSet> Style = MakeShareable(new FSlateStyleSet(GetStyleSetName()));
|
||||||
StyleRef->SetContentRoot(IPluginManager::Get().FindPlugin(TEXT("FLESH"))->GetBaseDir() / TEXT("Resources"));
|
Style->SetContentRoot(IPluginManager::Get().FindPlugin("FLESH")->GetBaseDir() / TEXT("Resources"));
|
||||||
|
|
||||||
// Button styles
|
// Set editor icon
|
||||||
const FVector2D Icon16x16(16.0f, 16.0f);
|
Style->Set("FLESHEditor.OpenPluginWindow", new FSlateImageBrush(Style->RootToContentDir(TEXT("ButtonIcon_40x"), TEXT(".png")), FVector2D(40.0f, 40.0f)));
|
||||||
const FVector2D Icon20x20(20.0f, 20.0f);
|
|
||||||
const FVector2D Icon40x40(40.0f, 40.0f);
|
|
||||||
const FVector2D Icon64x64(64.0f, 64.0f);
|
|
||||||
const FVector2D Icon128x128(128.0f, 128.0f);
|
|
||||||
|
|
||||||
// Main FLESH editor button
|
// Set editor colors
|
||||||
StyleRef->Set("FLESHEditor.OpenFLESHEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
const FLinearColor MainColor(0.8f, 0.1f, 0.1f, 1.0f); // Blood red
|
||||||
StyleRef->Set("FLESHEditor.OpenFLESHEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
const FLinearColor DarkColor(0.4f, 0.05f, 0.05f, 1.0f); // Dark red
|
||||||
|
const FLinearColor LightColor(1.0f, 0.3f, 0.3f, 1.0f); // Light red
|
||||||
|
|
||||||
// Dismemberment graph editor button
|
// Set editor button style
|
||||||
StyleRef->Set("FLESHEditor.OpenDismembermentGraphEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
const FButtonStyle& DefaultButtonStyle = FCoreStyle::Get().GetWidgetStyle<FButtonStyle>("Button");
|
||||||
StyleRef->Set("FLESHEditor.OpenDismembermentGraphEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
|
||||||
|
|
||||||
// Anatomical layer editor button
|
FButtonStyle RedButtonStyle = DefaultButtonStyle;
|
||||||
StyleRef->Set("FLESHEditor.OpenAnatomicalLayerEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
RedButtonStyle.Normal.TintColor = MainColor;
|
||||||
StyleRef->Set("FLESHEditor.OpenAnatomicalLayerEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
RedButtonStyle.Hovered.TintColor = LightColor;
|
||||||
|
RedButtonStyle.Pressed.TintColor = DarkColor;
|
||||||
|
Style->Set("FLESHEditor.RedButton", RedButtonStyle);
|
||||||
|
|
||||||
// Boolean cut tool button
|
return Style;
|
||||||
StyleRef->Set("FLESHEditor.OpenBooleanCutTool", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
|
||||||
StyleRef->Set("FLESHEditor.OpenBooleanCutTool.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
|
||||||
|
|
||||||
// Blood system editor button
|
|
||||||
StyleRef->Set("FLESHEditor.OpenBloodSystemEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
|
||||||
StyleRef->Set("FLESHEditor.OpenBloodSystemEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
|
||||||
|
|
||||||
// Button style - rounded corners
|
|
||||||
const FButtonStyle RoundedButtonStyle = FButtonStyle()
|
|
||||||
.SetNormal(FSlateRoundedBoxBrush(FLinearColor(0.05f, 0.05f, 0.05f, 1.0f), 8.0f))
|
|
||||||
.SetHovered(FSlateRoundedBoxBrush(FLinearColor(0.1f, 0.1f, 0.1f, 1.0f), 8.0f))
|
|
||||||
.SetPressed(FSlateRoundedBoxBrush(FLinearColor(0.2f, 0.2f, 0.2f, 1.0f), 8.0f))
|
|
||||||
.SetNormalPadding(FMargin(4, 2, 4, 2))
|
|
||||||
.SetPressedPadding(FMargin(4, 3, 4, 1));
|
|
||||||
|
|
||||||
StyleRef->Set("FLESHEditor.RoundedButton", RoundedButtonStyle);
|
|
||||||
|
|
||||||
return StyleRef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||||
|
Reference in New Issue
Block a user