unreal.AnimInstance

class unreal.AnimInstance(outer=None, name='None')

Bases: unreal.Object

Anim Instance

C++ Source:

  • Module: Engine

  • File: AnimInstance.h

Editor Properties: (see get_editor_property/set_editor_property)

  • on_all_montage_instances_ended (OnAllMontageInstancesEndedMCDelegate): [Read-Write] Called when all Montage instances have ended.

  • on_montage_blending_out (OnMontageBlendingOutStartedMCDelegate): [Read-Write] Called when a montage starts blending out, whether interrupted or finished

  • on_montage_ended (OnMontageEndedMCDelegate): [Read-Write] Called when a montage has ended, whether interrupted or finished

  • on_montage_started (OnMontageStartedMCDelegate): [Read-Write] Called when a montage has started

  • propagate_notifies_to_linked_instances (bool): [Read-Write] Whether to propagate notifies to any linked anim instances

  • receive_notifies_from_linked_instances (bool): [Read-Write] Whether to process notifies from any linked anim instances

  • root_motion_mode (RootMotionMode): [Read-Write] Sets where this blueprint pulls Root Motion from

blueprint_begin_play()None

Executed when begin play is called on the owning component

blueprint_initialize_animation()None

Executed when the Animation is initialized

blueprint_linked_animation_layers_initialized()None

Executed when the all Linked Animation Layers are initialized

blueprint_post_evaluate_animation()None

Executed after the Animation is evaluated

blueprint_update_animation(delta_time_x)None

Executed when the Animation is updated

Parameters

delta_time_x (float) –

calculate_direction(velocity, base_rotation)float

Returns degree of the angle betwee velocity and Rotation forward vector The range of return will be from [-180, 180], and this can be used to feed blendspace directional value

Parameters
Returns

Return type

float

clear_layer_overlay(class_)

deprecated: ‘clear_layer_overlay’ was renamed to ‘unlink_anim_class_layers’.

clear_morph_targets()None

Clears the current morph targets.

get_active_curve_names(curve_type)

This returns last up-to-date list of active curve names

Parameters

curve_type (AnimCurveType) –

Returns

out_names (Array(Name)):

Return type

Array(Name)

get_all_curve_names()

This returns all curve names

Returns

out_names (Array(Name)):

Return type

Array(Name)

get_current_active_montage()AnimMontage
Get a current Active Montage in this AnimInstance.

Note that there might be multiple Active at the same time. This will only return the first active one it finds. *

Returns

Return type

AnimMontage

get_curve_value(curve_name)float

Returns the value of a named curve.

Parameters

curve_name (Name) –

Returns

Return type

float

get_layer_sub_instance_by_class(class_)

deprecated: ‘get_layer_sub_instance_by_class’ was renamed to ‘get_linked_anim_layer_instance_by_class’.

get_layer_sub_instance_by_group(group)

deprecated: ‘get_layer_sub_instance_by_group’ was renamed to ‘get_linked_anim_layer_instance_by_group’.

get_linked_anim_graph_instance_by_tag(tag)AnimInstance

Runs through all nodes, attempting to find the first linked instance by name/tag

Parameters

tag (Name) –

Returns

Return type

AnimInstance

get_linked_anim_graph_instances_by_tag(tag)

Runs through all nodes, attempting to find all linked instances that match the name/tag

Parameters

tag (Name) –

Returns

out_linked_instances (Array(AnimInstance)):

Return type

Array(AnimInstance)

get_linked_anim_layer_instance_by_class(class_)AnimInstance

Gets the first layer linked instance corresponding to the specified class

Parameters

class (type(Class)) –

Returns

Return type

AnimInstance

get_linked_anim_layer_instance_by_group(group)AnimInstance

Gets the layer linked instance corresponding to the specified group

Parameters

group (Name) –

Returns

Return type

AnimInstance

get_linked_anim_layer_instance_by_group_and_class(group, class_)AnimInstance

Gets layer linked instance that matches group and class

Parameters
Returns

Return type

AnimInstance

get_linked_anim_layer_instances_by_group(group)

Runs through all nodes, attempting to find all distinct layer linked instances in the group

Parameters

group (Name) –

Returns

out_linked_instances (Array(AnimInstance)):

Return type

Array(AnimInstance)

get_owning_actor()Actor

Returns the owning actor of this AnimInstance

Returns

Return type

Actor

get_owning_component()SkeletalMeshComponent

Returns the skeletal mesh component that has created this AnimInstance

Returns

Return type

SkeletalMeshComponent

get_propagate_notifies_to_linked_instances()bool

Get whether to propagate notifies to any linked anim instances

Returns

Return type

bool

get_receive_notifies_from_linked_instances()bool

Get whether to process notifies from any linked anim instances

Returns

Return type

bool

get_sub_instance_by_tag(tag)

deprecated: ‘get_sub_instance_by_tag’ was renamed to ‘get_linked_anim_graph_instance_by_tag’.

get_sub_instances_by_tag(tag)

