USMNodeInstance¶
Module: SMSystem
#include <SMNodeInstance.h>
Inherits from UObject, ISMInstanceInterface
Inherited by USMStateInstance_Base, USMTransitionInstance
Description¶
[Logic Driver] The abstract base node class all state machine nodes derive from.
Public Functions¶
Name | |
---|---|
USMNodeInstance() | |
virtual void | Serialize(FArchive & Ar) override |
virtual UWorld * | GetWorld() const override |
virtual void | BeginDestroy() override |
virtual UObject * | GetContext() const override |
virtual void | NativeInitialize() |
virtual void | NativeShutdown() |
void | OnRootStateMachineStart() |
void | OnRootStateMachineStop() |
void | RunConstructionScript() |
bool | ShouldSkipNativeEditorConstructionScripts() const |
USMInstance * | GetStateMachineInstance(bool bTopMostInstance =false) const |
void | SetOwningNode(FSMNode_Base * Node, bool bInIsEditorExecution =false) |
const FSMNode_Base * | GetOwningNode() const |
template \<typename T >T * | GetOwningNodeAs() const |
virtual const FSMNode_Base * | GetOwningNodeContainer() const |
USMStateMachineInstance * | GetOwningStateMachineNodeInstance() const |
TScriptInterface< ISMStateMachineNetworkedInterface > | GetNetworkInterface() const |
virtual float | GetTimeInState() const |
virtual bool | IsInEndState() const |
virtual bool | HasUpdated() const |
bool | IsActive() const |
const FString & | GetNodeName() const |
const FGuid & | GetGuid() const |
UTexture2D * | GetNodeIcon() const |
FVector2D | GetNodeIconSize() const |
FLinearColor | GetNodeIconTintColor() const |
void | EvaluateGraphProperties(bool bTargetOnly =false) |
const FGuid & | GetTemplateGuid() const |
const FVector2D & | GetNodePosition() const |
bool | IsInitialized() const |
bool | IsInitializedAndReadyForInputEvents() const |
FSMGraphProperty * | FindExposedPropertyOverrideByName(const FName & VariableName) const |
virtual void | PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent) override |
bool | WasArrayPropertyModified(const FName & PropertyName) const |
bool | IsNodePinChanging() const |
void | SetDisplayName(FName NewDisplayName) |
void | SetNodeDescriptionText(FText NewDescription) |
FText | GetNodeDescriptionText() const |
void | SetNodeColor(FLinearColor NewColor) |
void | SetUseCustomColor(bool bValue) |
void | SetUseCustomIcon(bool bValue) |
void | SetVariableReadOnly(FName VariableName, bool bSetIsReadOnly) |
void | SetVariableHidden(FName VariableName, bool bSetHidden) |
bool | IsEditorExecution() const |
void | WithExecutionEnvironment(ESMExecutionEnvironment & ExecutionEnvironment) |
TScriptInterface< ISMEditorGraphNodeInterface > | GetOwningEditorGraphNode() const |
void | K2_TryGetOwningEditorGraphNode(TScriptInterface< ISMEditorGraphNodeInterface > & EditorNode, ESMValidEditorNode & IsValidNode) const |
bool | IsInitializationThreadSafe() const |
void | ResetVariables() |
bool | GetResetVariablesOnInitialize() const |
bool | HasCustomColor() const |
const FLinearColor & | GetNodeColor() const |
const FSMNodeDescription & | GetNodeDescription() const |
bool | HasCustomIcon() const |
FString | GetNodeDisplayName() const |
void | SetTemplateGuid(const FGuid & NewTemplateGuid) |
void | SetIsThreadSafe(bool bNewValue) |
void | SetIsEditorThreadSafe(const bool bNewValue) |
bool | GetIsEditorThreadSafe() const |
TEnumAsByte< ESMNodeInput::Type > | GetInputType() const |
int32 | GetInputPriority() const |
bool | GetBlockInput() const |
UInputComponent * | GetInputComponent() const |
FName | GetConstructionScriptFunctionName() |
FName | GetNodeDescriptionPropertyName() |
FName | GetHideFromDropDownIfRulesFailPropertyName() |
Protected Functions¶
Name | |
---|---|
virtual void | OnRootStateMachineStart_Implementation() |
virtual void | OnRootStateMachineStop_Implementation() |
void | ConstructionScript() |
FSMGraphProperty * | FindOrAddExposedPropertyOverrideByName(const FName & VariableName) |
void | OnPreCompileValidate(USMCompilerLog * CompilerLog) const |
virtual void | OnPreCompileValidate_Implementation(USMCompilerLog * CompilerLog) const |
virtual void | ConstructionScript_Implementation() |
virtual UTexture2D * | GetNodeIcon_Implementation() const |
virtual FVector2D | GetNodeIconSize_Implementation() const |
virtual FLinearColor | GetNodeIconTintColor_Implementation() const |
void | EnableInput() Input. |
void | DisableInput() |
void | OnContextPawnControllerChanged(APawn * Pawn, AController * NewController) |
Public Attributes¶
Name | |
---|---|
TArray< FSMGraphProperty > | ExposedPropertyOverrides |
uint8 | bEvalDefaultProperties |
uint8 | bAutoEvalExposedProperties |
Protected Attributes¶
Name | |
---|---|
bool | bSkipNativeEditorConstructionScripts |
TObjectPtr< UTexture2D > | NodeIcon |
FVector2D | NodeIconSize |
FLinearColor | NodeIconTintColor |
bool | bResetVariablesOnInitialize |
FSMNodeDescription | NodeDescription |
FLinearColor | NodeColor |
uint8 | bDisplayCustomIcon |
uint8 | bUseCustomColors |
uint8 | bHideFromDropDownIfRulesFail |
TObjectPtr< UInputComponent > | InputComponent |
TEnumAsByte< ESMNodeInput::Type > | AutoReceiveInput |
int32 | InputPriority |
uint8 | bBlockInput |
Friends¶
Name | |
---|---|
class | USMGraphNode_StateNode |
class | USMGraphNode_TransitionEdge |
struct | FSMNode_Base(FSMNode_Base ) |
class | USMGraphNode_Base |
class | USMGraphK2Node_PropertyNode_Base |
Public Functions Documentation¶
function
USMNodeInstance¶
function
Serialize¶
function
GetWorld¶
function
BeginDestroy¶
function
GetContext¶
The object which this node is running for. Determined by the owning state machine.
function
NativeInitialize¶
Perform native initialization. Called before On[Node]Initialized for all node types.
function
NativeShutdown¶
Perform native cleanup. Called after On[Node]Shutdown for all node types.
function
OnRootStateMachineStart¶
Called when the immediate owning state machine blueprint is starting. If this is part of a reference then it will be called when the reference starts. If this is for a state machine node then it will only be called when the top level state machine starts.
function
OnRootStateMachineStop¶
Called when the immediate owning state machine blueprint is stopping. If this is part of a reference then it will be called when the reference stops. If this is for a state machine node then it will only be called when the top level state machine stops.
function
RunConstructionScript¶
Signal the construction script should start.
function
ShouldSkipNativeEditorConstructionScripts¶
Checks for user override on native classes if editor construction scripts should be skipped.
function
GetStateMachineInstance¶
Retrieve an owning blueprint state machine.
Parameters:
bTopMostInstance
- If the state machine is a reference return the top most instance.
Return: The state machine instance this node is running for.
Warning:
This call is unavailable during editor construction scripts because the USMInstance class is in the process of being regenerated.
function
SetOwningNode¶
Set during initialization of the state machine.
function
GetOwningNode¶
Reference to the owning node within a state machine.
function
GetOwningNodeAs¶
Reference the owning struct node as a given type.
function
GetOwningNodeContainer¶
Some nodes such as references may have special handling for returning a container node.
Reimplemented by: USMStateMachineInstance::GetOwningNodeContainer
function
GetOwningStateMachineNodeInstance¶
The instance of the direct state machine node this node is part of. Every node except the root state machine has an owning state machine node.
function
GetNetworkInterface¶
Return the server interface if there is one. This may be null.
function
GetTimeInState¶
The current time spent in the state.
function
IsInEndState¶
Legacy method available to all node types determining if the state machine node is in an end state or a state node is an end state.
When called from state machine nodes it checks if the state machine is in an end state. When called from other state types it is equivalent to calling USMStateInstance_Base::IsEndState() on the state. When called from transitions it is equivalent to calling IsInEndState() on the previous state.
Deprecated:
Use either USMStateInstance_Base::IsEndState(), or USMStateMachineInstance::IsStateMachineInEndState() depending on use case.
Note:
Overloading this method has no effect on whether a state is considered an end state or not. This method is not used internally in the plugin and only meant for observers.
Reimplemented by: USMStateInstance_Base::IsInEndState
function
HasUpdated¶
State has updated at least once.
function
IsActive¶
If this node is active.
function
GetNodeName¶
Retrieve the node name.
function
GetGuid¶
Unique identifier taking into account qualified path. Unique across blueprints if called after Instance initialization.
function
GetNodeIcon¶
Retrieve the icon representing this node. Null by default.
function
GetNodeIconSize¶
Retrieve the size to use when displaying the icon. Leave 0,0 to auto size.
function
GetNodeIconTintColor¶
Retrieve the tint to use when displaying the icon.
function
EvaluateGraphProperties¶
Evaluate graphs of properties exposed directly on this node.
Parameters:
bTargetOnly
- Only evaluate graph properties for the target node instance (such as a self target). Useful for only evaluating properties of select state stack instances.
function
GetTemplateGuid¶
Retrieve the template guid. The template guid cannot be modified at runtime.
function
GetNodePosition¶
Retrieve the node position in the graph.
function
IsInitialized¶
True after the initialize sequence is called on this node and false after shutdown is called.
function
IsInitializedAndReadyForInputEvents¶
Helper for checking if the node is ready to respond to input events.
function
FindExposedPropertyOverrideByName¶
Searches the ExposedPropertyOverrides to find a property by name. O(n).
function
PostEditChangeProperty¶
function
WasArrayPropertyModified¶
True if an array property was added or removed through the details panel.
function
IsNodePinChanging¶
This is true only if a user has manually changed a pin value on an exposed variable, and only during PostEditChangeProperty.
function
SetDisplayName¶
Sets the display name of the node. Valid from editor construction scripts only. bShowDisplayNameOnly must be set to true for the display name to be visible.
Development Only!
function
SetNodeDescriptionText¶
Sets the text description of the node. This generally only impacts the tooltip in the state machine graph. Valid from editor construction scripts only.
Development Only!
function
GetNodeDescriptionText¶
The text description of the node. Either returns the instance NodeDescription.Description or class metadata.
Development only!
Return: The text description in the editor.
function
SetNodeColor¶
Sets the color of the node. Requires UseCustomColor set to true. Valid from editor construction scripts only.
Development Only!
function
SetUseCustomColor¶
Tells the node to use a custom color. Valid from editor construction scripts only.
Development Only!
function
SetUseCustomIcon¶
Tells the node to use a custom icon. Valid from editor construction scripts only. Override the GetNodeIcon function to dynamically set the icon.
Development Only!
function
SetVariableReadOnly¶
Sets the read only status of an exposed variable. Valid from editor construction scripts only.
Development Only!
Parameters:
VariableName
- The name of the exposed variable as defined in this node class.
bSetIsReadOnly
- Set the variable read only status.
function
SetVariableHidden¶
Sets the hidden status of an exposed variable. Valid from editor construction scripts only.
Development Only!
Parameters:
VariableName
- The name of the exposed variable as defined in this node class.
bSetHidden
- Set the variable hidden status.
function
IsEditorExecution¶
Checks if this node is running for an editor state machine. This is generally only valid during editor time construction scripts. Use this to allow the construction script to set default values during compile instead of recalculating values during run-time.
function
WithExecutionEnvironment¶
Determine if this node is running for editor construction scripts or for a game.
function
GetOwningEditorGraphNode¶
Return the UEdGraphNode owning this node instance template. This is only valid in the editor while designing state machines. If valid this means you are editing the node in the state machine at editor time.
This can be used in editor construction scripts or editor only methods like PostEditChangeProperty.
function
K2_TryGetOwningEditorGraphNode¶
void K2_TryGetOwningEditorGraphNode(
TScriptInterface< ISMEditorGraphNodeInterface > & EditorNode,
ESMValidEditorNode & IsValidNode
) const
Return the UEdGraphNode owning this node instance template. This is only valid in the editor while designing state machines. If valid this means you are editing the node in the state machine graph at editor time.
This can be used in editor construction scripts.
Parameters:
EditorNode
- The UEdGraphNode containing this node instance template.
IsValidNode
- The execution path to take if the UEdGraph node is valid or not.
function
IsInitializationThreadSafe¶
If this node can be created on a new thread.
function
ResetVariables¶
Resets all properties back to their defaults. Exposed graph properties will also be reset and may need to be re-evaluated.
function
GetResetVariablesOnInitialize¶
function
HasCustomColor¶
function
GetNodeColor¶
function
GetNodeDescription¶
function
HasCustomIcon¶
function
GetNodeDisplayName¶
The default name which should be used.
function
SetTemplateGuid¶
Sets the template guid. Editor use only.
function
SetIsThreadSafe¶
function
SetIsEditorThreadSafe¶
function
GetIsEditorThreadSafe¶
function
GetInputType¶
function
GetInputPriority¶
function
GetBlockInput¶
function
GetInputComponent¶
Retrieve the input component this node created with AutoReceiveInput. The input component will only be valid if AutoReceiveInput is not disabled and this node is initialized.
Return: The UInputComponent or nullptr.
function
GetConstructionScriptFunctionName¶
The name of the protected ConstructionScript function.
function
GetNodeDescriptionPropertyName¶
function
GetHideFromDropDownIfRulesFailPropertyName¶
Protected Functions Documentation¶
function
OnRootStateMachineStart_Implementation¶
function
OnRootStateMachineStop_Implementation¶
function
ConstructionScript¶
A construction script that runs in the editor when the blueprint is modified. During run-time it will run after all nodes have instantiated.
When running with Editor Execution, only default values entered into public properties from the state machine graph will be available. Connecting a variable to a public property within the state machine graph will not evaluate until run-time. Additionally, the owning SMInstance will not be available at editor time since that is the class being compiled.
If construction scripts aren't working in the editor, you may need to adjust your settings to Standard
.
To configure editor construction script settings, go under Project Settings -> Logic Driver -> Editor Node Construction Script Setting.
Warning:
Any values set here while running with editor execution will replace the instance default values in state machine graphs when that state machine is compiled.
function
FindOrAddExposedPropertyOverrideByName¶
Return an existing override or adds a new one. O(n).
function
OnPreCompileValidate¶
Validate the node instance at state machine compile time. Use the CompilerLog->Log() function to output messages and report errors.
Called by the kismet compiler prior to compilation.
Parameters:
CompilerLog
- The compiler log specific to this compiler context. Write messages with Log().
function
OnPreCompileValidate_Implementation¶
function
ConstructionScript_Implementation¶
function
GetNodeIcon_Implementation¶
function
GetNodeIconSize_Implementation¶
function
GetNodeIconTintColor_Implementation¶
function
EnableInput¶
Input.
Allow input bindings if the owning state machine supports them.
function
DisableInput¶
Disable input bindings.
function
OnContextPawnControllerChanged¶
Public Attributes Documentation¶
variable
ExposedPropertyOverrides¶
Customize how exposed graph properties are displayed on the node.
Match the variable name with the variable you want to override. Property must be instance editable.
These values can be edited directly on the variable's details panel in the blueprint editor. Elements will be added automatically in this case.
This exact property is only visible in the class defaults if the Project Editor setting bEnableVariableCustomization is false.
If this needs to be programatically modified, it should be done so through the editor module's FSMNodeInstanceUtils ExposedPropertyOverride methods.
Warning:
This array and all elements are not safe to modify through C++ unless done so in the C++ constructor or by property handles. Otherwise changes may not be propagated to instances in graphs.
variable
bEvalDefaultProperties¶
Should graph properties evaluate even if they only contain default values. This includes properties that have values directly entered into a node without any blueprint expressions connected, such as typing a value into a string field.
When false default values entered into an exposed property won't ever evaluate and the value at compile time will be used until modified at run-time. If any blueprint pins are connected to the property then this setting doesn't apply.
Setting this to off is an optimization and may improve performance. However, if you modify the value at run-time it will no longer reset (re-evaluate) to the default value On State Begin. This is on by default for backwards compatibility and to maintain consistent behavior with variable evaluation.
variable
bAutoEvalExposedProperties¶
Properties marked as public will be exposed on this node as a graph.
When this is true that graph will automatically evaluate on state entry. When this is false you should manually call EvaluateGraphProperties().
Graph properties are only valid for nodes deriving from USMStateInstance_Base.
Protected Attributes Documentation¶
variable
bSkipNativeEditorConstructionScripts¶
Tell the state machine compiler to skip editor construction scripts for this native class.
This is primarily an optimization to improve performance when construction scripts aren't used on native classes. For blueprint classes the state machine compiler can easily check if there is logic defined, but not for native classes.
Children class may override this behavior, and blueprint children will override if there is any construction script logic defined.
variable
NodeIcon¶
The icon to use when displaying this node. This exists in run-time as well in case this image is needed for purposes outside of editor use.
variable
NodeIconSize¶
The size of the node icon. Leave 0,0 to auto size.
variable
NodeIconTintColor¶
The tint color to apply to the node icon.
variable
bResetVariablesOnInitialize¶
Resets all properties back to their default values when the node is initialized.
variable
NodeDescription¶
Describe the node. This provides information to the context menu and to tooltips.
variable
NodeColor¶
The standard color for this node.
variable
bDisplayCustomIcon¶
Override editor default icon with the custom icon chosen.
variable
bUseCustomColors¶
Override editor preference colors.
variable
bHideFromDropDownIfRulesFail¶
Hide this class from being selected in the node class drop down if its rules fail.
variable
InputComponent¶
variable
AutoReceiveInput¶
Automatically registers this node to receive input from a player. Input is valid only from when the node is initialized and until it is shutdown.
variable
InputPriority¶
The priority of this input component when pushed in to the stack. If AutoReceiveInput is set to UseOwningStateMachine this has no effect.
variable
bBlockInput¶
Whether any components lower on the input stack should be allowed to receive input. If AutoReceiveInput is set to UseOwningStateMachine this has no effect.
Private Attributes Documentation¶
variable
bHasEditorConstructionScripts¶
variable
bHasGameConstructionScripts¶
variable
ArrayPropertyChanged¶
variable
ArrayIndexChanged¶
variable
ArrayChangeType¶
variable
bIsNodePinChanging¶
Set from the editor when an exposed pin value is changing.
variable
bIsThreadSafe¶
If this node can be created on a new thread with async initialization. Valid for game and editor sessions.
variable
bIsEditorThreadSafe¶
If this node can be created on a new thread with async initialization when playing in the editor. Nodes may contain editor only code that isn't always thread safe, such as slate styling found in TextGraph properties.
If you experience crashes in the editor with async initialization consider turning this off.
variable
bIsEditorExecution¶
If this node is executing for the editor, such as through construction scripts.
variable
RunInitializedFrame¶
End Input.
Return the frame this node was initialized for this run. Resets each time a run is initialized or shutdown. Primarily used for determining if input events should fire.
variable
bIsInitialized¶
True from NativeInitialize.
variable
OwningNode¶
The owning node in the state machine instance.
variable
TemplateGuid¶
Assigned from the editor and used in tracking specific templates.