Skip to content

FSMConduit

Module: SMSystem

#include <SMConduit.h>

Inherits from FSMState_Base, FSMNode_Base

Description

struct FSMConduit;

A conduit can either be configured to run as a state or as a transition. Internally it consists of a single transition that must be true before outgoing transitions evaluate.

Public Functions

Name
FSMConduit()
virtual void Initialize(UObject * Instance) override
virtual void InitializeGraphFunctions() override
virtual void Reset() override
virtual void ExecuteInitializeNodes() override
virtual void ExecuteShutdownNodes() override
virtual bool CanExecuteGraphProperties(uint32 OnEvent, const USMStateInstance_Base * ForTemplate) const override
virtual bool IsNodeInstanceClassCompatible(UClass * NewNodeInstanceClass) const override
virtual UClass * GetDefaultNodeInstanceClass() const override
virtual bool StartState() override
virtual bool UpdateState(float DeltaSeconds) override
virtual bool EndState(float DeltaSeconds, const FSMTransition * TransitionToTake) override
virtual bool IsConduit() const override
virtual bool GetValidTransition(TArray< TArray< FSMTransition * > > & Transitions) override
bool IsConfiguredAsTransition() const
void EnterConduitWithTransition()
virtual bool IsDebugActive() const override
virtual bool WasDebugActive() const override

Protected Functions

Name
virtual void InitializeFunctionHandlers() override

Public Attributes

Name
uint8 bCanEnterTransition
uint8 bCanEvaluate
uint8 bEvalWithTransitions
ESMConditionalEvaluationType ConditionalEvaluationType
bool bIsEvaluating
bool bWasEvaluating

Additional inherited members

Public Functions inherited from FSMState_Base

Name
virtual void UpdateReadStates() override
virtual void ResetReadStates()
FSMState_Base()
const TArray< FSMTransition * > & GetOutgoingTransitions() const
const TArray< FSMTransition * > & GetIncomingTransitions() const
void GetAllTransitionChains(TArray< FSMTransition * > & OutTransitions) const
virtual void OnStartedByInstance(USMInstance * Instance) override
virtual void OnStoppedByInstance(USMInstance * Instance) override
virtual bool IsEndState() const
virtual bool IsInEndState() const
virtual bool HasUpdated() const
virtual bool IsStateMachine() const
bool IsRootNode() const
float GetActiveTime() const
void SetCanExecuteLogic(bool bValue)
bool CanExecuteLogic() const
bool CanEvaluateTransitionsOnTick() const
void SortTransitions()
void SetTransitionToTake(const FSMTransition * Transition)
const FSMTransition * GetTransitionToTake() const
void SetPreviousActiveState(FSMState_Base * InPreviousState)
void SetPreviousActiveTransition(FSMTransition * InPreviousTransition)
FSMState_Base * GetPreviousActiveState() const
FSMTransition * GetPreviousActiveTransition() const
void NotifyOfParallelReentry(bool bValue =true)
bool HasBeenReenteredFromParallelState() const
bool IsStateEnding() const
const FDateTime & GetStartTime() const
const FDateTime & GetEndTime() const
virtual void SetStartTime(const FDateTime & InStartTime)
virtual void SetEndTime(const FDateTime & InEndTime)
double GetStartCycle() const
virtual void ResetGeneratedValues() override

Protected Functions inherited from FSMState_Base

Name
void AddOutgoingTransition(FSMTransition * Transition)
void AddIncomingTransition(FSMTransition * Transition)
void InitializeTransitions()
void ShutdownTransitions()
virtual void NotifyInstanceStateHasStarted()
virtual void FirePreStartEvents()
virtual void FirePostStartEvents()

Public Attributes inherited from FSMState_Base

Name
uint16 bIsRootNode
uint16 bAlwaysUpdate
uint16 bEvalTransitionsOnStart
uint16 bDisableTickTransitionEvaluation
uint16 bStayActiveOnStateChange
uint16 bAllowParallelReentry
uint16 bCanBeEndState

Protected Attributes inherited from FSMState_Base

