Class AnimationNode
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Base resource for AnimationTree nodes. In general, it's not used directly, but you can create custom ones with custom blending formulas.
Inherit this when creating animation nodes mainly for use in AnimationNodeBlendTree, otherwise AnimationRootNode should be used instead.
public class AnimationNode : Resource, IDisposable
- Inheritance
-
AnimationNode
- Implements
- Derived
- Inherited Members
Constructors
AnimationNode()
public AnimationNode()
Properties
FilterEnabled
If true
, filtering is enabled.
public bool FilterEnabled { get; set; }
Property Value
Filters
public Array Filters { get; set; }
Property Value
Methods
AddInput(string)
Adds an input to the animation node. This is only useful for animation nodes created for use in an AnimationNodeBlendTree. If the addition fails, returns false
.
public bool AddInput(string name)
Parameters
name
string
Returns
BlendAnimation(StringName, double, double, bool, bool, float, LoopedFlag)
Blend an animation by blend
amount (name must be valid in the linked AnimationPlayer). A time
and delta
may be passed, as well as whether seeked
happened.
A loopedFlag
is used by internal processing immediately after the loop. See also Animation.LoopedFlag.
public void BlendAnimation(StringName animation, double time, double delta, bool seeked, bool isExternalSeeking, float blend, Animation.LoopedFlag loopedFlag = LoopedFlag.None)
Parameters
animation
StringNametime
doubledelta
doubleseeked
boolisExternalSeeking
boolblend
floatloopedFlag
Animation.LoopedFlag
BlendInput(int, double, bool, bool, float, FilterAction, bool, bool)
Blend an input. This is only useful for animation nodes created for an AnimationNodeBlendTree. The time
parameter is a relative delta, unless seek
is true
, in which case it is absolute. A filter mode may be optionally passed (see AnimationNode.FilterAction for options).
public double BlendInput(int inputIndex, double time, bool seek, bool isExternalSeeking, float blend, AnimationNode.FilterAction filter = FilterAction.Ignore, bool sync = true, bool testOnly = false)
Parameters
inputIndex
inttime
doubleseek
boolisExternalSeeking
boolblend
floatfilter
AnimationNode.FilterActionsync
booltestOnly
bool
Returns
BlendNode(StringName, AnimationNode, double, bool, bool, float, FilterAction, bool, bool)
Blend another animation node (in case this animation node contains child animation nodes). This function is only useful if you inherit from AnimationRootNode instead, otherwise editors will not display your animation node for addition.
public double BlendNode(StringName name, AnimationNode node, double time, bool seek, bool isExternalSeeking, float blend, AnimationNode.FilterAction filter = FilterAction.Ignore, bool sync = true, bool testOnly = false)
Parameters
name
StringNamenode
AnimationNodetime
doubleseek
boolisExternalSeeking
boolblend
floatfilter
AnimationNode.FilterActionsync
booltestOnly
bool
Returns
FindInput(string)
Returns the input index which corresponds to name
. If not found, returns -1
.
public int FindInput(string name)
Parameters
name
string
Returns
GetInputCount()
Amount of inputs in this animation node, only useful for animation nodes that go into AnimationNodeBlendTree.
public int GetInputCount()
Returns
GetInputName(int)
Gets the name of an input by index.
public string GetInputName(int input)
Parameters
input
int
Returns
GetParameter(StringName)
Gets the value of a parameter. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees.
public Variant GetParameter(StringName name)
Parameters
name
StringName
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsPathFiltered(NodePath)
Returns whether the given path is filtered.
public bool IsPathFiltered(NodePath path)
Parameters
path
NodePath
Returns
RemoveInput(int)
Removes an input, call this only when inactive.
public void RemoveInput(int index)
Parameters
index
int
SetFilterPath(NodePath, bool)
Adds or removes a path for the filter.
public void SetFilterPath(NodePath path, bool enable)
Parameters
SetInputName(int, string)
Sets the name of the input at the given input
index. If the setting fails, returns false
.
public bool SetInputName(int input, string name)
Parameters
Returns
SetParameter(StringName, Variant)
Sets a custom parameter. These are used as local memory, because resources can be reused across the tree or scenes.
public void SetParameter(StringName name, Variant value)
Parameters
name
StringNamevalue
Variant
_GetCaption()
When inheriting from AnimationRootNode, implement this virtual method to override the text caption for this animation node.
public virtual string _GetCaption()
Returns
_GetChildByName(StringName)
When inheriting from AnimationRootNode, implement this virtual method to return a child animation node by its name
.
public virtual AnimationNode _GetChildByName(StringName name)
Parameters
name
StringName
Returns
_GetChildNodes()
When inheriting from AnimationRootNode, implement this virtual method to return all child animation nodes in order as a name: node
dictionary.
public virtual Dictionary _GetChildNodes()
Returns
_GetParameterDefaultValue(StringName)
When inheriting from AnimationRootNode, implement this virtual method to return the default value of a parameter
. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees.
public virtual Variant _GetParameterDefaultValue(StringName parameter)
Parameters
parameter
StringName
Returns
_GetParameterList()
When inheriting from AnimationRootNode, implement this virtual method to return a list of the properties on this animation node. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees. Format is similar to GetPropertyList().
public virtual Array _GetParameterList()
Returns
_HasFilter()
When inheriting from AnimationRootNode, implement this virtual method to return whether the blend tree editor should display filter editing on this animation node.
public virtual bool _HasFilter()
Returns
_IsParameterReadOnly(StringName)
When inheriting from AnimationRootNode, implement this virtual method to return whether the parameter
is read-only. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees.
public virtual bool _IsParameterReadOnly(StringName parameter)
Parameters
parameter
StringName
Returns
_Process(double, bool, bool, bool)
When inheriting from AnimationRootNode, implement this virtual method to run some code when this animation node is processed. The time
parameter is a relative delta, unless seek
is true
, in which case it is absolute.
Here, call the BlendInput(int, double, bool, bool, float, FilterAction, bool, bool), BlendNode(StringName, AnimationNode, double, bool, bool, float, FilterAction, bool, bool) or BlendAnimation(StringName, double, double, bool, bool, float, LoopedFlag) functions. You can also use GetParameter(StringName) and SetParameter(StringName, Variant) to modify local memory.
This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called).
public virtual double _Process(double time, bool seek, bool isExternalSeeking, bool testOnly)
Parameters
Returns
Events
AnimationNodeRemoved
Emitted by nodes that inherit from this class and that have an internal tree when one of their animation nodes removes. The animation nodes that emit this signal are AnimationNodeBlendSpace1D, AnimationNodeBlendSpace2D, AnimationNodeStateMachine, and AnimationNodeBlendTree.
public event AnimationNode.AnimationNodeRemovedEventHandler AnimationNodeRemoved
Event Type
AnimationNodeRenamed
Emitted by nodes that inherit from this class and that have an internal tree when one of their animation node names changes. The animation nodes that emit this signal are AnimationNodeBlendSpace1D, AnimationNodeBlendSpace2D, AnimationNodeStateMachine, and AnimationNodeBlendTree.
public event AnimationNode.AnimationNodeRenamedEventHandler AnimationNodeRenamed
Event Type
TreeChanged
Emitted by nodes that inherit from this class and that have an internal tree when one of their animation nodes changes. The animation nodes that emit this signal are AnimationNodeBlendSpace1D, AnimationNodeBlendSpace2D, AnimationNodeStateMachine, AnimationNodeBlendTree and AnimationNodeTransition.
public event Action TreeChanged