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 Classes¶
| Name | |
|---|---|
| struct | FFilterGraphPropertyArgs |
Public Functions¶
| Name | |
|---|---|
| FSMNode_FunctionHandlers * | GetFunctionHandlers() const |
| virtual void | UpdateReadStates() |
| FSMNode_Base() | |
| virtual | ~FSMNode_Base() =default |
| FSMNode_Base(const FSMNode_Base & Node) =default | |
| FSMNode_Base & | operator=(const FSMNode_Base & Node) |
| virtual void | Initialize(USMInstance * Instance) |
| const TSharedPtr< FSMNodeRuntimeData > & | GetRuntimeData() const |
| template \<typename T > TSharedPtr< T > |
GetRuntimeDataAs() const |
| 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 |
| USMNodeInstance * | GetNodeInStack(const FGuid & InTemplateGuid) 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(ESMGraphPropertyEvalFlags OnEvent, const class USMStateInstance_Base * ForTemplate, ESMGraphPropertyDirection InDirection) const |
| virtual bool | TryExecuteGraphProperties(ESMGraphPropertyEvalFlags OnEvent, ESMGraphPropertyDirection InDirection) |
| void | TryExecuteGraphProperties(ESMGraphPropertyEvalFlags OnEvent) |
| void | ExecuteGraphProperties(USMNodeInstance * ForNodeInstance, const FGuid * ForTemplateGuid) |
| void | ExecuteGraphProperties(const FFilterGraphPropertyArgs & InArgs) |
| 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() |
| void | TriggerDebugBreakpoint() |
| FName | GetNodeGuidPropertyName() |
| FName | GetPathGuidPropertyName() |
Protected Functions¶
| Name | |
|---|---|
| virtual TSharedPtr< FSMNodeRuntimeData > | CreateRuntimeData() const |
| 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 |
| FVector2D | NodePosition |
| float | TimeInState |
| int32 | DuplicateId |
| uint8 | bIsInEndState |
| uint8 | bHasUpdated |
| uint8 | bHasInputEvents |
Protected Attributes¶
| Name | |
|---|---|
| FGuid | Guid |
| FGuid | OwnerGuid |
| FGuid | PathGuid |
| FString | NodeName |
| FName | TemplateName |
| TArray< FName > | StackTemplateNames |
| TArray< TObjectPtr< USMNodeInstance > > | StackNodeInstances |
| TObjectPtr< USMInstance > | OwningInstance |
| TObjectPtr< USMNodeInstance > | NodeInstance |
| 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 operator=¶
function Initialize¶
Initializes various properties and associate the node with its owning state machine instance.
Parameters:
Instance- The state machine instance used to initialize the node.
Reimplemented by: FSMConduit::Initialize, FSMState_Base::Initialize, FSMState::Initialize, FSMStateMachine::Initialize, FSMTransition::Initialize
function GetRuntimeData¶
Retrieve the runtime-only data relevant to this node.
function GetRuntimeDataAs¶
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 GetNodeInStack¶
Returns a node in the stack the template guid.
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_Base::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(
ESMGraphPropertyEvalFlags OnEvent,
const class USMStateInstance_Base * ForTemplate,
ESMGraphPropertyDirection InDirection
) const
Checks if the instance is allowed to execute properties automatically.
Parameters:
OnEvent- The event to execute on.
ForTemplate- The specific template to check against.
InDirection- The direction of the graph properties to evaluate.
function TryExecuteGraphProperties¶
virtual bool TryExecuteGraphProperties(
ESMGraphPropertyEvalFlags OnEvent,
ESMGraphPropertyDirection InDirection
)
Execute desired graph properties for the given event in a given direction.
Parameters:
OnEvent- The event to execute on.
InDirection- The direction of the graph property.
Reimplemented by: FSMState::TryExecuteGraphProperties
function TryExecuteGraphProperties¶
Try executing all directions of graph properties.
Parameters:
OnEvent- The event to execute on.
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.
Deprecated:
This function is deprecated. Use the version which takes FFilterGraphPropertyArgs instead.
function ExecuteGraphProperties¶
Evaluates graph properties.
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 TriggerDebugBreakpoint¶
Triggers a debug breakpoint.
function GetNodeGuidPropertyName¶
Property name of the NodeGuid.
function GetPathGuidPropertyName¶
Property name of the PathGuid.
Protected Functions Documentation¶
function CreateRuntimeData¶
Reimplemented by: FSMConduit::CreateRuntimeData, FSMState_Base::CreateRuntimeData, FSMStateMachine::CreateRuntimeData, FSMTransition::CreateRuntimeData
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 NodePosition¶
The node position in the graph. Set automatically.
variable TimeInState¶
The current time spent in the state.
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 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 bHasInputEvents¶
This node has at least one input event present.
Protected Attributes Documentation¶
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 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 OwningInstance¶
The state machine instance owning this node.
variable NodeInstance¶
The node instance for this node if it exists.
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 RuntimeData¶
Shared pointer to runtime data associated with a state machine node. Manages details relevant to the node during execution. Kept as a shared ptr to minimize the struct size of the node during blueprint compilation.