更新 Source/FLESHEditor/Private/FLESHEditorStyle.cpp
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include "Styling/CoreStyle.h"
|
||||
#include "Interfaces/IPluginManager.h"
|
||||
#include "SlateOptMacros.h"
|
||||
#include "Styling/SlateStyle.h"
|
||||
#include "Brushes/SlateImageBrush.h"
|
||||
|
||||
TSharedPtr<FSlateStyleSet> FFLESHEditorStyle::StyleInstance = nullptr;
|
||||
|
||||
@@ -46,47 +48,27 @@ BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
||||
TSharedRef<FSlateStyleSet> FFLESHEditorStyle::Create()
|
||||
{
|
||||
TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet(GetStyleSetName()));
|
||||
StyleRef->SetContentRoot(IPluginManager::Get().FindPlugin(TEXT("FLESH"))->GetBaseDir() / TEXT("Resources"));
|
||||
TSharedRef<FSlateStyleSet> Style = MakeShareable(new FSlateStyleSet(GetStyleSetName()));
|
||||
Style->SetContentRoot(IPluginManager::Get().FindPlugin("FLESH")->GetBaseDir() / TEXT("Resources"));
|
||||
|
||||
// Button styles
|
||||
const FVector2D Icon16x16(16.0f, 16.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
|
||||
StyleRef->Set("FLESHEditor.OpenFLESHEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
||||
StyleRef->Set("FLESHEditor.OpenFLESHEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
||||
|
||||
// Dismemberment graph editor button
|
||||
StyleRef->Set("FLESHEditor.OpenDismembermentGraphEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
||||
StyleRef->Set("FLESHEditor.OpenDismembermentGraphEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
||||
|
||||
// Anatomical layer editor button
|
||||
StyleRef->Set("FLESHEditor.OpenAnatomicalLayerEditor", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon40x40));
|
||||
StyleRef->Set("FLESHEditor.OpenAnatomicalLayerEditor.Small", new FSlateImageBrush(StyleRef->RootToContentDir(TEXT("Icon128.png")), Icon20x20));
|
||||
|
||||
// Boolean cut tool button
|
||||
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;
|
||||
// Set editor icon
|
||||
Style->Set("FLESHEditor.OpenPluginWindow", new FSlateImageBrush(Style->RootToContentDir(TEXT("ButtonIcon_40x"), TEXT(".png")), FVector2D(40.0f, 40.0f)));
|
||||
|
||||
// Set editor colors
|
||||
const FLinearColor MainColor(0.8f, 0.1f, 0.1f, 1.0f); // Blood red
|
||||
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
|
||||
|
||||
// Set editor button style
|
||||
const FButtonStyle& DefaultButtonStyle = FCoreStyle::Get().GetWidgetStyle<FButtonStyle>("Button");
|
||||
|
||||
FButtonStyle RedButtonStyle = DefaultButtonStyle;
|
||||
RedButtonStyle.Normal.TintColor = MainColor;
|
||||
RedButtonStyle.Hovered.TintColor = LightColor;
|
||||
RedButtonStyle.Pressed.TintColor = DarkColor;
|
||||
Style->Set("FLESHEditor.RedButton", RedButtonStyle);
|
||||
|
||||
return Style;
|
||||
}
|
||||
|
||||
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
||||
|
Reference in New Issue
Block a user