Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeEditorModule/Private/SStateTreeView.h
marc audy b608402db7 [Backout] - CL24461256 to resolve nonunity errors
[FYI] mikko.mononen
Original CL Desc
-----------------------------------------------------------------
State Tree: Copy and paste State Tree states.
- Refactored State Tree style to follow more recent style pattern
- Added code to ensure that State Tree states outers are always the parent state (fixes issues with FCustomizableTextObjectFactory)
- Added support for Cut/Copy/Paste of state tree states (across State Trees)
- Improved reporting of bad bindings and state links (compiler & UI)

#rb Mieszko.Zielinski
#preflight 63ff52bef43e53f68119073e

[CL 24469431 by marc audy in ue5-main branch]
2023-03-01 15:40:35 -05:00

93 lines
2.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Widgets/SCompoundWidget.h"
class FStateTreeViewModel;
class ITableRow;
class SScrollBar;
class STableViewBase;
namespace ESelectInfo { enum Type : int; }
struct FPropertyChangedEvent;
template <typename ItemType> class STreeView;
class UStateTreeEditorData;
class UStateTreeState;
class SScrollBox;
class FActionTreeViewDragDrop : public FDragDropOperation
{
public:
DRAG_DROP_OPERATOR_TYPE(FActionTreeViewDragDrop, FDragDropOperation);
static TSharedRef<FActionTreeViewDragDrop> New(const UStateTreeState* InState)
{
return MakeShareable(new FActionTreeViewDragDrop(InState));
}
const UStateTreeState* GetDraggedState() const { return State; }
private:
FActionTreeViewDragDrop(const UStateTreeState* InState)
: State(InState)
{
}
const UStateTreeState* State;
};
class SStateTreeView : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SStateTreeView) {}
SLATE_END_ARGS()
SStateTreeView();
~SStateTreeView();
void Construct(const FArguments& InArgs, TSharedRef<FStateTreeViewModel> StateTreeViewModel);
void SavePersistentExpandedStates();
private:
virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
void UpdateTree(bool bExpandPersistent = false);
// ViewModel handlers
void HandleModelAssetChanged();
void HandleModelStatesRemoved(const TSet<UStateTreeState*>& AffectedParents);
void HandleModelStatesMoved(const TSet<UStateTreeState*>& AffectedParents, const TSet<UStateTreeState*>& MovedStates);
void HandleModelStateAdded(UStateTreeState* ParentState, UStateTreeState* NewState);
void HandleModelStatesChanged(const TSet<UStateTreeState*>& AffectedStates, const FPropertyChangedEvent& PropertyChangedEvent);
void HandleModelSelectionChanged(const TArray<TWeakObjectPtr<UStateTreeState>>& SelectedStates);
// Treeview handlers
TSharedRef<ITableRow> HandleGenerateRow(TWeakObjectPtr<UStateTreeState> InState, const TSharedRef<STableViewBase>& InOwnerTableView);
void HandleGetChildren(TWeakObjectPtr<UStateTreeState> InParent, TArray<TWeakObjectPtr<UStateTreeState>>& OutChildren);
void HandleTreeSelectionChanged(TWeakObjectPtr<UStateTreeState> InSelectedItem, ESelectInfo::Type SelectionType);
void HandleTreeExpansionChanged(TWeakObjectPtr<UStateTreeState> InSelectedItem, bool bExpanded);
TSharedPtr<SWidget> HandleContextMenuOpening();
// Action handlers
FReply HandleAddStateButton();
void HandleRenameState(UStateTreeState* State);
void HandleAddState(UStateTreeState* AfterItem);
void HandleAddChildState(UStateTreeState* ParentItem);
void HandleDeleteItems();
TSharedPtr<FStateTreeViewModel> StateTreeViewModel;
TSharedPtr<STreeView<TWeakObjectPtr<UStateTreeState>>> TreeView;
TSharedPtr<SScrollBar> ExternalScrollbar;
TSharedPtr<SScrollBox> ViewBox;
TArray<TWeakObjectPtr<UStateTreeState>> Subtrees;
UStateTreeState* RequestedRenameState;
bool bItemsDirty;
bool bUpdatingSelection;
};