Skip to content

FSMTransition

Module: SMSystem

#include <SMTransition.h>

Inherits from FSMNode_Base

Description

struct FSMTransition;

Transitions determine when an FSM can exit one state and advance to the next.

Public Functions

Name
virtual void UpdateReadStates() override
FSMTransition()
virtual void Initialize(UObject * Instance) override
virtual void InitializeGraphFunctions() override
virtual void Reset() override
virtual bool IsNodeInstanceClassCompatible(UClass * NewNodeInstanceClass) const override
virtual UClass * GetDefaultNodeInstanceClass() const override
virtual void ExecuteInitializeNodes() override
virtual void ExecuteShutdownNodes() override
void TakeTransition()
bool DoesTransitionPass()
bool CanTransitionFromEvent()
bool CanTransition(TArray< FSMTransition * > & Transitions)
void GetConnectedTransitions(TArray< FSMTransition * > & Transitions) const
bool CanEvaluateConditionally() const
bool CanEvaluateFromEvent() const
FORCEINLINE FSMState_Base * GetFromState() const
FORCEINLINE FSMState_Base * GetToState() const
void SetFromState(FSMState_Base * State)
void SetToState(FSMState_Base * State)
virtual bool IsDebugActive() const override
virtual bool WasDebugActive() const override
virtual void ResetGeneratedValues() override
bool CanEvaluateWithStartState(const TArray< FSMTransition * > & TransitionChain)
FSMState_Base * GetFinalStateFromChain(const TArray< FSMTransition * > & TransitionChain)
bool CanChainEvalIfNextStateActive(const TArray< FSMTransition * > & TransitionChain)

Protected Functions

Name
virtual void InitializeFunctionHandlers() override

Public Attributes

Name
int32 Priority
uint16 bCanEnterTransition
uint16 bCanEnterTransitionFromEvent
uint16 bIsEvaluating
uint16 bCanEvaluate
uint16 bCanEvaluateFromEvent
uint16 bRunParallel
uint16 bEvalIfNextStateActive
uint16 bCanEvalWithStartState
uint16 bAlwaysFalse
uint16 bFromAnyState
uint16 bFromLinkState
FGuid FromGuid
FGuid ToGuid
ESMConditionalEvaluationType ConditionalEvaluationType
FDateTime LastNetworkTimestamp
FSMState_Base * SourceState
FSMState_Base * DestinationState
bool bWasEvaluating

Additional inherited members

Public Functions inherited from FSMNode_Base

Name
const FSMNode_FunctionHandlers * GetFunctionHandlers() const
FSMNode_Base()
virtual ~FSMNode_Base() =default
FSMNode_Base(const FSMNode_Base & Node) =default
virtual void OnStartedByInstance(USMInstance * Instance)
virtual void OnStoppedByInstance(USMInstance * Instance)
bool HaveGraphFunctionsInitialized() const
bool IsInitializedForRun() const
const FGuid & GetNodeGuid() const
void GenerateNewNodeGuid()
const FGuid & GetGuid() const
virtual void CalculatePathGuid(TMap< FString, int32 > & InOutMappedPaths, bool bUseGuidCache =false)
FString GetGuidPath(TMap< FString, int32 > & InOutMappedPaths) const
FGuid CalculatePathGuidConst() const
void GenerateNewNodeGuidIfNotSet()
void SetNodeGuid(const FGuid & NewGuid)
void SetOwnerNodeGuid(const FGuid & NewGuid)
const FGuid & GetOwnerNodeGuid() const
void SetOwnerNode(FSMNode_Base * Owner)
virtual FSMNode_Base * GetOwnerNode() const
USMInstance * GetOwningInstance() const
void CreateNodeInstance()
void CreateStackInstances()
virtual void RunConstructionScripts()
void SetNodeInstanceClass(UClass * NewNodeInstanceClass)
virtual USMNodeInstance * GetNodeInstance() const
virtual USMNodeInstance * GetOrCreateNodeInstance()
virtual bool CanEverCreateNodeInstance() const
const TArray< TObjectPtr< USMNodeInstance > > & GetStackInstancesConst() const
TArray< TObjectPtr< USMNodeInstance > > & GetStackInstances()
USMNodeInstance * GetNodeInStack(int32 Index) const
UClass * GetNodeInstanceClass() const
bool IsUsingDefaultNodeClass() const
void AddVariableGraphProperty(const FSMGraphProperty_Base_Runtime & GraphProperty, const FGuid & OwningTemplateGuid)
void SetNodeName(const FString & Name)
const FString & GetNodeName() const
void SetTemplateName(const FName & Name)
FName GetTemplateName(USMNodeInstance * InNodeInstance =nullptr) const
void AddStackTemplateName(const FName & Name, UClass * TemplateClass)
virtual bool IsActive() const
virtual void SetServerTimeInState(float InTime)
float GetServerTimeInState() const
virtual bool CanExecuteGraphProperties(uint32 OnEvent, const class USMStateInstance_Base * ForTemplate) const
virtual bool TryExecuteGraphProperties(uint32 OnEvent)
void ExecuteGraphProperties(USMNodeInstance * ForNodeInstance, const FGuid * ForTemplateGuid)
const TArray< FSMGraphProperty_Base_Runtime * > & GetGraphProperties() const
const TMap< FGuid, FSMGraphPropertyTemplateOwner > & GetTemplateGraphProperties() const
virtual void TryResetVariables()
virtual void EditorShutdown()
FName GetNodeGuidPropertyName()

