85 lines
2.5 KiB
C++
85 lines
2.5 KiB
C++
#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<TSharedPtr<FDismembermentGraphNodeCategory>> Children;
|
|
|
|
// Node classes in this category
|
|
TArray<UClass*> 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<FDismembermentGraphEditor> InGraphEditor);
|
|
|
|
private:
|
|
// The graph editor that owns this palette
|
|
TWeakPtr<FDismembermentGraphEditor> GraphEditor;
|
|
|
|
// Root categories
|
|
TArray<TSharedPtr<FDismembermentGraphNodeCategory>> RootCategories;
|
|
|
|
// Tree view widget
|
|
TSharedPtr<STreeView<TSharedPtr<FDismembermentGraphNodeCategory>>> CategoriesTreeView;
|
|
|
|
// Search box widget
|
|
TSharedPtr<class SSearchBox> SearchBox;
|
|
|
|
// Search filter
|
|
TSharedPtr<class FDismembermentGraphNodeSearchFilter> SearchFilter;
|
|
|
|
// Initialize the palette
|
|
void InitializePalette();
|
|
|
|
// Create a category tree item
|
|
TSharedRef<ITableRow> OnGenerateCategoryRow(TSharedPtr<FDismembermentGraphNodeCategory> Category, const TSharedRef<STableViewBase>& OwnerTable);
|
|
|
|
// Get child categories
|
|
void OnGetCategoryChildren(TSharedPtr<FDismembermentGraphNodeCategory> Category, TArray<TSharedPtr<FDismembermentGraphNodeCategory>>& OutChildren);
|
|
|
|
// Category is expanded
|
|
void OnCategoryExpansionChanged(TSharedPtr<FDismembermentGraphNodeCategory> 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);
|
|
};
|