Skip to content

FSMPropertyInteractionManager

Module: SMSystemEditor

#include <SMPropertyInteractionManager.h>

Description

class FSMPropertyInteractionManager;

Manager class for interacting with graph properties. Selecting, hovering, and toggling connector displays can be done through here.

Note:

This is currently instanced per USMGraphNode_StateNodeBase, and we attempt to scope interactions to a single SGraphPanel. Selections and hover should only show up for one active panel, with IO connections potentially displayed across graph panels to assist with drag and drop. Ideally, we would have the manager at the SGraphPanel level, but extending the Blueprint Editor's graph panel is not practical when this works almost as well.

Public Classes

Name
struct FBulkInteractionArgs
struct FConnectedPropertyInteractionArgs
struct FInteractionArgs

Public Functions

Name
FSMPropertyInteractionManager(USMGraphNode_StateNodeBase * InStateNodeOwner)
~FSMPropertyInteractionManager()
bool SetPropertyInteraction(USMGraphK2Node_PropertyNode_Base * InProperty, const ESMPropertyInteractionType InInteractionType, const FInteractionArgs & InInteractionArgs =FInteractionArgs())
void SetAllPropertyInteractions(const ESMPropertyInteractionType InInteractionType, const FBulkInteractionArgs & InInteractionArgs =FBulkInteractionArgs())
void TogglePropertySelection(USMGraphK2Node_PropertyNode_Base * InProperty, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >())
void DeselectAllProperties()
bool IsPropertySelected(const USMGraphK2Node_PropertyNode_Base * InProperty, bool bRequireDirectSelection =false) const
bool IsPropertyHovered(const USMGraphK2Node_PropertyNode_Base * InProperty) const
bool IsPropertyInteractedWith(const USMGraphK2Node_PropertyNode_Base * InProperty, TSharedPtr< FSMPropertyInteractionData > * OutInteractionData =nullptr, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()) const
bool IsPropertyDirectlyInteractedWith(const USMGraphK2Node_PropertyNode_Base * InProperty, bool bRequireDirectSelection, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()) const
USMGraphK2Node_PropertyNode_Base * GetSelectedProperty(bool bRequireDirectSelection =false) const
TSharedPtr< FSMPropertyInteractionData > GetPropertyInteractionData(const USMGraphK2Node_PropertyNode_Base * InProperty) const
void RemoveTemporaryOwnerState(const TWeakObjectPtr< USMGraphNode_StateNodeBase > & OwnerState)
void ReapplyConnectedSelections()
const TWeakPtr< SGraphPanel > & GetScopedGraphPanel() const
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnExpansionStateChanged , USMGraphK2Node_PropertyNode_Base * , bool )
FOnExpansionStateChanged & GetOnExpansionStateChanged()
void SetAllPropertyInteractionsForGraph(USMGraph * InGraph, const ESMPropertyInteractionType InInteractionType, const FBulkInteractionArgs & InInteractionArgs =FBulkInteractionArgs())
FInteractionArgs BuildInteractionArgsForExternalSelections(ESMPropertyInteractionType InInteraction, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >())
ESMPropertyInteractionType GetInteractionTypeFlagsForExternalSelection(ESMPropertyInteractionType InInteraction)
bool IsGraphPanelSupported(const TWeakPtr< const SGraphPanel > & InGraphPanel)

Public Attributes

Name
FLinearColor PropertySelectedColor
FLinearColor PropertyHoveredColor
FLinearColor PropertySelectedAndHoveredColor

Public Functions Documentation

function FSMPropertyInteractionManager

FSMPropertyInteractionManager(
    USMGraphNode_StateNodeBase * InStateNodeOwner
)

function ~FSMPropertyInteractionManager

~FSMPropertyInteractionManager()

function SetPropertyInteraction

bool SetPropertyInteraction(
    USMGraphK2Node_PropertyNode_Base * InProperty,
    const ESMPropertyInteractionType InInteractionType,
    const FInteractionArgs & InInteractionArgs =FInteractionArgs()
)

Notify a property is being interacted with.

Return: True if the property changed, false if there was no change.


function SetAllPropertyInteractions

void SetAllPropertyInteractions(
    const ESMPropertyInteractionType InInteractionType,
    const FBulkInteractionArgs & InInteractionArgs =FBulkInteractionArgs()
)

Set the interaction for all properties.


function TogglePropertySelection

void TogglePropertySelection(
    USMGraphK2Node_PropertyNode_Base * InProperty,
    const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
)

Toggle the property selection state of a property.


function DeselectAllProperties

void DeselectAllProperties()

Make sure all selected properties are no longer selected.


function IsPropertySelected

bool IsPropertySelected(
    const USMGraphK2Node_PropertyNode_Base * InProperty,
    bool bRequireDirectSelection =false
) const

Checks if a property is selected.

Parameters:

InProperty
The property to check.
bRequireDirectSelection
If the property needs to have been directly selected, rather than indirectly such as from another state.

function IsPropertyHovered

bool IsPropertyHovered(
    const USMGraphK2Node_PropertyNode_Base * InProperty
) const

Checks if a property is hovered.


function IsPropertyInteractedWith