Protected Functions inherited from FSMNode_Base

Name
virtual void PrepareGraphExecution()
virtual void SetActive(bool bValue)
void CreateGraphProperties()
void CreateGraphPropertiesForTemplate(USMNodeInstance * Template, const TMap< FGuid, FSMGraphProperty_Base_Runtime * > & MappedGraphPropertyInstances)

Public Attributes inherited from FSMNode_Base

Name
bool bValidateGuids
float TimeInState
bool bIsInEndState
bool bHasUpdated
int32 DuplicateId
FVector2D NodePosition
uint8 bHasInputEvents
bool bWasActive

Protected Attributes inherited from FSMNode_Base

Name
FSMNode_FunctionHandlers * FunctionHandlers
FGuid Guid
FGuid OwnerGuid
FGuid PathGuid
FSMNode_Base * OwnerNode
FString NodeName
FName TemplateName
TArray< FName > StackTemplateNames
TArray< TObjectPtr< USMNodeInstance > > StackNodeInstances
TArray< TObjectPtr< UClass > > NodeStackClasses
TObjectPtr< USMInstance > OwningInstance
TObjectPtr< USMNodeInstance > NodeInstance
TArray< FSMGraphProperty_Base_Runtime * > GraphProperties
TMap< FGuid, FSMGraphPropertyTemplateOwner > TemplateVariableGraphProperties
TObjectPtr< UClass > NodeInstanceClass

Friends inherited from FSMNode_Base

Name
class FSMEditorConstructionManager

Public Functions Documentation

function UpdateReadStates

virtual void UpdateReadStates() override

Reimplements: FSMNode_Base::UpdateReadStates


function FSMTransition

FSMTransition()

function Initialize

virtual void Initialize(
    UObject * Instance
) override

Initialize specific properties and node instances.

Reimplements: FSMNode_Base::Initialize


function InitializeGraphFunctions

virtual void InitializeGraphFunctions() override

Initialize all graph evaluator functions. Must be called from GameThread!

Reimplements: FSMNode_Base::InitializeGraphFunctions


function Reset

virtual void Reset() override

Resets persistent data.

Reimplements: FSMNode_Base::Reset


function IsNodeInstanceClassCompatible

virtual bool IsNodeInstanceClassCompatible(
    UClass * NewNodeInstanceClass
) const override

Derived nodes should overload and check for the correct type.

Reimplements: FSMNode_Base::IsNodeInstanceClassCompatible


function GetDefaultNodeInstanceClass

virtual UClass * GetDefaultNodeInstanceClass() const override

The default node instance class. Each derived node class needs to implement.

Reimplements: FSMNode_Base::GetDefaultNodeInstanceClass


function ExecuteInitializeNodes

virtual void ExecuteInitializeNodes() override

Reimplements: FSMNode_Base::ExecuteInitializeNodes


function ExecuteShutdownNodes

virtual void ExecuteShutdownNodes() override

Reimplements: FSMNode_Base::ExecuteShutdownNodes


function TakeTransition

void TakeTransition()

Will execute any transition tunnel logic.


function DoesTransitionPass

bool DoesTransitionPass()

Execute the graph and return the result. Only determines if this transition passes.


function CanTransitionFromEvent

bool CanTransitionFromEvent()

Checks if this transition has been notified it can pass from an event.


function CanTransition

bool CanTransition(
    TArray< FSMTransition * > & Transitions
)

Checks the execution tree in the event of conduits.

Parameters:

Transitions
All transitions that pass.

Return: True if a valid path exists.


function GetConnectedTransitions

