Files
mikko mononen 441324a228 StateTree: Added State outliner and made the main tree view more detailed
- Simplied the task icon
- Created common treeview for States, used for state selection and outliner view
- Added common functions to describe state links and transitions
- Made custom expander arrow the main tree view
- Move the task lits on separate row on the main tree view
- Added enter condition list for on main tree view
- Clicking on tasks or enter conditions highlight them in the details panel
- Added state outliner which displays the state list compactly
- Added feedback for the drag and drop, and moved the code to separate file

#rb Yoan.StAmant

[CL 35239895 by mikko mononen in ue5-main branch]
2024-08-01 05:38:41 -04:00

86 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Misc/Attribute.h"
#include "Input/Reply.h"
#include "Layout/Visibility.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
#include "Layout/Margin.h"
#include "Widgets/SCompoundWidget.h"
#include "Styling/CoreStyle.h"
class ITableRow;
class SButton;
class SImage;
/**
* Bespoke implementation of expander arrow for State Tree.
*/
class SStateTreeExpanderArrow : public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS( SStateTreeExpanderArrow )
: _StyleSet(&FCoreStyle::Get())
, _IndentAmount(10)
, _BaseIndentLevel(0)
, _Image(nullptr)
, _ImageSize(16.f, 16.f)
, _ImagePadding(FMargin())
{ }
SLATE_ARGUMENT(const ISlateStyle*, StyleSet)
SLATE_ARGUMENT(float, IndentAmount)
SLATE_ARGUMENT(int32, BaseIndentLevel)
SLATE_ATTRIBUTE(const FSlateBrush*, Image)
SLATE_ATTRIBUTE(FSlateColor, ColorAndOpacity)
SLATE_ARGUMENT(FVector2f, ImageSize)
SLATE_ARGUMENT(FSlateColor, WireColorAndOpacity)
SLATE_ARGUMENT(FMargin, ImagePadding)
SLATE_END_ARGS()
SStateTreeExpanderArrow();
void Construct( const FArguments& InArgs, const TSharedPtr<class ITableRow>& TableRow );
protected:
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
/** Invoked when the expanded button is clicked (toggle item expansion) */
FReply OnArrowClicked();
/** @return Visible when has children; invisible otherwise */
EVisibility GetExpanderVisibility() const;
/** @return the name of an image that should be shown as the expander arrow */
const FSlateBrush* GetExpanderImage() const;
/** @return the margin corresponding to how far this item is indented */
FMargin GetExpanderPadding() const;
/** Pointer to the owning row. */
TWeakPtr<class ITableRow> OwnerRowPtr;
/** The amount of space to indent at each level */
float IndentAmount = 10.0f;
/** The level in the tree that begins the indention amount */
int32 BaseIndentLevel = 0;
/** Color for the wires */
FSlateColor WireColor;
/** Size of the expander image. */
FVector2f ImageSize = FVector2f(16, 16);
/** Padding for the expander image. */
FMargin ImagePadding;
/** A reference to the expander button */
TSharedPtr<SButton> ExpanderArrow;
/** The slate style to use */
const ISlateStyle* StyleSet = nullptr;
};