This commit is contained in:
2025-04-21 20:08:05 +08:00
parent 0f34d06513
commit 7c33e9830c
12 changed files with 2160 additions and 2151 deletions

View File

@@ -4,6 +4,8 @@
#include "Toolkits/AssetEditorToolkit.h"
#include "Widgets/Docking/SDockTab.h"
#include "BooleanCutTool.h"
#include "EditorUndoClient.h"
#include "Logging/LogMacros.h"
class SDockTab;
class SGraphEditor;
@@ -13,6 +15,10 @@ class SMatrixInputWidget;
class FFLESHViewportClient;
class FSceneViewport;
class UVisceraNodeObject;
class FDismembermentEditor;
// Define log category
DECLARE_LOG_CATEGORY_EXTERN(LogFLESHEditor, Log, All);
/**
* Bone tree item structure
@@ -181,7 +187,7 @@ struct FVisceraNodeItem : public TSharedFromThis<FVisceraNodeItem>
* FLESH Main Editor
* Provides the main editing functionality for the dismemberment system
*/
class FLESHEDITOR_API FFLESHEditor : public FAssetEditorToolkit
class FLESHEDITOR_API FFLESHEditor : public FAssetEditorToolkit, public FEditorUndoClient
{
public:
FFLESHEditor();
@@ -198,9 +204,27 @@ public:
virtual FString GetWorldCentricTabPrefix() const override;
virtual FLinearColor GetWorldCentricTabColorScale() const override;
// End of FAssetEditorToolkit interface
// FEditorUndoClient interface
virtual void PostUndo(bool bSuccess) override;
virtual void PostRedo(bool bSuccess) override;
// Open the editor
static void OpenEditor();
void OpenEditor();
// Get whether the editor is initialized
bool IsEditorInitialized();
// Get the editing object
UObject* GetEditingObject() const { return EditingObject; }
// Add DismembermentEditor related tab spawners
TSharedRef<SDockTab> SpawnTab_LayerSystem(const FSpawnTabArgs& Args);
TSharedRef<SDockTab> SpawnTab_PhysicsSettings(const FSpawnTabArgs& Args);
// Create DismembermentEditor related widgets
TSharedRef<SBorder> CreateLayerSystemWidget();
TSharedRef<SBorder> CreatePhysicsSettingsWidget();
private:
// Tab spawners
@@ -232,6 +256,9 @@ private:
// Create command list
void CreateCommandList();
// Extend toolbar with custom buttons
void ExtendToolbar();
// Generate bone tree row
TSharedRef<ITableRow> OnGenerateBoneRow(TSharedPtr<FBoneTreeItem> Item, const TSharedRef<STableViewBase>& OwnerTable);
@@ -338,4 +365,17 @@ private:
static const FName MatrixEditorTabId;
static const FName GraphEditorTabId;
static const FName ToolbarTabId;
static const FName LayerSystemTabId;
static const FName PhysicsSettingsTabId;
static const FName DismembermentGraphTabId;
// Is the editor initialized?
bool bIsInitialized;
// New DismembermentEditor related Widgets
TSharedPtr<SBorder> LayerSystemWidget;
TSharedPtr<SBorder> PhysicsSettingsWidget;
// Error handling method
void HandleEditorError(const FText& ErrorMessage);
};