Files
UnrealEngineUWP/Engine/Plugins/Runtime/StateTree/Source/StateTreeEditorModule/Private/SStateTreeView.h
mikko mononen 371377a22c StateTree: small editor improvements
- Removed State Succeeded/Failed from transitions as it currently does not make sense
- Change "Add Routine" button to "Add State"
-Rrenamed routines to SubTrees, generally support just one
- Add a root node by default

#jira UE-140363
#rb Yoan.StAmant
#preflight 61f3a6bf801201ab387c9b99

#ROBOMERGE-AUTHOR: mikko.mononen
#ROBOMERGE-SOURCE: CL 18769095 in //UE5/Release-5.0/... via CL 18769102 via CL 18769116
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18769117 by mikko mononen in ue5-main branch]
2022-01-28 03:38:15 -05:00

83 lines
2.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "StateTreeViewModel.h"
#include "Widgets/Views/STreeView.h"
class UStateTreeEditorData;
class UStateTreeState;
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<UStateTreeState*>& SelectedStates);
// Treeview handlers
TSharedRef<ITableRow> HandleGenerateRow(UStateTreeState* InState, const TSharedRef<STableViewBase>& InOwnerTableView);
void HandleGetChildren(UStateTreeState* InParent, TArray<UStateTreeState*>& OutChildren);
void HandleTreeSelectionChanged(UStateTreeState* InSelectedItem, ESelectInfo::Type SelectionType);
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<UStateTreeState*>> TreeView;
TSharedPtr<SScrollBar> ExternalScrollbar;
UStateTreeState* RequestedRenameState;
bool bItemsDirty;
bool bUpdatingSelection;
};