This commit is contained in:
2025-04-18 18:17:02 +08:00
parent 80fdce96b2
commit e15eafe5d4
18 changed files with 259 additions and 493 deletions

View File

@@ -9,7 +9,7 @@
#include "Widgets/Layout/SBorder.h"
#include "Widgets/Input/SButton.h"
#include "PropertyEditorModule.h"
#include "EditorStyleSet.h"
#include "Styling/AppStyle.h"
#include "LevelEditor.h"
#include "ToolMenus.h"
@@ -30,10 +30,10 @@ FFLESHEditor::~FFLESHEditor()
{
}
void FFLESHEditor::InitFLESHEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost)
void FFLESHEditor::InitFLESHEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, UObject* InObject)
{
// Create command list
CreateCommandList();
this->CreateCommandList();
// Create tab layout
const TSharedRef<FTabManager::FLayout> StandaloneDefaultLayout = FTabManager::NewLayout("FLESHEditorLayout_v1.0")
@@ -89,7 +89,7 @@ void FFLESHEditor::InitFLESHEditor(const EToolkitMode::Type Mode, const TSharedP
// Initialize toolkit
const bool bCreateDefaultStandaloneMenu = true;
const bool bCreateDefaultToolbar = true;
FAssetEditorToolkit::InitAssetEditor(Mode, InitToolkitHost, FName("FLESHEditorApp"), StandaloneDefaultLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar);
this->InitAssetEditor(Mode, InitToolkitHost, FName("FLESHEditorApp"), StandaloneDefaultLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, InObject, false);
}
void FFLESHEditor::RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManager)
@@ -100,32 +100,32 @@ void FFLESHEditor::RegisterTabSpawners(const TSharedRef<FTabManager>& InTabManag
InTabManager->RegisterTabSpawner(ViewportTabId, FOnSpawnTab::CreateSP(this, &FFLESHEditor::SpawnTab_Viewport))
.SetDisplayName(LOCTEXT("ViewportTab", "Viewport"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef())
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Viewports"));
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.Viewports"));
InTabManager->RegisterTabSpawner(DetailsTabId, FOnSpawnTab::CreateSP(this, &FFLESHEditor::SpawnTab_Details))
.SetDisplayName(LOCTEXT("DetailsTab", "Details"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef())
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.Details"));
InTabManager->RegisterTabSpawner(AssetBrowserTabId, FOnSpawnTab::CreateSP(this, &FFLESHEditor::SpawnTab_AssetBrowser))
.SetDisplayName(LOCTEXT("AssetBrowserTab", "Asset Browser"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef())
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "ContentBrowser.TabIcon"));
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "ContentBrowser.TabIcon"));
InTabManager->RegisterTabSpawner(MatrixEditorTabId, FOnSpawnTab::CreateSP(this, &FFLESHEditor::SpawnTab_MatrixEditor))
.SetDisplayName(LOCTEXT("MatrixEditorTab", "Matrix Editor"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef())
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "PropertyEditor.Grid.TabIcon"));
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "PropertyEditor.Grid.TabIcon"));
InTabManager->RegisterTabSpawner(GraphEditorTabId, FOnSpawnTab::CreateSP(this, &FFLESHEditor::SpawnTab_GraphEditor))
.SetDisplayName(LOCTEXT("GraphEditorTab", "Graph Editor"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef())
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "GraphEditor.EventGraph_16x"));
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "GraphEditor.EventGraph_16x"));
InTabManager->RegisterTabSpawner(ToolbarTabId, FOnSpawnTab::CreateSP(this, &FFLESHEditor::SpawnTab_Toolbar))
.SetDisplayName(LOCTEXT("ToolbarTab", "Toolbar"))
.SetGroup(WorkspaceMenuCategory.ToSharedRef())
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Toolbar"));
.SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.Toolbar"));
}
void FFLESHEditor::UnregisterTabSpawners(const TSharedRef<FTabManager>& InTabManager)
@@ -165,7 +165,7 @@ void FFLESHEditor::OpenEditor()
{
// Create new editor instance
TSharedRef<FFLESHEditor> NewEditor = MakeShareable(new FFLESHEditor());
NewEditor->InitFLESHEditor(EToolkitMode::Standalone, nullptr);
NewEditor->InitFLESHEditor(EToolkitMode::Standalone, nullptr, nullptr);
}
TSharedRef<SDockTab> FFLESHEditor::SpawnTab_Viewport(const FSpawnTabArgs& Args)
@@ -226,7 +226,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateViewportWidget()
{
// Create viewport widget
return SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
.Padding(4.0f)
[
SNew(SVerticalBox)
@@ -235,13 +235,13 @@ TSharedRef<SWidget> FFLESHEditor::CreateViewportWidget()
[
SNew(STextBlock)
.Text(LOCTEXT("ViewportHeader", "FLESH Viewport"))
.Font(FEditorStyle::GetFontStyle("HeadingFont"))
.Font(FAppStyle::GetFontStyle("HeadingFont"))
]
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.DarkGroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.DarkGroupBorder"))
.Padding(4.0f)
[
SNew(STextBlock)
@@ -270,7 +270,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateDetailsWidget()
DetailsWidget = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
return SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
.Padding(4.0f)
[
SNew(SVerticalBox)
@@ -279,7 +279,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateDetailsWidget()
[
SNew(STextBlock)
.Text(LOCTEXT("DetailsHeader", "Property Editor"))
.Font(FEditorStyle::GetFontStyle("HeadingFont"))
.Font(FAppStyle::GetFontStyle("HeadingFont"))
]
+ SVerticalBox::Slot()
.FillHeight(1.0f)
@@ -293,7 +293,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateAssetBrowserWidget()
{
// Create asset browser
return SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
.Padding(4.0f)
[
SNew(SVerticalBox)
@@ -302,7 +302,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateAssetBrowserWidget()
[
SNew(STextBlock)
.Text(LOCTEXT("AssetBrowserHeader", "Asset Browser"))
.Font(FEditorStyle::GetFontStyle("HeadingFont"))
.Font(FAppStyle::GetFontStyle("HeadingFont"))
]
+ SVerticalBox::Slot()
.FillHeight(1.0f)
@@ -358,7 +358,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateMatrixEditorWidget()
});
return SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
.Padding(4.0f)
[
SNew(SVerticalBox)
@@ -367,7 +367,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateMatrixEditorWidget()
[
SNew(STextBlock)
.Text(LOCTEXT("MatrixEditorHeader", "Matrix Editor"))
.Font(FEditorStyle::GetFontStyle("HeadingFont"))
.Font(FAppStyle::GetFontStyle("HeadingFont"))
]
+ SVerticalBox::Slot()
.FillHeight(1.0f)
@@ -390,7 +390,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateGraphEditorWidget()
{
// Create graph editor
return SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
.Padding(4.0f)
[
SNew(SVerticalBox)
@@ -399,13 +399,13 @@ TSharedRef<SWidget> FFLESHEditor::CreateGraphEditorWidget()
[
SNew(STextBlock)
.Text(LOCTEXT("GraphEditorHeader", "Graph Editor"))
.Font(FEditorStyle::GetFontStyle("HeadingFont"))
.Font(FAppStyle::GetFontStyle("HeadingFont"))
]
+ SVerticalBox::Slot()
.FillHeight(1.0f)
[
SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.DarkGroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.DarkGroupBorder"))
.Padding(4.0f)
[
SNew(STextBlock)
@@ -419,7 +419,7 @@ TSharedRef<SWidget> FFLESHEditor::CreateToolbarWidget()
{
// Create toolbar
return SNew(SBorder)
.BorderImage(FEditorStyle::GetBrush("ToolPanel.GroupBorder"))
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
.Padding(4.0f)
[
SNew(SHorizontalBox)