deprecated: ‘get_sub_instances_by_tag’ was renamed to ‘get_linked_anim_graph_instances_by_tag’.

get_sync_group_position(sync_group_name)MarkerSyncAnimPosition

Get Sync Group Position

Parameters

sync_group_name (Name) –

Returns

Return type

MarkerSyncAnimPosition

get_time_to_closest_marker(sync_group, marker_name)float or None

— AI communication end —

Parameters
  • sync_group (Name) –

  • marker_name (Name) –

Returns

out_marker_time (float):

Return type

float or None

has_marker_been_hit_this_frame(sync_group, marker_name)bool

Has Marker Been Hit This Frame

Parameters
  • sync_group (Name) –

  • marker_name (Name) –

Returns

Return type

bool

is_any_montage_playing()bool

Returns true if any montage is playing currently. Doesn’t mean it’s active though, it could be blending out.

Returns

Return type

bool

is_playing_slot_animation(asset, slot_node_name)bool

Return true if it’s playing the slot animation

Parameters
Returns

Return type

bool

is_sync_group_between_markers(sync_group_name, previous_marker, next_marker, respect_marker_order=True)bool

Is Sync Group Between Markers

Parameters
  • sync_group_name (Name) –

  • previous_marker (Name) –

  • next_marker (Name) –

  • respect_marker_order (bool) –

Returns

Return type

bool

kismet_initialize_animation()

deprecated: ‘kismet_initialize_animation’ was renamed to ‘blueprint_initialize_animation’.

kismet_update_animation(delta_time_x)

deprecated: ‘kismet_update_animation’ was renamed to ‘blueprint_update_animation’.

Runs through all layer nodes, attempting to find layer nodes that are implemented by the specified class, then sets up a linked instance of the class for each. Allocates one linked instance to run each of the groups specified in the class, so state is shared. If a layer is not grouped (ie. NAME_None), then state is not shared and a separate linked instance is allocated for each layer node. If InClass is null, then all layers are reset to their defaults.

Parameters

class (type(Class)) –

Runs through all nodes, attempting to find a linked instance by name/tag, then sets the class of each node if the tag matches

Parameters
lock_ai_resources(lock_movement, lock_ai_logic)None
locks indicated AI resources of animated pawn

DEPRECATED. Use LockAIResourcesWithAnimation instead

deprecated: Use LockAIResourcesWithAnimation instead

Parameters
  • lock_movement (bool) –

  • lock_ai_logic (bool) –

montage_get_blend_time(montage)float
Get the current blend time of the Montage.

If Montage reference is NULL, it will return the current blend time on the first active Montage found.

Parameters

montage (AnimMontage) –

Returns

Return type

float

montage_get_current_section(montage=None)Name

Returns the name of the current animation montage section.

Parameters

montage (AnimMontage) –

Returns

Return type

Name

montage_get_is_stopped(montage)bool

return true if Montage is not currently active. (not valid or blending out)

Parameters

montage (AnimMontage) –

Returns

Return type

bool

montage_get_play_rate(montage)float
Get PlayRate for Montage.

If Montage reference is NULL, PlayRate for any Active Montage will be returned. If Montage is not playing, 0 is returned.

Parameters

montage (AnimMontage) –

Returns

Return type

float

montage_get_position(montage)float

Get Current Montage Position

Parameters

montage (AnimMontage) –

Returns

Return type

float

montage_is_active(montage)bool

Returns true if the animation montage is active. If the Montage reference is NULL, it will return true if any Montage is active.

Parameters

montage (AnimMontage) –

Returns

Return type

bool

montage_is_playing(montage)bool
Returns true if the animation montage is currently active and playing.

If reference is NULL, it will return true is ANY montage is currently active and playing.

Parameters

montage (AnimMontage) –

Returns

Return type

bool

montage_jump_to_section(section_name, montage=None)None

Makes a montage jump to a named section. If Montage reference is NULL, it will do that to all active montages.

Parameters
montage_jump_to_sections_end(section_name, montage=None)None

Makes a montage jump to the end of a named section. If Montage reference is NULL, it will do that to all active montages.

Parameters
montage_pause(montage=None)None

Pauses the animation montage. If reference is NULL, it will pause ALL active montages.

Parameters

montage (AnimMontage) –

montage_play(montage_to_play, play_rate=1.0, return_value_type=MontagePlayReturnType.MONTAGE_LENGTH, time_to_start_montage_at=0.0, stop_all_montages=True)float

Plays an animation montage. Returns the length of the animation montage in seconds. Returns 0.f if failed to play.

Parameters
Returns

Return type

float

montage_resume(montage)None

Resumes a paused animation montage. If reference is NULL, it will resume ALL active montages.

Parameters

montage (AnimMontage) –

montage_set_next_section(section_name_to_change, next_section, montage=None)None
Relink new next section AFTER SectionNameToChange in run-time

You can link section order the way you like in editor, but in run-time if you’d like to change it dynamically, use this function to relink the next section For example, you can have Start->Loop->Loop->Loop…. but when you want it to end, you can relink next section of Loop to be End to finish the montage, in which case, it stops looping by Loop->End.

