FSMNode_Base¶
Module: SMSystem
#include <SMNode_Base.h>
Inherited by FSMState_Base, FSMTransition
Description¶
Base struct for all state machine nodes. The Guid MUST be manually initialized right after construction.
Public Functions¶
| Name | |
|---|---|
| const FSMNode_FunctionHandlers * | GetFunctionHandlers() const |
| virtual void | UpdateReadStates() |
| FSMNode_Base() | |
| virtual | ~FSMNode_Base() =default |
| FSMNode_Base(const FSMNode_Base & Node) =default | |
| virtual void | Initialize(UObject * Instance) |
| virtual void | InitializeGraphFunctions() |
| virtual void | Reset() |
| 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 bool | IsNodeInstanceClassCompatible(UClass * NewNodeInstanceClass) const |
| 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 |
| virtual UClass * | GetDefaultNodeInstanceClass() 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 | ExecuteInitializeNodes() |
| virtual void | ExecuteShutdownNodes() |
| 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 bool | IsDebugActive() const |
| virtual bool | WasDebugActive() const |
| virtual void | EditorShutdown() |
| virtual void | ResetGeneratedValues() |
| FName | GetNodeGuidPropertyName() |
Protected Functions¶
| 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¶
| Name | |
|---|---|
| bool | bValidateGuids |
| float | TimeInState |
| bool | bIsInEndState |
| bool | bHasUpdated |
| int32 | DuplicateId |
| FVector2D | NodePosition |
| uint8 | bHasInputEvents |
| bool | bWasActive |
Protected Attributes¶
| 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¶
| Name | |
|---|---|
| class | FSMEditorConstructionManager |
Public Functions Documentation¶
function GetFunctionHandlers¶
function UpdateReadStates¶
Reimplemented by: FSMState_Base::UpdateReadStates, FSMTransition::UpdateReadStates
function FSMNode_Base¶
function ~FSMNode_Base¶
function FSMNode_Base¶
function Initialize¶
Initialize specific properties and node instances.
Reimplemented by: FSMConduit::Initialize, FSMState_Base::Initialize, FSMState::Initialize, FSMStateMachine::Initialize, FSMTransition::Initialize
function InitializeGraphFunctions¶
Initialize all graph evaluator functions. Must be called from GameThread!
Reimplemented by: FSMConduit::InitializeGraphFunctions, FSMState_Base::InitializeGraphFunctions, FSMState::InitializeGraphFunctions, FSMStateMachine::InitializeGraphFunctions, FSMTransition::InitializeGraphFunctions
function Reset¶
Resets persistent data.
Reimplemented by: FSMConduit::Reset, FSMState_Base::Reset, FSMState::Reset, FSMStateMachine::Reset, FSMTransition::Reset
function OnStartedByInstance¶
Called when the blueprint owning this node is started.
Reimplemented by: FSMState_Base::OnStartedByInstance, FSMState::OnStartedByInstance, FSMStateMachine::OnStartedByInstance
function OnStoppedByInstance¶
Called when the blueprint owning this node has stopped.
Reimplemented by: FSMState_Base::OnStoppedByInstance, FSMState::OnStoppedByInstance, FSMStateMachine::OnStoppedByInstance
function HaveGraphFunctionsInitialized¶
If all graph function initialization has taken place once.
function IsInitializedForRun¶
If the node is currently initialized for this run.
function GetNodeGuid¶
Unique identifier used in constructing nodes from a graph. May not be unique if this is from a parent graph or a reference.
function GenerateNewNodeGuid¶
function GetGuid¶
Unique identifier taking into account qualified path. Unique across blueprints if called after Instance initialization.
function CalculatePathGuid¶
virtual void CalculatePathGuid(
TMap< FString, int32 > & InOutMappedPaths,
bool bUseGuidCache =false
)
Calculate the value returned from GetGuid(). Gets all owner nodes and builds a path to this node. Hashes the path and sets PathGuid.
Reimplemented by: FSMStateMachine::CalculatePathGuid
function GetGuidPath¶
Unhashed string format of the guid path. MappedPaths are used to adjust for collisions.
function CalculatePathGuidConst¶
Calculate the path guid but do not set the guid.
function GenerateNewNodeGuidIfNotSet¶
Only generate a new guid if the current guid is invalid. This needs to be called on new nodes.
function SetNodeGuid¶
function SetOwnerNodeGuid¶
The state machine's NodeGuid owning this node.
function GetOwnerNodeGuid¶
Unique identifier to help determine which state machine this node belongs to.
function SetOwnerNode¶
The node directly owning this node. Should be a StateMachine.
function GetOwnerNode¶
The node directly owning this node. Should be a StateMachine.
Reimplemented by: FSMStateMachine::GetOwnerNode
function GetOwningInstance¶
The state machine instance owning this node.
function CreateNodeInstance¶
Create the node instance if a node instance class is set.
function CreateStackInstances¶
function RunConstructionScripts¶
Reimplemented by: FSMStateMachine::RunConstructionScripts
function SetNodeInstanceClass¶
Calls CheckNodeInstanceCompatible.
function IsNodeInstanceClassCompatible¶
Derived nodes should overload and check for the correct type.
Reimplemented by: FSMConduit::IsNodeInstanceClassCompatible, FSMState_Base::IsNodeInstanceClassCompatible, FSMStateMachine::IsNodeInstanceClassCompatible, FSMTransition::IsNodeInstanceClassCompatible
function GetNodeInstance¶
Return the current node instance. Only valid after initialization and may be nullptr.
Reimplemented by: FSMStateMachine::GetNodeInstance
function GetOrCreateNodeInstance¶
Create a node instance on demand if needed. Only required for default node classes. Initialization should be completed before calling.
Reimplemented by: FSMStateMachine::GetOrCreateNodeInstance
function CanEverCreateNodeInstance¶
If the node can at some point create a node instance.
Reimplemented by: FSMStateMachine::CanEverCreateNodeInstance
function GetStackInstancesConst¶
Returns the current stack instances.
function GetStackInstances¶
function GetNodeInStack¶
Returns a specific state from the stack.
function GetDefaultNodeInstanceClass¶
The default node instance class. Each derived node class needs to implement.
Reimplemented by: FSMConduit::GetDefaultNodeInstanceClass, FSMState_Base::GetDefaultNodeInstanceClass, FSMStateMachine::GetDefaultNodeInstanceClass, FSMTransition::GetDefaultNodeInstanceClass
function GetNodeInstanceClass¶
The current in use node class.
function IsUsingDefaultNodeClass¶
Is the default node class assigned.
function AddVariableGraphProperty¶
void AddVariableGraphProperty(
const FSMGraphProperty_Base_Runtime & GraphProperty,
const FGuid & OwningTemplateGuid
)
function SetNodeName¶
function GetNodeName¶
function SetTemplateName¶
function GetTemplateName¶
Return the template name used to find a node instance archetype.
Parameters:
InNodeInstance- The current node instance we want the template name for. Can be either the main node instance or a stack instance. When nullptr the main node instance template name is used.
Return: The node template name used to discover node instance archetypes or NAME_None if not found.
function AddStackTemplateName¶
function IsActive¶
If this node is active.
function ExecuteInitializeNodes¶
Reimplemented by: FSMConduit::ExecuteInitializeNodes, FSMState_Base::ExecuteInitializeNodes, FSMState::ExecuteInitializeNodes, FSMStateMachine::ExecuteInitializeNodes, FSMTransition::ExecuteInitializeNodes
function ExecuteShutdownNodes¶
Reimplemented by: FSMConduit::ExecuteShutdownNodes, FSMState::ExecuteShutdownNodes, FSMStateMachine::ExecuteShutdownNodes, FSMTransition::ExecuteShutdownNodes
function SetServerTimeInState¶
Set the time in state as recorded from the server.
Reimplemented by: FSMStateMachine::SetServerTimeInState
function GetServerTimeInState¶
The time in state as recorded by the server. Kept in the base node as transitions can utilize it.
function CanExecuteGraphProperties¶
inline virtual bool CanExecuteGraphProperties(
uint32 OnEvent,
const class USMStateInstance_Base * ForTemplate
) const
Checks if the instance is allowed to execute properties automatically.
Parameters:
OnEvent- GRAPH_PROPERTY_EVAL_[TYPE]
ForTemplate- The specific template to check against.
function TryExecuteGraphProperties¶
Execute desired graph properties for the given event.
Reimplemented by: FSMState::TryExecuteGraphProperties
function ExecuteGraphProperties¶
Evaluates graph properties.
Parameters:
ForNodeInstance- The node instance we are evaluating.
ForTemplateGuid- If specified only graph properties for this template will be executed. If null all properties will be executed.
function GetGraphProperties¶
Retrieve the embedded graph properties.
function GetTemplateGraphProperties¶
Retrieve the template variable graph properties.
function TryResetVariables¶
See if the user wants variables reset.
function IsDebugActive¶
Reimplemented by: FSMConduit::IsDebugActive, FSMTransition::IsDebugActive
function WasDebugActive¶
Reimplemented by: FSMConduit::WasDebugActive, FSMTransition::WasDebugActive
function EditorShutdown¶
Performs a safe reset. It's possible referenced structs have changed in the BP and may not be valid.
function ResetGeneratedValues¶
Reset any values set from state machine generation.
Reimplemented by: FSMState_Base::ResetGeneratedValues, FSMStateMachine::ResetGeneratedValues, FSMTransition::ResetGeneratedValues
function GetNodeGuidPropertyName¶
Property name of the NodeGuid.
Protected Functions Documentation¶
function InitializeFunctionHandlers¶
Map the FunctionHandler pointer. Must be implemented per child struct!
Reimplemented by: FSMConduit::InitializeFunctionHandlers, FSMState::InitializeFunctionHandlers, FSMStateMachine::InitializeFunctionHandlers, FSMTransition::InitializeFunctionHandlers
function PrepareGraphExecution¶
Execute the graph.
function SetActive¶
function CreateGraphProperties¶
function CreateGraphPropertiesForTemplate¶
void CreateGraphPropertiesForTemplate(
USMNodeInstance * Template,
const TMap< FGuid, FSMGraphProperty_Base_Runtime * > & MappedGraphPropertyInstances
)
Public Attributes Documentation¶
variable bValidateGuids¶
Check whether compiled guid cache matches run-time guid calculation.
variable TimeInState¶
The current time spent in the state.
variable bIsInEndState¶
State Machine is in end state or the state is an end state.
The main case for this is when a local transition graph uses "Is State Machine in End State" (USMGraphK2Node_StateMachineReadNode_InEndState)
Todo:
This should be moved to transitions only, but the now deprecated USMNodeInstance::IsInEndState() uses this.
variable bHasUpdated¶
State has updated at least once.
variable DuplicateId¶
Special indicator in case this node is a duplicate within the same blueprint. If this isn't 0 then the NodeGuid will have been adjusted.
variable NodePosition¶
The node position in the graph. Set automatically.
variable bHasInputEvents¶
This node has at least one input event present.
variable bWasActive¶
Debug helper in case a state switches to inactive in one frame.
Protected Attributes Documentation¶
variable FunctionHandlers¶
Contains all function handler pointers. Every child node should implement their own type and instantiate it under InitializeFunctionHandlers. This is used to lower struct memory offset costs during GC.
variable Guid¶
NodeGuid must always be unique. Do not duplicate the guid in any other node in any blueprint.
This is not the same guid that is used at run-time. At run-time all NodeGuids in a path to a node are hashed to form the PathGuid. This is done to account for multiple references and parent graph calls.
If you need to change the path of a node (such as collapse it to a nested state machine) and you need to maintain the old guid for run-time saves to work, you should use the GuidRedirectMap on the primary state machine instance which accepts PathGuids.
variable OwnerGuid¶
The state machine's NodeGuid owning this node.
variable PathGuid¶
Unique identifier calculated from this node's place in an instance. Calculated by taking the MD5 hash of the full path of all owner NodeGuids and this NodeGuid. This is what is returned from GetGuid().
ReadWrite so it can be easily read from custom graph nodes.
variable OwnerNode¶
The node directly owning this node. Should be a StateMachine.
variable NodeName¶
variable TemplateName¶
The name of a template archetype to use when constructing an instance. This allows default values be passed into the instance.
variable StackTemplateNames¶
The names of stack template archetypes used when constructing the stack.
variable StackNodeInstances¶
The node instances for this stack.
variable NodeStackClasses¶
All classes used in the node stack. The classes are stored here only to help with dependency loading by the engine, specifically with BP nativization. This isn't very useful otherwise as the archetypes (dynamically added default sub-objects) contain instance information which the class won't have.
Without this there may be runtime errors when trying to access internal resources. An example is setting a custom node icon for a stack node with the primary node not loading a custom icon.
The nativization code generated that fails is: "NodeIcon = CastChecked
Todo:
Consider removing with UE 5.0 as nativization is deprecated.
variable OwningInstance¶
The state machine instance owning this node.
variable NodeInstance¶
The node instance for this node if it exists.
variable GraphProperties¶
Custom graph structs with special handling. Dynamically loaded on initialization from embedded structs.
variable TemplateVariableGraphProperties¶
Set by the BP compiler. Template Guid -> GraphProperties. Contains data necessary to evaluate variables which have instanced BP graphs.
variable NodeInstanceClass¶
The class to use to construct the node instance if one exists.
Private Attributes Documentation¶
variable ServerTimeInState¶
Last recorded active time in state from the server.