// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "StateTreeDiffHelper.h" #include "Widgets/SCompoundWidget.h" class SStateTreeView; namespace UE::StateTree::Diff { class FAsyncDiff; /** Splitter that allows you to provide an FAsyncStateTreeViewDiff to connect like-properties between two or more state tree panels */ class STATETREEEDITORMODULE_API SDiffSplitter : public SCompoundWidget { public: class FSlot : public TSlotBase { public: FSlot() = default; SLATE_SLOT_BEGIN_ARGS(FSlot, TSlotBase) /** When the RuleSize is set to FractionOfParent, the size of the slot is the Value percentage of its parent size. */ SLATE_ATTRIBUTE(float, Value) SLATE_ARGUMENT(TSharedPtr, StateTreeView) SLATE_ARGUMENT(const UStateTree*, StateTree) SLATE_ATTRIBUTE(bool, IsReadonly) SLATE_ATTRIBUTE(TSharedPtr, DifferencesWithRightPanel) SLATE_SLOT_END_ARGS() }; static FSlot::FSlotArguments Slot(); SLATE_BEGIN_ARGS(SDiffSplitter) { } SLATE_SLOT_ARGUMENT(FSlot, Slots) SLATE_END_ARGS() void Construct(const FArguments& InArgs); void AddSlot(const FSlot::FSlotArguments& SlotArgs, int32 Index = INDEX_NONE); void HandleSelectionChanged(const FStateSoftPath& StatePath, const FStateSoftPath& SecondaryStatePath); protected: void HandleSelectionChanged(const TArray>& SelectedStates); private: struct FPanel { FPanel(const TSharedPtr& StateTreeView, const UStateTree* StateTree, const TAttribute& bIsReadonly, const TAttribute>& DiffRight) : StateTreeView(StateTreeView) , StateTree(StateTree) , IsReadonly(bIsReadonly) , DiffRight(DiffRight) { } TSharedPtr StateTreeView; const UStateTree* StateTree = nullptr; TAttribute IsReadonly; TAttribute> DiffRight; }; TArray Panels; TSharedPtr Splitter; FStateSoftPath SelectedState; }; } // UE::StateTree::Diff