void GetConnectedTransitions(
    TArray< FSMTransition * > & Transitions
) const

Retrieve all transitions in a chain. If the length is more than one that implies a transition conduit is in use.

Parameters:

Transitions
All transitions connected to this transition, ordered by traversal.

function CanEvaluateConditionally

bool CanEvaluateConditionally() const

If the transition is allowed to evaluate conditionally. This has to be true in order for the transition to be taken.


function CanEvaluateFromEvent

bool CanEvaluateFromEvent() const

If the transition is allowed to evaluate from an event.


function GetFromState

inline FORCEINLINE FSMState_Base * GetFromState() const

function GetToState

inline FORCEINLINE FSMState_Base * GetToState() const

function SetFromState

void SetFromState(
    FSMState_Base * State
)

Sets the state leading to this transition. This will update the state with this transition.


function SetToState

void SetToState(
    FSMState_Base * State
)

function IsDebugActive

inline virtual bool IsDebugActive() const override

Reimplements: FSMNode_Base::IsDebugActive


function WasDebugActive

inline virtual bool WasDebugActive() const override

Reimplements: FSMNode_Base::WasDebugActive


function ResetGeneratedValues

virtual void ResetGeneratedValues() override

Reset any values set from state machine generation.

Reimplements: FSMNode_Base::ResetGeneratedValues


function CanEvaluateWithStartState

static bool CanEvaluateWithStartState(
    const TArray< FSMTransition * > & TransitionChain
)

Checks to make sure every transition is allowed to evaluate with the start state.


function GetFinalStateFromChain

static FSMState_Base * GetFinalStateFromChain(
    const TArray< FSMTransition * > & TransitionChain
)

Get the final state a transition chain will reach. Attempts to find a non-conduit first.


function CanChainEvalIfNextStateActive

static bool CanChainEvalIfNextStateActive(
    const TArray< FSMTransition * > & TransitionChain
)

Checks if any transition allows evaluation if the next state is active.


Protected Functions Documentation

function InitializeFunctionHandlers

virtual void InitializeFunctionHandlers() override

Map the FunctionHandler pointer. Must be implemented per child struct!

Reimplements: FSMNode_Base::InitializeFunctionHandlers


Public Attributes Documentation

variable Priority

int32 Priority;

Lower number means this transition is checked sooner.


variable bCanEnterTransition

uint16 bCanEnterTransition;

Set from graph execution.


variable bCanEnterTransitionFromEvent

uint16 bCanEnterTransitionFromEvent;

Set from graph execution when updated by event.


variable bIsEvaluating

uint16 bIsEvaluating;

Set internally and from auto bound events. True only during evaluation.


variable bCanEvaluate

uint16 bCanEvaluate;

Set from graph execution or configurable from details panel. Must be true for the transition to be evaluated conditionally.


variable bCanEvaluateFromEvent

uint16 bCanEvaluateFromEvent;

Allows auto-bound events to evaluate.


variable bRunParallel

uint16 bRunParallel;

This transition will not prevent the next transition in the priority sequence from being evaluated. This allows the possibility for multiple active states.


variable bEvalIfNextStateActive

uint16 bEvalIfNextStateActive;

If the transition should still evaluate if already connecting to an active state.


variable bCanEvalWithStartState

uint16 bCanEvalWithStartState;

Secondary check state machine will make if a state is evaluating transitions on the same tick as Start State.


variable bAlwaysFalse

uint16 bAlwaysFalse;

The transition can never be taken conditionally or from an event.


variable bFromAnyState

uint16 bFromAnyState;

The transition has been created by an Any State.


variable bFromLinkState

uint16 bFromLinkState;

The transition has been created by a Link State.


variable FromGuid

FGuid FromGuid;

Guid to the state this transition is from. Kismet compiler will convert this into a state link.


variable ToGuid

FGuid ToGuid;

Guid to the state this transition is leading to. Kismet compiler will convert this into a state link.


variable ConditionalEvaluationType

ESMConditionalEvaluationType ConditionalEvaluationType;

The conditional evaluation type which determines the type of evaluation required if any.


variable LastNetworkTimestamp

FDateTime LastNetworkTimestamp;

Last recorded timestamp from a network transaction.


variable SourceState

FSMState_Base * SourceState;

Original state transitioning from.


variable DestinationState

FSMState_Base * DestinationState;

Destination state transitioning to.


variable bWasEvaluating

bool bWasEvaluating = false;

Helper to display evaluation color in the editor.


Private Attributes Documentation

variable FromState

FSMState_Base * FromState;

variable ToState

FSMState_Base * ToState;