FSMPropertyInteractionManager¶
Module: SMSystemEditor
#include <SMPropertyInteractionManager.h>
Description¶
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()) |
| bool | SetPropertyInteraction(const FSMPropertyInteractionTarget & InTarget, const ESMPropertyInteractionType InInteractionType, const FInteractionArgs & InInteractionArgs =FInteractionArgs()) |
| void | SetAllPropertyInteractions(const ESMPropertyInteractionType InInteractionType, const FBulkInteractionArgs & InInteractionArgs =FBulkInteractionArgs()) |
| void | SetInteractionForAllTargetsOfProperty(USMGraphK2Node_PropertyNode_Base * InProperty, const ESMPropertyInteractionType InInteractionType, const FInteractionArgs & InInteractionArgs =FInteractionArgs()) |
| void | TogglePropertySelection(USMGraphK2Node_PropertyNode_Base * InProperty, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()) |
| void | TogglePropertySelection(const FSMPropertyInteractionTarget & InTarget, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()) |
| void | DeselectAllProperties() |
| FSMPropertyInteractionTarget | FindTargetUnderCursor() const |
| bool | IsPropertySelected(const USMGraphK2Node_PropertyNode_Base * InProperty, bool bRequireDirectSelection =false) const |
| bool | IsTargetSelected(const FSMPropertyInteractionTarget & InTarget, bool bRequireDirectSelection =false) const |
| bool | IsPropertyHovered(const USMGraphK2Node_PropertyNode_Base * InProperty) const |
| bool | IsTargetHovered(const FSMPropertyInteractionTarget & InTarget) const |
| bool | IsPropertyInteractedWith(const USMGraphK2Node_PropertyNode_Base * InProperty, TSharedPtr< FSMPropertyInteractionData > * OutInteractionData =nullptr, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()) const |
| bool | IsTargetInteractedWith(const FSMPropertyInteractionTarget & InTarget, 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 |
| bool | IsTargetDirectlyInteractedWith(const FSMPropertyInteractionTarget & InTarget, bool bRequireDirectSelection, const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()) const |
| USMGraphK2Node_PropertyNode_Base * | GetSelectedProperty(bool bRequireDirectSelection =false) const |
| FSMPropertyInteractionTarget | GetSelectedTarget(bool bRequireDirectSelection =false) const |
| TSharedPtr< FSMPropertyInteractionData > | GetPropertyInteractionData(const USMGraphK2Node_PropertyNode_Base * InProperty) const |
| TSharedPtr< FSMPropertyInteractionData > | GetTargetInteractionData(const FSMPropertyInteractionTarget & InTarget) 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¶
function ~FSMPropertyInteractionManager¶
function SetPropertyInteraction¶
bool SetPropertyInteraction(
USMGraphK2Node_PropertyNode_Base * InProperty,
const ESMPropertyInteractionType InInteractionType,
const FInteractionArgs & InInteractionArgs =FInteractionArgs()
)
Notify a property is being interacted with. Convenience overload targeting the main property row.
Return: True if the interaction state changed, false if there was no change.
function SetPropertyInteraction¶
bool SetPropertyInteraction(
const FSMPropertyInteractionTarget & InTarget,
const ESMPropertyInteractionType InInteractionType,
const FInteractionArgs & InInteractionArgs =FInteractionArgs()
)
Notify a specific interaction target (property main row or split-struct sub-pin) is being interacted with.
Return: True if the interaction state 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 SetInteractionForAllTargetsOfProperty¶
void SetInteractionForAllTargetsOfProperty(
USMGraphK2Node_PropertyNode_Base * InProperty,
const ESMPropertyInteractionType InInteractionType,
const FInteractionArgs & InInteractionArgs =FInteractionArgs()
)
Apply an interaction to every target tracked for a property (main row plus any split-struct sub-pin targets). The property-overload of SetPropertyInteraction only touches the main row, so callers that want to clear a property wholesale (e.g. a tree-view collapse hiding both the main row and its sub-pin children) must route through this method.
Parameters:
InProperty- The property whose targets should be updated.
InInteractionType- Interaction flags forwarded to SetPropertyInteraction for every target. Typically the Unset* flags for a clear-on-collapse use case.
InInteractionArgs- Per-call args (scope, expansion, originating request) forwarded to each underlying SetPropertyInteraction call.
function TogglePropertySelection¶
void TogglePropertySelection(
USMGraphK2Node_PropertyNode_Base * InProperty,
const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
)
Toggle the property selection state of a property. Equivalent to the target overload with an invalid sub-pin id.
function TogglePropertySelection¶
void TogglePropertySelection(
const FSMPropertyInteractionTarget & InTarget,
const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
)
Toggle the selection state of a specific interaction target (main row or a particular split sub-pin). Prefer this over the property-node overload when the caller has resolved a specific sub-pin under the cursor. Otherwise a click on a split struct header while one of its sub-pins is selected would be misread as "toggle off" (the sub-pin is a different target from the header) and leave both rows in the wrong state.
function DeselectAllProperties¶
Make sure all selected properties are no longer selected.
function FindTargetUnderCursor¶
Hit-test the current cursor position against this state node's property widgets and return the target (property + sub-pin id) the user is pointing at. Walks both the top-level property nodes and any child-graph buckets owned by parent property graphs (split-struct arrays etc.) so rows inside child buckets resolve to a target the same way top-level rows do.
function IsPropertySelected¶
bool IsPropertySelected(
const USMGraphK2Node_PropertyNode_Base * InProperty,
bool bRequireDirectSelection =false
) const
Checks if a property (any target on it) 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 IsTargetSelected¶
bool IsTargetSelected(
const FSMPropertyInteractionTarget & InTarget,
bool bRequireDirectSelection =false
) const
Checks if a specific interaction target is selected.
Parameters:
InTarget- The target (property main row or split-struct sub-pin) to check.
bRequireDirectSelection- If the target needs to have been directly selected, rather than indirectly such as from another state.
function IsPropertyHovered¶
Checks if a property (any target on it) is hovered.
function IsTargetHovered¶
Checks if a specific interaction target 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 main-row target 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 IsTargetInteractedWith¶
bool IsTargetInteractedWith(
const FSMPropertyInteractionTarget & InTarget,
TSharedPtr< FSMPropertyInteractionData > * OutInteractionData =nullptr,
const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
) const
Checks for any level of interaction with a specific target.
Parameters:
InTarget- The target (property main row or split-struct sub-pin) to check for interaction.
OutInteractionData- [Optional] The interaction data for the target.
InGraphPanel- [Optional] If this check should be scoped to a specific graph panel.
Return: True if the target 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 IsTargetDirectlyInteractedWith¶
bool IsTargetDirectlyInteractedWith(
const FSMPropertyInteractionTarget & InTarget,
bool bRequireDirectSelection,
const TOptional< TWeakPtr< SGraphPanel > > & InGraphPanel =TOptional< TWeakPtr< SGraphPanel > >()
) const
If a target has direct interaction, such as hover or selection.
function GetSelectedProperty¶
Get the first selected property (any target).
function GetSelectedTarget¶
Get the first selected target, or an invalid target if nothing is selected.
function GetPropertyInteractionData¶
TSharedPtr< FSMPropertyInteractionData > GetPropertyInteractionData(
const USMGraphK2Node_PropertyNode_Base * InProperty
) const
Get the interaction state of the main-row target of a property.
function GetTargetInteractionData¶
TSharedPtr< FSMPropertyInteractionData > GetTargetInteractionData(
const FSMPropertyInteractionTarget & InTarget
) const
Get the interaction state of a specific target.
function RemoveTemporaryOwnerState¶
Removes a temporary owner state.
function ReapplyConnectedSelections¶
Look for updated connections and reapply any selections.
function GetScopedGraphPanel¶
Retrieve the currently scoped graph panel.
function DECLARE_MULTICAST_DELEGATE_TwoParams¶
DECLARE_MULTICAST_DELEGATE_TwoParams(
FOnExpansionStateChanged ,
USMGraphK2Node_PropertyNode_Base * ,
bool
)
function 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¶
Checks if a graph panel is supported for interaction.
Public Attributes Documentation¶
variable PropertySelectedColor¶
Color when property selected.
variable PropertyHoveredColor¶
Color when property hovered.
variable PropertySelectedAndHoveredColor¶
Color when both selected and highlighted.
Private Attributes Documentation¶
variable InteractedTargetData¶
TMap< FSMPropertyInteractionTarget, TSharedPtr< FSMPropertyInteractionData > > InteractedTargetData;
Interaction targets (property main rows and split-struct sub-pins) to their current interaction level.
variable OwningStateNode¶
The state node which owns this manager.
variable OwningBlueprint¶
Weak object ptr to the owning blueprint.
variable TemporaryOwningStateNodes¶
Other states which temporarily are our "owner". This occurs if another state is making an interaction request (selection) on this manager.
variable TemporaryControlledStateNodes¶
Other state nodes which we temporarily control. This is primarily for if we are selecting properties on another manager.
variable NodeSelectionChangedHandle¶
When the owning state machine blueprint editor changes its selection.
variable BlueprintEditorOpenedHandle¶
Handles for when a BP editor is opened or closed.
variable BlueprintEditorClosedHandle¶
variable OnExpansionStateChangedEvent¶
Called when the interaction manager changes the expansion state.
variable ScopedGraphPanel¶
Scope highlight and selection requests to this graph panel.