|
@@ -1,34 +1,294 @@
|
|
|
-// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
+// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
+
|
|
|
+// #include "FDialogueDeductionGraphEditor.h"
|
|
|
+// #include "FDialogueDeEditorApplicationMode.h"
|
|
|
+// #include "DialogueDeductionModule.h"
|
|
|
#include "EzAbilityEditor.h"
|
|
|
-#include "EzAbility.h"
|
|
|
-#include "EZAbilityBlueprint.h"
|
|
|
-#include "EzAbilityGraphEditor.h"
|
|
|
+#include "Kismet2/BlueprintEditorUtils.h"
|
|
|
+//#include "DialogueDeductionEdGraph.h"
|
|
|
+#include "SBlueprintEditorToolbar.h"
|
|
|
+#include "Kismet2/DebuggerCommands.h"
|
|
|
+#include "WorkflowOrientedApp/WorkflowUObjectDocuments.h"
|
|
|
+#include "EditorStyleSet.h"
|
|
|
+#include "../Public/EZAbilityBlueprint.h"
|
|
|
+#include "EzAbilityEditorApplicationMode.h"
|
|
|
+#include "EzAbilityEditorModule.h"
|
|
|
+//#include "DialogueEditorTabs.h"
|
|
|
+//#include "SEditorViewport.h"
|
|
|
+//#include "SDialogueEditorViewport.h"
|
|
|
+
|
|
|
+
|
|
|
+#define LOCTEXT_NAMESPACE "EzAbilityEditor"
|
|
|
|
|
|
-DEFINE_LOG_CATEGORY(LogEzAbilityEditor);
|
|
|
+const FName FEzAbilityEditor::EzAbilityEditorMode(TEXT("AbilityEditor"));
|
|
|
+//
|
|
|
+// UMBRData* FDialogueDeductionGraphEditor::GetDialogueDeduction() const
|
|
|
+// {
|
|
|
+// return TestDataAsset;
|
|
|
+// }
|
|
|
|
|
|
-#define LOCTEXT_NAMESPACE "FEzAbilityEditorModule"
|
|
|
|
|
|
-const FName FEzAbilityEditorModule::AbilityEditorAppId(TEXT("AbilityEditorApp"));
|
|
|
+FEzAbilityEditor::FEzAbilityEditor()
|
|
|
+{
|
|
|
+}
|
|
|
|
|
|
-TSharedRef<class FEzAbilityEditor> FEzAbilityEditorModule::CreateEzAbilityEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, class UEZAbilityBlueprint* EzAbilityAsset)
|
|
|
+FEzAbilityEditor::~FEzAbilityEditor()
|
|
|
{
|
|
|
- TSharedRef< FEzAbilityEditor > NewAbilityEditor(new FEzAbilityEditor());
|
|
|
- NewAbilityEditor->InitEzAbilityEditor(Mode, InitToolkitHost,EzAbilityAsset);
|
|
|
- return NewAbilityEditor;
|
|
|
}
|
|
|
|
|
|
-void FEzAbilityEditorModule::StartupModule()
|
|
|
+void FEzAbilityEditor::InitEzAbilityEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UEZAbilityBlueprint* InEzAbilityAsset)
|
|
|
{
|
|
|
- // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
|
|
+ EzAbilityDataAsset = InEzAbilityAsset;
|
|
|
+
|
|
|
+ /* 这里面需要注册FPersonaModule 之类的东西 */
|
|
|
+ /*if (!Toolbar.IsValid())
|
|
|
+ {
|
|
|
+ Toolbar = MakeShareable(new FBlueprintEditorToolbar(SharedThis(this)));
|
|
|
+ }*/
|
|
|
+
|
|
|
+ GetToolkitCommands()->Append(FPlayWorldCommands::GlobalPlayWorldActions.ToSharedRef());
|
|
|
+
|
|
|
+ //CreateDefaultCommands();
|
|
|
+
|
|
|
+ //BindCommands();
|
|
|
+
|
|
|
+ //RegisterMenus();
|
|
|
+
|
|
|
+ TArray<UObject*> ObjectsToEdit;
|
|
|
+ ObjectsToEdit.Add((UObject*)EzAbilityDataAsset);
|
|
|
+
|
|
|
+ const TSharedRef<FTabManager::FLayout> DummyLayout = FTabManager::NewLayout("NullLayout")->AddArea(FTabManager::NewPrimaryArea());
|
|
|
+ const bool bCreateDefaultStandaloneMenu = true;
|
|
|
+ const bool bCreateDefaultToolbar = true;
|
|
|
+
|
|
|
+ InitAssetEditor(Mode, InitToolkitHost, FEzAbilityEditorModule::AbilityEditorAppId, DummyLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, ObjectsToEdit);
|
|
|
+
|
|
|
+ TArray<UBlueprint*> EditedBlueprints;
|
|
|
+ EditedBlueprints.Add((UBlueprint*)EzAbilityDataAsset);
|
|
|
+
|
|
|
+ //CommonInitialization(EditedBlueprints, false); /* 构建Tab 没有的情况下 CreateDefaultTabContents 下个智能指针会崩溃*/
|
|
|
+
|
|
|
+ AddApplicationMode(EzAbilityEditorMode,
|
|
|
+ MakeShareable(new FEzAbilityEditorApplicationMode(SharedThis(this), SharedThis(this))));
|
|
|
+ //AddApplicationMode(EzAbilityEditorMode, MakeShareable(new FDialogueDeEditorApplicationMode(SharedThis(this))));
|
|
|
+
|
|
|
+ RegenerateMenusAndToolbars();
|
|
|
+
|
|
|
+ SetCurrentMode(EzAbilityEditorMode);
|
|
|
+
|
|
|
+ //PostLayoutBlueprintEditorInitialization();
|
|
|
}
|
|
|
|
|
|
-void FEzAbilityEditorModule::ShutdownModule()
|
|
|
+// void FEzAbilityEditor::RegisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
|
+// {
|
|
|
+// WorkspaceMenuCategory = InTabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_AbilityEditor", "Ability Editor"));
|
|
|
+//
|
|
|
+// FAssetEditorToolkit::RegisterTabSpawners(InTabManager);
|
|
|
+// }
|
|
|
+//
|
|
|
+// void FEzAbilityEditor::UnregisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
|
+// {
|
|
|
+// FAssetEditorToolkit::UnregisterTabSpawners(InTabManager);
|
|
|
+// }
|
|
|
+
|
|
|
+FText FEzAbilityEditor::GetLocalizedMode(FName InMode)
|
|
|
{
|
|
|
- // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
|
|
- // we call this function before unloading the module.
|
|
|
+ static TMap< FName, FText > LocModes;
|
|
|
+
|
|
|
+ if (LocModes.Num() == 0)
|
|
|
+ {
|
|
|
+ LocModes.Add(EzAbilityEditorMode, LOCTEXT("EzAbilityEditorMode", "Ability Editor"));
|
|
|
+ }
|
|
|
+
|
|
|
+ check(InMode != NAME_None);
|
|
|
+ const FText* OutDesc = LocModes.Find(InMode);
|
|
|
+ check(OutDesc);
|
|
|
+ return *OutDesc;
|
|
|
}
|
|
|
|
|
|
-#undef LOCTEXT_NAMESPACE
|
|
|
+FName FEzAbilityEditor::GetToolkitFName() const
|
|
|
+{
|
|
|
+ return FName("EzAbilityEditor");
|
|
|
+}
|
|
|
+
|
|
|
+FText FEzAbilityEditor::GetBaseToolkitName() const
|
|
|
+{
|
|
|
+ return FText(LOCTEXT("EzAbilityEditor", "EzAbilityEditor"));
|
|
|
+}
|
|
|
+
|
|
|
+FString FEzAbilityEditor::GetWorldCentricTabPrefix() const
|
|
|
+{
|
|
|
+ return "EzAbilityWorldCentricTabPrefix";
|
|
|
+}
|
|
|
+
|
|
|
+void FEzAbilityEditor::InvokeTab(const struct FTabId& TabId)
|
|
|
+{
|
|
|
|
|
|
-IMPLEMENT_MODULE(FEzAbilityEditorModule, EzAbilityEditor)
|
|
|
+}
|
|
|
+
|
|
|
+FLinearColor FEzAbilityEditor::GetWorldCentricTabColorScale() const
|
|
|
+{
|
|
|
+ return FLinearColor(0.0f, 0.0f, 0.3f, 0.5f);
|
|
|
+}
|
|
|
+
|
|
|
+void FEzAbilityEditor::RegisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
|
+{
|
|
|
+ WorkspaceMenuCategory = InTabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_AbilityEditor", "Ability Editor"));
|
|
|
+
|
|
|
+ FAssetEditorToolkit::RegisterTabSpawners(InTabManager);
|
|
|
+}
|
|
|
+
|
|
|
+void FEzAbilityEditor::UnregisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
|
+{
|
|
|
+ FAssetEditorToolkit::UnregisterTabSpawners(InTabManager);
|
|
|
+}
|
|
|
+
|
|
|
+// void FDialogueDeductionGraphEditor::CreateInternalWidgets()
|
|
|
+// {
|
|
|
+// FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
|
|
+// FDetailsViewArgs DetailsViewArgs;
|
|
|
+// DetailsViewArgs.bUpdatesFromSelection = false;
|
|
|
+// DetailsViewArgs.bLockable = false;
|
|
|
+// DetailsViewArgs.bAllowSearch = true;
|
|
|
+// DetailsViewArgs.NameAreaSettings = FDetailsViewArgs::HideNameArea;
|
|
|
+// DetailsViewArgs.bHideSelectionTip = false;
|
|
|
+// DetailsViewArgs.NotifyHook = this;
|
|
|
+// DetailsViewArgs.DefaultsOnlyVisibility = EEditDefaultsOnlyNodeVisibility::Hide;
|
|
|
+// DetailsView = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
|
|
|
+// DetailsView->SetObject(NULL);
|
|
|
+// //DetailsView->OnFinishedChangingProperties().AddSP(this, &FDialogueGraphEditor::OnFinishedChangingProperties);
|
|
|
+// }
|
|
|
+//
|
|
|
+// FText FDialogueDeductionGraphEditor::GetLocalizedMode(FName InMode)
|
|
|
+// {
|
|
|
+// static TMap< FName, FText > LocModes;
|
|
|
+//
|
|
|
+// if (LocModes.Num() == 0)
|
|
|
+// {
|
|
|
+// LocModes.Add(DialogueEditorMode, LOCTEXT("DialogueEditorMode", "Dialogue Graph"));
|
|
|
+// }
|
|
|
+//
|
|
|
+// check(InMode != NAME_None);
|
|
|
+// const FText* OutDesc = LocModes.Find(InMode);
|
|
|
+// check(OutDesc);
|
|
|
+// return *OutDesc;
|
|
|
+// }
|
|
|
+//
|
|
|
+// void FDialogueDeductionGraphEditor::InitDialogueEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UMBRData* InDialogue)
|
|
|
+// {
|
|
|
+// TestDataAsset = InDialogue;
|
|
|
+//
|
|
|
+// if (!Toolbar.IsValid())
|
|
|
+// {
|
|
|
+// Toolbar = MakeShareable(new FBlueprintEditorToolbar(SharedThis(this)));
|
|
|
+// }
|
|
|
+//
|
|
|
+// GetToolkitCommands()->Append(FPlayWorldCommands::GlobalPlayWorldActions.ToSharedRef());
|
|
|
+//
|
|
|
+// CreateDefaultCommands();
|
|
|
+// //BindCommands();
|
|
|
+// RegisterMenus();
|
|
|
+//
|
|
|
+// CreateInternalWidgets();
|
|
|
+//
|
|
|
+//
|
|
|
+// TArray<UObject*> ObjectsToEdit;
|
|
|
+// ObjectsToEdit.Add((UObject*)TestDataAsset);
|
|
|
+//
|
|
|
+// const bool bCreateDefaultStandaloneMenu = true;
|
|
|
+// const bool bCreateDefaultToolbar = true;
|
|
|
+//
|
|
|
+// InitAssetEditor(Mode, InitToolkitHost, FDialogueDeductionModule::DialogueEditorAppId, FTabManager::FLayout::NullLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, ObjectsToEdit);
|
|
|
+//
|
|
|
+// TArray<UBlueprint*> EditedBlueprints;
|
|
|
+// EditedBlueprints.Add((UBlueprint*)TestDataAsset);
|
|
|
+//
|
|
|
+// CommonInitialization(EditedBlueprints, false); /* 构建Tab 没有的情况下 CreateDefaultTabContents 下个智能指针会崩溃*/
|
|
|
+//
|
|
|
+// AddApplicationMode(DialogueEditorMode, MakeShareable(new FDialogueDeEditorApplicationMode(SharedThis(this))));
|
|
|
+//
|
|
|
+// RegenerateMenusAndToolbars();
|
|
|
+//
|
|
|
+// SetCurrentMode(DialogueEditorMode);
|
|
|
+//
|
|
|
+// PostLayoutBlueprintEditorInitialization();
|
|
|
+//
|
|
|
+// // FLevelEditorModule& LevelEditor = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
|
|
|
+// // LevelEditor.OnMapChanged().AddRaw(this, &FDialogueGraphEditor::OnWorldChange);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// void FDialogueDeductionGraphEditor::RestoreDialogueGraph()
|
|
|
+// {
|
|
|
+// //此处为打开一个图表
|
|
|
+// UDialogueDeductionEdGraph* TestEdGraph =Cast<UDialogueDeductionEdGraph>( FBlueprintEditorUtils::CreateNewGraph((UObject*)TestDataAsset, TEXT("Dialogue Graph"), UDialogueDeductionEdGraph::StaticClass(), UEdGraphSchema::StaticClass()));
|
|
|
+//
|
|
|
+// bool bNewGraph = true;
|
|
|
+//
|
|
|
+// FBlueprintEditorUtils::AddUbergraphPage((UBlueprint*)TestDataAsset, TestEdGraph);
|
|
|
+//
|
|
|
+//
|
|
|
+// TSharedRef<FTabPayload_UObject> Payload = FTabPayload_UObject::Make(TestEdGraph);
|
|
|
+// TSharedPtr<SDockTab> DocumentTab = DocumentManager->OpenDocument(Payload, bNewGraph ? FDocumentTracker::OpenNewDocument : FDocumentTracker::RestorePreviousDocument);
|
|
|
+//
|
|
|
+// if (TestDataAsset->LastEditedDocuments.Num() > 0)
|
|
|
+// {
|
|
|
+// TSharedRef<SGraphEditor> GraphEditor = StaticCastSharedRef<SGraphEditor>(DocumentTab->GetContent());
|
|
|
+// GraphEditor->SetViewLocation(TestDataAsset->LastEditedDocuments[0].SavedViewOffset, TestDataAsset->LastEditedDocuments[0].SavedZoomAmount);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// TSharedRef<SDockTab> FDialogueDeductionGraphEditor::SpawnTab_Viewport(const FSpawnTabArgs& Args)
|
|
|
+// {
|
|
|
+// TSharedPtr<FDialogueDeductionGraphEditor> DialogueEditorPtr = SharedThis(this);
|
|
|
+//
|
|
|
+// // return SNew(SDockTab)
|
|
|
+// // .Label(LOCTEXT("ViewportTab_Title", "Viewport"))
|
|
|
+// // [
|
|
|
+// // SAssignNew(DialogueViewportWidget, SDialogueViewportWidget, DialogueEditorPtr)
|
|
|
+// // .Dialogue(DialogueBeingEdited)
|
|
|
+// // ];
|
|
|
+//
|
|
|
+// // return SNew(SDockTab)
|
|
|
+// // [
|
|
|
+// // SNew(STextBlock)
|
|
|
+// // .Text(FText::FromString("Hello, New Tab Content !"))
|
|
|
+// // ];
|
|
|
+//
|
|
|
+// //TSharedPtr<FDialogueEditor> DialogueEditorPtr = SharedThis(this);
|
|
|
+// return SNew(SDockTab)
|
|
|
+// .Label(LOCTEXT("Viewport01Tab_Title", "Viewport01"))
|
|
|
+// [
|
|
|
+// //SAssignNew(DialogueEditorViewport, SDialogueEditorViewport)
|
|
|
+// //.TestMBR(TestDataAsset)
|
|
|
+// SAssignNew(DialogueEditorViewport, SDialogueEditorViewport)
|
|
|
+// .TestMBR(TestDataAsset)
|
|
|
+// ];
|
|
|
+// }
|
|
|
+//
|
|
|
+// void FDialogueDeductionGraphEditor::RegisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
|
+// {
|
|
|
+// DocumentManager->SetTabManager(InTabManager);
|
|
|
+//
|
|
|
+// //FWorkflowCentricApplication::RegisterTabSpawners(InTabManager);
|
|
|
+//
|
|
|
+// WorkspaceMenuCategory = InTabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_AAAA", "Environment Query Editor"));
|
|
|
+// auto WorkspaceMenuCategoryRef = WorkspaceMenuCategory.ToSharedRef();
|
|
|
+//
|
|
|
+// InTabManager->RegisterTabSpawner(FDialogueEditorTabs::DialogueView, FOnSpawnTab::CreateSP(this, &FDialogueDeductionGraphEditor::SpawnTab_Viewport))
|
|
|
+// .SetDisplayName(LOCTEXT("ViewportTab", "Viewport"))
|
|
|
+// .SetGroup(WorkspaceMenuCategoryRef)
|
|
|
+// .SetIcon(FSlateIcon(FAppStyle::GetAppStyleSetName(), "LevelEditor.Tabs.Viewports"));
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// void FDialogueDeductionGraphEditor::RegisterToolbarTab(const TSharedRef<class FTabManager>& InTabManager)
|
|
|
+// {
|
|
|
+// //FAssetEditorToolkit::RegisterTabSpawners(InTabManager);
|
|
|
+// RegisterTabSpawners(InTabManager);
|
|
|
+// }
|
|
|
+
|
|
|
+#undef LOCTEXT_NAMESPACE
|