#pragma once #include "CoreMinimal.h" #include "Widgets/SCompoundWidget.h" #include "Widgets/Views/STableRow.h" #include "Widgets/Views/STreeView.h" class FDismembermentGraphEditor; /** * Node category structure for the palette */ struct FDismembermentGraphNodeCategory { // Category name FText CategoryName; // Child nodes TArray> Children; // Node classes in this category TArray NodeClasses; // Constructor FDismembermentGraphNodeCategory(const FText& InCategoryName) : CategoryName(InCategoryName) { } }; /** * Node palette widget for the dismemberment graph editor */ class FLESHEDITOR_API SDismembermentGraphPalette : public SCompoundWidget { public: SLATE_BEGIN_ARGS(SDismembermentGraphPalette) {} SLATE_END_ARGS() void Construct(const FArguments& InArgs, TSharedPtr InGraphEditor); private: // The graph editor that owns this palette TWeakPtr GraphEditor; // Root categories TArray> RootCategories; // Tree view widget TSharedPtr>> CategoriesTreeView; // Search box widget TSharedPtr SearchBox; // Search filter TSharedPtr SearchFilter; // Initialize the palette void InitializePalette(); // Create a category tree item TSharedRef OnGenerateCategoryRow(TSharedPtr Category, const TSharedRef& OwnerTable); // Get child categories void OnGetCategoryChildren(TSharedPtr Category, TArray>& OutChildren); // Category is expanded void OnCategoryExpansionChanged(TSharedPtr Category, bool bExpanded); // Search text changed void OnSearchTextChanged(const FText& InFilterText); // Create a node from the palette FReply OnCreateNode(UClass* NodeClass, const FVector2D& ScreenPosition, const FVector2D& GraphPosition); // Handle drag detected FReply OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, UClass* NodeClass); // Create default categories void CreateDefaultCategories(); // Add a node class to the palette void AddNodeClassToCategory(UClass* NodeClass, const FText& CategoryName); };