|
@@ -0,0 +1,225 @@
|
|
|
+// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
+
|
|
|
+
|
|
|
+// #include "FDialogueDeductionGraphEditor.h"
|
|
|
+// #include "FDialogueDeEditorApplicationMode.h"
|
|
|
+// #include "DialogueDeductionModule.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 "DialogueEditorTabs.h"
|
|
|
+//#include "SEditorViewport.h"
|
|
|
+//#include "SDialogueEditorViewport.h"
|
|
|
+
|
|
|
+
|
|
|
+#define LOCTEXT_NAMESPACE "EzAbilityEditor"
|
|
|
+
|
|
|
+const FName FEzAbilityEditor::EzAbilityEditorMode(TEXT("AbilityEditor"));
|
|
|
+//
|
|
|
+// UMBRData* FDialogueDeductionGraphEditor::GetDialogueDeduction() const
|
|
|
+// {
|
|
|
+// return TestDataAsset;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+FEzAbilityEditor::FEzAbilityEditor()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+FEzAbilityEditor::~FEzAbilityEditor()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void FEzAbilityEditor::InitEzAbilityEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UEZAbilityBlueprint* InEzAbilityAsset)
|
|
|
+{
|
|
|
+ EzAbilityDataAsset = InEzAbilityAsset;
|
|
|
+
|
|
|
+ if (!Toolbar.IsValid())
|
|
|
+ {
|
|
|
+ Toolbar = MakeShareable(new FBlueprintEditorToolbar(SharedThis(this)));
|
|
|
+ }
|
|
|
+
|
|
|
+ GetToolkitCommands()->Append(FPlayWorldCommands::GlobalPlayWorldActions.ToSharedRef());
|
|
|
+
|
|
|
+ CreateDefaultCommands();
|
|
|
+ //BindCommands();
|
|
|
+ RegisterMenus();
|
|
|
+
|
|
|
+ //CreateInternalWidgets();
|
|
|
+
|
|
|
+
|
|
|
+ TArray<UObject*> ObjectsToEdit;
|
|
|
+ ObjectsToEdit.Add((UObject*)EzAbilityDataAsset);
|
|
|
+
|
|
|
+ const bool bCreateDefaultStandaloneMenu = true;
|
|
|
+ const bool bCreateDefaultToolbar = true;
|
|
|
+
|
|
|
+ InitAssetEditor(Mode, InitToolkitHost, FEzAbilityEditorModule::AbilityEditorAppId, FTabManager::FLayout::NullLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, ObjectsToEdit);
|
|
|
+
|
|
|
+ TArray<UBlueprint*> EditedBlueprints;
|
|
|
+ EditedBlueprints.Add((UBlueprint*)EzAbilityDataAsset);
|
|
|
+
|
|
|
+ CommonInitialization(EditedBlueprints, false); /* 构建Tab 没有的情况下 CreateDefaultTabContents 下个智能指针会崩溃*/
|
|
|
+
|
|
|
+ //AddApplicationMode(EzAbilityEditorMode, MakeShareable(new FDialogueDeEditorApplicationMode(SharedThis(this))));
|
|
|
+
|
|
|
+ RegenerateMenusAndToolbars();
|
|
|
+
|
|
|
+ SetCurrentMode(EzAbilityEditorMode);
|
|
|
+
|
|
|
+ PostLayoutBlueprintEditorInitialization();
|
|
|
+}
|
|
|
+
|
|
|
+// 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
|