bool IsPropertyInteractedWith(
    const USMGraphK2Node_PropertyNode_Base * InProperty,
    TSharedPtr< FSMPropertyInteractionData > * OutInteractionData =nullptr,
    const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
) const

Checks for any level of interaction with a property.

Parameters:

InProperty
The property to check for interaction.
OutInteractionData
[Optional] The interaction data of the property.
InGraphPanel
[Optional] If this check should be scoped to a specific graph panel.

Return: True if the property is interacted with.


function IsPropertyDirectlyInteractedWith

bool IsPropertyDirectlyInteractedWith(
    const USMGraphK2Node_PropertyNode_Base * InProperty,
    bool bRequireDirectSelection,
    const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
) const

If a property has direct interaction, such as hover or selection.


function GetSelectedProperty

USMGraphK2Node_PropertyNode_Base * GetSelectedProperty(
    bool bRequireDirectSelection =false
) const

Get the first selected property.


function GetPropertyInteractionData

TSharedPtr< FSMPropertyInteractionData > GetPropertyInteractionData(
    const USMGraphK2Node_PropertyNode_Base * InProperty
) const

Get the interaction state of a property.


function RemoveTemporaryOwnerState

void RemoveTemporaryOwnerState(
    const TWeakObjectPtr< USMGraphNode_StateNodeBase > & OwnerState
)

Removes a temporary owner state.


function ReapplyConnectedSelections

void ReapplyConnectedSelections()

Look for updated connections and reapply any selections.


function GetScopedGraphPanel

inline const TWeakPtr< SGraphPanel > & GetScopedGraphPanel() const

Retrieve the currently scoped graph panel.


function DECLARE_MULTICAST_DELEGATE_TwoParams

DECLARE_MULTICAST_DELEGATE_TwoParams(
    FOnExpansionStateChanged ,
    USMGraphK2Node_PropertyNode_Base * ,
    bool 
)

function GetOnExpansionStateChanged

inline FOnExpansionStateChanged & GetOnExpansionStateChanged()

function SetAllPropertyInteractionsForGraph

static void SetAllPropertyInteractionsForGraph(
    USMGraph * InGraph,
    const ESMPropertyInteractionType InInteractionType,
    const FBulkInteractionArgs & InInteractionArgs =FBulkInteractionArgs()
)

Run interactions for all states in a graph.


function BuildInteractionArgsForExternalSelections

static FInteractionArgs BuildInteractionArgsForExternalSelections(
    ESMPropertyInteractionType InInteraction,
    const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
)

Build interaction args which can propagate to connected nodes depending on the interaction type.


function GetInteractionTypeFlagsForExternalSelection

static ESMPropertyInteractionType GetInteractionTypeFlagsForExternalSelection(
    ESMPropertyInteractionType InInteraction
)

Get the correct flags to use given an external selection. IE, SetSelect will produce multiple selection type flags, and UnsetSelect will produce multiple unselect type flags.


function IsGraphPanelSupported

static bool IsGraphPanelSupported(
    const TWeakPtr< const SGraphPanel > & InGraphPanel
)

Checks if a graph panel is supported for interaction.


Public Attributes Documentation

variable PropertySelectedColor

static FLinearColor PropertySelectedColor;

Color when property selected.


variable PropertyHoveredColor

static FLinearColor PropertyHoveredColor;

Color when property hovered.


variable PropertySelectedAndHoveredColor

static FLinearColor PropertySelectedAndHoveredColor;

Color when both selected and highlighted.


Private Attributes Documentation

variable InteractedPropertyData

TMap< TWeakObjectPtr< USMGraphK2Node_PropertyNode_Base >, TSharedPtr< FSMPropertyInteractionData > > InteractedPropertyData;

Property nodes to their current interaction level.


variable OwningStateNode

TWeakObjectPtr< USMGraphNode_StateNodeBase > OwningStateNode;

The state node which owns this manager.


variable OwningBlueprint

TWeakObjectPtr< UBlueprint > OwningBlueprint;

Weak object ptr to the owning blueprint.


variable TemporaryOwningStateNodes

TSet< TWeakObjectPtr< USMGraphNode_StateNodeBase > > TemporaryOwningStateNodes;

Other states which temporarily are our "owner". This occurs if another state is making an interaction request (selection) on this manager.


variable TemporaryControlledStateNodes

TSet< TWeakObjectPtr< USMGraphNode_StateNodeBase > > TemporaryControlledStateNodes;

Other state nodes which we temporarily control. This is primarily for if we are selecting properties on another manager.


variable NodeSelectionChangedHandle

FDelegateHandle NodeSelectionChangedHandle;

When the owning state machine blueprint editor changes its selection.


variable BlueprintEditorOpenedHandle

FDelegateHandle BlueprintEditorOpenedHandle;

Handles for when a BP editor is opened or closed.


variable BlueprintEditorClosedHandle

FDelegateHandle BlueprintEditorClosedHandle;

variable OnExpansionStateChangedEvent

FOnExpansionStateChanged OnExpansionStateChangedEvent;

Called when the interaction manager changes the expansion state.


variable ScopedGraphPanel

TWeakPtr< SGraphPanel > ScopedGraphPanel;

Scope highlight and selection requests to this graph panel.