Parameters
  • section_name_to_change (Name) – : This should be the name of the Montage Section after which you want to insert a new next section

  • next_section (Name) – : new next section

  • montage (AnimMontage) –

montage_set_play_rate(montage, new_play_rate=1.0)None

Change AnimMontage play rate. NewPlayRate = 1.0 is the default playback rate.

Parameters
montage_set_position(montage, new_position)None

Set position.

Parameters
montage_stop(blend_out_time, montage=None)None

Stops the animation montage. If reference is NULL, it will stop ALL active montages.

Parameters
montage_stop_group_by_name(blend_out_time, group_name)None

Stops all active montages belonging to a group.

Parameters
  • blend_out_time (float) –

  • group_name (Name) –

property on_all_montage_instances_ended

[Read-Write] Called when all Montage instances have ended.

Type

(OnAllMontageInstancesEndedMCDelegate)

property on_montage_blending_out

[Read-Write] Called when a montage starts blending out, whether interrupted or finished

Type

(OnMontageBlendingOutStartedMCDelegate)

property on_montage_ended

[Read-Write] Called when a montage has ended, whether interrupted or finished

Type

(OnMontageEndedMCDelegate)

property on_montage_started

[Read-Write] Called when a montage has started

Type

(OnMontageStartedMCDelegate)

play_slot_animation(asset, slot_node_name, blend_in_time=0.25, blend_out_time=0.25, play_rate=1.0, loop_count=1)float

Play Slot Animation

Parameters
Returns

Return type

float

play_slot_animation_as_dynamic_montage(asset, slot_node_name, blend_in_time=0.25, blend_out_time=0.25, play_rate=1.0, loop_count=1, blend_out_trigger_time=- 1.0, time_to_start_montage_at=0.0)AnimMontage

Play normal animation asset on the slot node by creating a dynamic UAnimMontage. You can only play one asset (whether montage or animsequence) at a time per SlotGroup.

Parameters
  • asset (AnimSequenceBase) –

  • slot_node_name (Name) –

  • blend_in_time (float) –

  • blend_out_time (float) –

  • play_rate (float) –

  • loop_count (int32) –

  • blend_out_trigger_time (float) –

  • time_to_start_montage_at (float) –

Returns

Return type

AnimMontage

reset_dynamics(teleport_type)None

Reset any dynamics running simulation-style updates (e.g. on teleport, time skip etc.)

Parameters

teleport_type (TeleportType) –

save_pose_snapshot(snapshot_name)None

Takes a snapshot of the current skeletal mesh component pose & saves it internally. This snapshot can then be retrieved by name in the animation blueprint for blending. The snapshot is taken at the current LOD, so if for example you took the snapshot at LOD1 and then used it at LOD0 any bones not in LOD1 will use the reference pose

Parameters

snapshot_name (Name) –

set_layer_overlay(class_)

deprecated: ‘set_layer_overlay’ was renamed to ‘link_anim_class_layers’.

set_morph_target(morph_target_name, value)None

Sets a morph target to a certain weight.

Parameters
  • morph_target_name (Name) –

  • value (float) –

set_propagate_notifies_to_linked_instances(set)None

Set whether to propagate notifies to any linked anim instances

Parameters

set (bool) –

set_receive_notifies_from_linked_instances(set)None

Set whether to process notifies from any linked anim instances

Parameters

set (bool) –

set_root_motion_mode(value)None

Set RootMotionMode

Parameters

value (RootMotionMode) –

set_sub_instance_class_by_tag(tag, class_)

deprecated: ‘set_sub_instance_class_by_tag’ was renamed to ‘link_anim_graph_by_tag’.

snapshot_pose(snapshot)PoseSnapshot

Takes a snapshot of the current skeletal mesh component pose and saves it to the specified snapshot. The snapshot is taken at the current LOD, so if for example you took the snapshot at LOD1 and then used it at LOD0 any bones not in LOD1 will use the reference pose

Parameters

snapshot (PoseSnapshot) –

Returns

snapshot (PoseSnapshot):

Return type

PoseSnapshot

stop_slot_animation(blend_out_time=0.25, slot_node_name='None')None

Stops currently playing slot animation slot or all

Parameters
  • blend_out_time (float) –

  • slot_node_name (Name) –

try_get_pawn_owner()Pawn

kismet event functions

Returns

Return type

Pawn

Runs through all layer nodes, attempting to find layer nodes that are currently running the specified class, then resets each to its default value. State sharing rules are as with SetLayerOverlay. If InClass is null, does nothing.

Parameters

class (type(Class)) –

unlock_ai_resources(unlock_movement, unlock_ai_logic)None
unlocks indicated AI resources of animated pawn. Will unlock only animation-locked resources.

DEPRECATED. Use UnlockAIResourcesWithAnimation instead

deprecated: Use UnlockAIResourcesWithAnimation instead

Parameters
  • unlock_movement (bool) –

  • unlock_ai_logic (bool) –