Name
uint16 bReenteredByParallelState
uint16 bCanExecuteLogic
uint16 bIsStateEnding
FSMState_Base * PreviousActiveState
FSMTransition * PreviousActiveTransition
FDateTime StartTime
FDateTime EndTime

Friends inherited from FSMState_Base

Name
struct FSMTransition(FSMTransition )

Public Functions inherited from FSMNode_Base

Name
const FSMNode_FunctionHandlers * GetFunctionHandlers() const
virtual void UpdateReadStates()
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 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()
virtual void ResetGeneratedValues()
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 FSMConduit

FSMConduit()

function Initialize

virtual void Initialize(
    UObject * Instance
) override

Initialize specific properties and node instances.

Reimplements: FSMState_Base::Initialize


function InitializeGraphFunctions

virtual void InitializeGraphFunctions() override

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

Reimplements: FSMState_Base::InitializeGraphFunctions


function Reset

virtual void Reset() override

Resets persistent data.

Reimplements: FSMState_Base::Reset


function ExecuteInitializeNodes

virtual void ExecuteInitializeNodes() override

Reimplements: FSMState_Base::ExecuteInitializeNodes


function ExecuteShutdownNodes

virtual void ExecuteShutdownNodes() override

Reimplements: FSMNode_Base::ExecuteShutdownNodes


function CanExecuteGraphProperties

virtual bool CanExecuteGraphProperties(
    uint32 OnEvent,
    const USMStateInstance_Base * ForTemplate
) const override

Check if the state can execute its graph properties.

Reimplements: FSMState_Base::CanExecuteGraphProperties


function IsNodeInstanceClassCompatible

virtual bool IsNodeInstanceClassCompatible(
    UClass * NewNodeInstanceClass
) const override

Derived nodes should overload and check for the correct type.

Reimplements: FSMState_Base::IsNodeInstanceClassCompatible


function GetDefaultNodeInstanceClass

virtual UClass * GetDefaultNodeInstanceClass() const override

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

Reimplements: FSMState_Base::GetDefaultNodeInstanceClass


function StartState

virtual bool StartState() override

Sets the state as active and begins execution.

Reimplements: FSMState_Base::StartState


function UpdateState

virtual bool UpdateState(
    float DeltaSeconds
) override

Runs the update execution.

Reimplements: FSMState_Base::UpdateState


function EndState

virtual bool EndState(
    float DeltaSeconds,
    const FSMTransition * TransitionToTake
) override

Runs the end state execution. Transition to take is so the state knows where it is going only.

Reimplements: FSMState_Base::EndState


function IsConduit

inline virtual bool IsConduit() const override

Easy way to check if this state struct is a conduit.

Reimplements: FSMState_Base::IsConduit


function GetValidTransition

virtual bool GetValidTransition(
    TArray< TArray< FSMTransition * > > & Transitions
) override

Evaluate the conduit and retrieve the correct condition.

Reimplements: FSMState_Base::GetValidTransition


function IsConfiguredAsTransition

inline bool IsConfiguredAsTransition() const

Should this be considered an extension to a transition?


function EnterConduitWithTransition

void EnterConduitWithTransition()

Signal that this conduit is being entered along with transitions.


function IsDebugActive

inline virtual bool IsDebugActive() const override

Reimplements: FSMNode_Base::IsDebugActive


function WasDebugActive

inline virtual bool WasDebugActive() const override

Reimplements: FSMNode_Base::WasDebugActive


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 bCanEnterTransition

uint8 bCanEnterTransition;

Set from graph execution.


variable bCanEvaluate

uint8 bCanEvaluate;

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


variable bEvalWithTransitions

uint8 bEvalWithTransitions;

This conduit will be evaluated with inbound and outbound transitions. If any transition fails the entire transition fails. In that case the state leading to this conduit will not take this transition.


variable ConditionalEvaluationType

ESMConditionalEvaluationType ConditionalEvaluationType;

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


variable bIsEvaluating

bool bIsEvaluating;

variable bWasEvaluating

bool bWasEvaluating = false;

Helper to display evaluation color in the editor.


Private Attributes Documentation

variable bCheckedForTransitions

bool bCheckedForTransitions;