76 lines
2.2 KiB
C++
76 lines
2.2 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "DialogueAsset.h"
|
|
#include "GraphEditor.h"
|
|
#include "WorkflowOrientedApp/WorkflowCentricApplication.h"
|
|
|
|
class UDialogueGraph;
|
|
class IDetailsView;
|
|
class UDialogueGraphNode_Base;
|
|
|
|
/**
|
|
* 对话编辑器工具包
|
|
*/
|
|
class DIALOGUEEDITOR_API FDialogueAssetEditor : public FWorkflowCentricApplication, public FEditorUndoClient, public FNotifyHook
|
|
{
|
|
public:
|
|
/** IAssetEditorToolkit interface */
|
|
virtual FName GetToolkitFName() const override { return FName("DialogueEditor"); }
|
|
virtual FText GetBaseToolkitName() const override;
|
|
virtual FString GetWorldCentricTabPrefix() const override { return TEXT("DialogueEditor"); }
|
|
virtual FLinearColor GetWorldCentricTabColorScale() const override { return FLinearColor::White; }
|
|
|
|
virtual void OnClose() override;
|
|
/** IAssetEditorToolkit interface */
|
|
|
|
FDialogueAssetEditor();
|
|
virtual ~FDialogueAssetEditor();
|
|
|
|
public:
|
|
void InitDialogueEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, TObjectPtr<class UDialogueAsset> InitDialogueAsset);
|
|
|
|
// 获取图表
|
|
UEdGraph* GetDialogueGraph() const { return DialogueGraph; }
|
|
|
|
// 设置图表编辑器
|
|
void SetGraphEditor(TSharedPtr<SGraphEditor> InGraphEditor) { GraphEditor = InGraphEditor; }
|
|
|
|
// 设置细节面板
|
|
void SetDetailsView(TSharedPtr<IDetailsView> InDetailsView);
|
|
|
|
// 图表选择改变回调,传递属性页需要显示的内容
|
|
void OnGraphSelectionChanged(const FGraphPanelSelectionSet& Selection);
|
|
|
|
protected:
|
|
void SaveGraphData();
|
|
void LoadGraphData();
|
|
protected:
|
|
TObjectPtr<UDialogueAsset> DialogueBeingEdited;
|
|
|
|
// 图表对象
|
|
UEdGraph* DialogueGraph;
|
|
|
|
// 图表编辑器Widget
|
|
TSharedPtr<SGraphEditor> GraphEditor;
|
|
|
|
// 细节面板
|
|
TSharedPtr<IDetailsView> DetailsView;
|
|
|
|
private:
|
|
// 绑定图表命令
|
|
void BindGraphCommands();
|
|
|
|
// 删除选中节点
|
|
void DeleteSelectedNodes();
|
|
bool CanDeleteNodes();
|
|
|
|
// 获取选中节点
|
|
UDialogueGraphNode_Base* GetSelectedNode(const FGraphPanelSelectionSet& Selection);
|
|
|
|
// 属性更新回调
|
|
void OnNodeDetailViewPropertiesUpdated(const FPropertyChangedEvent& Event);
|
|
};
|