FSMState_Base¶
Module: SMSystem
#include <SMState.h>
Inherits from FSMNode_Base
Inherited by FSMConduit, FSMState, FSMStateMachine
Description¶
The base class for all state typed nodes. This should never be instantiated by itself but inherited by children.
Public Functions¶
Name | |
---|---|
virtual void | UpdateReadStates() override |
virtual void | ResetReadStates() |
FSMState_Base() | |
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 |
const TArray< FSMTransition * > & | GetOutgoingTransitions() const |
const TArray< FSMTransition * > & | GetIncomingTransitions() const |
void | GetAllTransitionChains(TArray< FSMTransition * > & OutTransitions) const |
virtual bool | StartState() |
virtual bool | UpdateState(float DeltaSeconds) |
virtual bool | EndState(float DeltaSeconds, const FSMTransition * TransitionToTake =nullptr) |
virtual void | OnStartedByInstance(USMInstance * Instance) override |
virtual void | OnStoppedByInstance(USMInstance * Instance) override |
virtual bool | GetValidTransition(TArray< TArray< FSMTransition * > > & Transitions) |
virtual bool | IsEndState() const |
virtual bool | IsInEndState() const |
virtual bool | HasUpdated() const |
virtual bool | IsStateMachine() const |
virtual bool | IsConduit() const |
bool | IsRootNode() const |
float | GetActiveTime() const |
void | SetCanExecuteLogic(bool bValue) |
bool | CanExecuteLogic() const |
virtual bool | CanExecuteGraphProperties(uint32 OnEvent, const USMStateInstance_Base * ForTemplate) const override |
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¶
Name | |
---|---|
void | AddOutgoingTransition(FSMTransition * Transition) |
void | AddIncomingTransition(FSMTransition * Transition) |
void | InitializeTransitions() |
void | ShutdownTransitions() |
virtual void | NotifyInstanceStateHasStarted() |
virtual void | FirePreStartEvents() |
virtual void | FirePostStartEvents() |
Public Attributes¶
Name | |
---|---|
uint16 | bIsRootNode |
uint16 | bAlwaysUpdate |
uint16 | bEvalTransitionsOnStart |
uint16 | bDisableTickTransitionEvaluation |
uint16 | bStayActiveOnStateChange |
uint16 | bAllowParallelReentry |
uint16 | bCanBeEndState |
Protected Attributes¶
Name | |
---|---|
uint16 | bReenteredByParallelState |
uint16 | bCanExecuteLogic |
uint16 | bIsStateEnding |
FSMState_Base * | PreviousActiveState |
FSMTransition * | PreviousActiveTransition |
FDateTime | StartTime |
FDateTime | EndTime |
Friends¶
Name | |
---|---|
struct | FSMTransition(FSMTransition ) |
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 | |
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 | ExecuteShutdownNodes() |
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 bool | IsDebugActive() const |
virtual bool | WasDebugActive() const |
virtual void | EditorShutdown() |
FName | GetNodeGuidPropertyName() |
Protected Functions inherited from FSMNode_Base
Name | |
---|---|
virtual void | InitializeFunctionHandlers() |
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¶
Reimplements: FSMNode_Base::UpdateReadStates
function
ResetReadStates¶
Reimplemented by: FSMStateMachine::ResetReadStates
function
FSMState_Base¶
function
Initialize¶
Initialize specific properties and node instances.
Reimplements: FSMNode_Base::Initialize
Reimplemented by: FSMConduit::Initialize, FSMState::Initialize, FSMStateMachine::Initialize
function
InitializeGraphFunctions¶
Initialize all graph evaluator functions. Must be called from GameThread!
Reimplements: FSMNode_Base::InitializeGraphFunctions
Reimplemented by: FSMConduit::InitializeGraphFunctions, FSMState::InitializeGraphFunctions, FSMStateMachine::InitializeGraphFunctions
function
Reset¶
Resets persistent data.
Reimplements: FSMNode_Base::Reset
Reimplemented by: FSMConduit::Reset, FSMState::Reset, FSMStateMachine::Reset
function
IsNodeInstanceClassCompatible¶
Derived nodes should overload and check for the correct type.
Reimplements: FSMNode_Base::IsNodeInstanceClassCompatible
Reimplemented by: FSMConduit::IsNodeInstanceClassCompatible, FSMStateMachine::IsNodeInstanceClassCompatible
function
GetDefaultNodeInstanceClass¶
The default node instance class. Each derived node class needs to implement.
Reimplements: FSMNode_Base::GetDefaultNodeInstanceClass
Reimplemented by: FSMConduit::GetDefaultNodeInstanceClass, FSMStateMachine::GetDefaultNodeInstanceClass
function
ExecuteInitializeNodes¶
Reimplements: FSMNode_Base::ExecuteInitializeNodes
Reimplemented by: FSMConduit::ExecuteInitializeNodes, FSMState::ExecuteInitializeNodes, FSMStateMachine::ExecuteInitializeNodes
function
GetOutgoingTransitions¶
The transitions leading out from this state, sorted lowest to highest priority.
function
GetIncomingTransitions¶
The transitions leading to this state.
function
GetAllTransitionChains¶
Returns all connected transitions from this state, including ones connected to transition conduits.
function
StartState¶
Sets the state as active and begins execution.
Reimplemented by: FSMConduit::StartState, FSMState::StartState, FSMStateMachine::StartState
function
UpdateState¶
Runs the update execution.
Reimplemented by: FSMConduit::UpdateState, FSMState::UpdateState, FSMStateMachine::UpdateState
function
EndState¶
Runs the end state execution. Transition to take is so the state knows where it is going only.
Reimplemented by: FSMConduit::EndState, FSMState::EndState, FSMStateMachine::EndState
function
OnStartedByInstance¶
Called when the blueprint owning this node is started.
Reimplements: FSMNode_Base::OnStartedByInstance
Reimplemented by: FSMState::OnStartedByInstance, FSMStateMachine::OnStartedByInstance
function
OnStoppedByInstance¶
Called when the blueprint owning this node has stopped.
Reimplements: FSMNode_Base::OnStoppedByInstance
Reimplemented by: FSMState::OnStoppedByInstance, FSMStateMachine::OnStoppedByInstance
function
GetValidTransition¶
Runs through the transitions executing their graphs until a result is found. Builds an ordered list of transitions to take.
Parameters:
Transitions
- Found transitions. 2D Array of valid paths. If the total size is more than one that means these transitions are leading to parallel states. if each path is more than one that means there are transition conduits involved.
Return: True if a valid path is found, false otherwise.
Reimplemented by: FSMConduit::GetValidTransition
function
IsEndState¶
If the state itself is an end state.
Reimplemented by: FSMStateMachine::IsEndState
function
IsInEndState¶
Deprecated:
Use FSMStateMachine::IsStateMachineInEndState() instead.
Reimplemented by: FSMStateMachine::IsInEndState
function
HasUpdated¶
Has updated at least once.
function
IsStateMachine¶
Easy way to check if this state struct is a state machine.
Reimplemented by: FSMStateMachine::IsStateMachine
function
IsConduit¶
Easy way to check if this state struct is a conduit.
Reimplemented by: FSMConduit::IsConduit
function
IsRootNode¶
If this node is an initial entry point.
function
GetActiveTime¶
Current time in seconds this state has been active.
function
SetCanExecuteLogic¶
Set if this state is allowed to execute its logic.
function
CanExecuteLogic¶
If this state is allowed to execute logic.
function
CanExecuteGraphProperties¶
virtual bool CanExecuteGraphProperties(
uint32 OnEvent,
const USMStateInstance_Base * ForTemplate
) const override
Check if the state can execute its graph properties.
Reimplemented by: FSMConduit::CanExecuteGraphProperties
function
CanEvaluateTransitionsOnTick¶
If this state is allowed to evaluate its transitions on tick. This can return true even when tick evaluation is false in the event an outgoing transition has just completed from an event.
function
SortTransitions¶
Sort incoming and outgoing transitions by priority.
function
SetTransitionToTake¶
The transition this state will be taking.
function
GetTransitionToTake¶
If set this is the transition the state will take. Generally only valid when EndState is called and if this state is not an end state.
function
SetPreviousActiveState¶
Record the previous active state before this one.
function
SetPreviousActiveTransition¶
Record the previous active transition taken to this state.
function
GetPreviousActiveState¶
The last state entered previous to this state.
function
GetPreviousActiveTransition¶
The last transition taken to this state.
function
NotifyOfParallelReentry¶
This state is being reentered from a parallel state.
function
HasBeenReenteredFromParallelState¶
This state has just been entered from a parallel state while already active. May be true only for OnStateBegin.
function
IsStateEnding¶
True while the state is ending and graph execution is occurring. Prevents restarting this state when it triggers transitions while ending.
function
GetStartTime¶
UTC time the state started.
function
GetEndTime¶
UTC time the state ended.
function
SetStartTime¶
Set the local start time.
Reimplemented by: FSMStateMachine::SetStartTime
function
SetEndTime¶
Set the local end time.
Reimplemented by: FSMStateMachine::SetEndTime
function
GetStartCycle¶
High resolution timer for when this state started.
function
ResetGeneratedValues¶
Reset any values set from state machine generation.
Reimplements: FSMNode_Base::ResetGeneratedValues
Reimplemented by: FSMStateMachine::ResetGeneratedValues
Protected Functions Documentation¶
function
AddOutgoingTransition¶
function
AddIncomingTransition¶
function
InitializeTransitions¶
Helpers to call any special transition logic.
function
ShutdownTransitions¶
function
NotifyInstanceStateHasStarted¶
Call the owning instance letting it know this state has started.
Reimplemented by: FSMStateMachine::NotifyInstanceStateHasStarted
function
FirePreStartEvents¶
Fire all instance pre start events.
function
FirePostStartEvents¶
Fire all instance post start events.
Public Attributes Documentation¶
variable
bIsRootNode¶
Entry node to state machine.
variable
bAlwaysUpdate¶
Always call state update at least once before ending.
variable
bEvalTransitionsOnStart¶
Allows transitions to be evaluated in the same tick as StartState.
variable
bDisableTickTransitionEvaluation¶
Prevents conditional transitions for this state from being evaluated on Tick.
variable
bStayActiveOnStateChange¶
If the state should remain active even after a transition is taken from this state.
variable
bAllowParallelReentry¶
If this state can be reentered from a parallel state if this state is already active.
variable
bCanBeEndState¶
If this state can be considered an end state.
Protected Attributes Documentation¶
variable
bReenteredByParallelState¶
True only when already active and entered from a parallel state.
variable
bCanExecuteLogic¶
If this state machine can execute state logic.
variable
bIsStateEnding¶
True while the state is ending and graph execution is occurring. Prevents restarting this state when it triggers transitions while ending.
variable
PreviousActiveState¶
The last active state before this state. Resets on entry.
variable
PreviousActiveTransition¶
The last active transition before this state. Resets on entry.
variable
StartTime¶
UTC time the state started.
variable
EndTime¶
UTC time the state ended.