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
  • 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_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_morph_targets() → None

Clears the current morph targets.

get_active_curve_names(curve_type) -> Array(Name)

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() -> Array(Name)

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_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_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’.

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.000000, return_value_type=MontagePlayReturnType.MONTAGE_LENGTH, time_to_start_montage_at=0.000000, 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.000000) → 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:
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

play_slot_animation(asset, slot_node_name, blend_in_time=0.250000, blend_out_time=0.250000, play_rate=1.000000, 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.250000, blend_out_time=0.250000, play_rate=1.000000, loop_count=1, blend_out_trigger_time=-1.000000, time_to_start_montage_at=0.000000) → 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_morph_target(morph_target_name, value) → None

Sets a morph target to a certain weight.

Parameters:
  • morph_target_name (Name) –
  • value (float) –
set_root_motion_mode(value) → None

Set RootMotionMode

Parameters:value (RootMotionMode) –
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.250000, 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
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) –