81 lines
2.5 KiB
C++
81 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Toolkits/AssetEditorToolkit.h"
|
|
#include "GraphEditor.h"
|
|
|
|
class UDismembermentGraphAsset;
|
|
class UDismembermentGraph;
|
|
class SDockTab;
|
|
|
|
/**
|
|
* Dismemberment graph editor
|
|
* Provides a Mutable-like node editor for dismemberment system logic
|
|
*/
|
|
class FLESHEDITOR_API FDismembermentGraphEditor : public FAssetEditorToolkit
|
|
{
|
|
public:
|
|
FDismembermentGraphEditor();
|
|
virtual ~FDismembermentGraphEditor();
|
|
|
|
// Initialize the editor
|
|
void InitDismembermentGraphEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost>& InitToolkitHost, UDismembermentGraphAsset* InAsset);
|
|
|
|
// FAssetEditorToolkit interface
|
|
virtual void RegisterTabSpawners(const TSharedRef<FTabManager>& TabManager) override;
|
|
virtual void UnregisterTabSpawners(const TSharedRef<FTabManager>& TabManager) override;
|
|
virtual FName GetToolkitFName() const override;
|
|
virtual FText GetBaseToolkitName() const override;
|
|
virtual FString GetWorldCentricTabPrefix() const override;
|
|
virtual FLinearColor GetWorldCentricTabColorScale() const override;
|
|
// End of FAssetEditorToolkit interface
|
|
|
|
// Get the edited asset
|
|
UDismembermentGraphAsset* GetEditedAsset() const { return EditedAsset; }
|
|
|
|
// Get the graph editor widget
|
|
TSharedRef<SGraphEditor> GetGraphEditor() const { return GraphEditorWidget.ToSharedRef(); }
|
|
|
|
private:
|
|
// The asset being edited
|
|
UDismembermentGraphAsset* EditedAsset;
|
|
|
|
// The graph editor widget
|
|
TSharedPtr<SGraphEditor> GraphEditorWidget;
|
|
|
|
// Tab spawners
|
|
TSharedRef<SDockTab> SpawnTab_GraphCanvas(const FSpawnTabArgs& Args);
|
|
TSharedRef<SDockTab> SpawnTab_Properties(const FSpawnTabArgs& Args);
|
|
TSharedRef<SDockTab> SpawnTab_Palette(const FSpawnTabArgs& Args);
|
|
|
|
// Create graph editor widget
|
|
TSharedRef<SGraphEditor> CreateGraphEditorWidget();
|
|
|
|
// Graph editor commands
|
|
void CreateCommandList();
|
|
TSharedPtr<FUICommandList> GraphEditorCommands;
|
|
|
|
// Command handlers
|
|
void SelectAllNodes();
|
|
void DeleteSelectedNodes();
|
|
void CutSelectedNodes();
|
|
void CopySelectedNodes();
|
|
void PasteNodes();
|
|
void DuplicateSelectedNodes();
|
|
|
|
// Graph changed handler
|
|
void OnGraphChanged(const FEdGraphEditAction& Action);
|
|
|
|
// Node selection changed handler
|
|
void OnSelectedNodesChanged(const TSet<UObject*>& NewSelection);
|
|
|
|
// Compile the graph
|
|
void CompileGraph();
|
|
|
|
// Properties panel
|
|
TSharedPtr<class IDetailsView> PropertiesWidget;
|
|
|
|
// Node palette
|
|
TSharedPtr<class SDismembermentGraphPalette> PaletteWidget;
|
|
};
|