unreal.AnimDatabase

class unreal.AnimDatabase(outer: Object | None = None, name: Name | str = 'None')

Bases: DataAsset

Animation Database Asset

This asset contains an array of animations, as well as a skeleton, and a mirror table. It is assumed that all added animations should match the provided skeleton. As well as providing a hook for a custom UI and tooling, this asset provides functions for sampling animation data at a single uniform framerate and in the pose representation used by the database.

The number of “Sequences” in this database (as returned by GetSequenceNum()) will be two times the number of entries in “Entries” when the mirror data table is present and valid, otherwise it will be the same as the number of entries.

C++ Source:

  • Plugin: AnimDatabase

  • Module: AnimDatabase

  • File: AnimDatabase.h

Editor Properties: (see get_editor_property/set_editor_property)

  • curve_sampler (AnimDatabaseSampler): [Read-Write] Interpolation method used for sampling curves in the database.

  • entries (Array[AnimSequence]): [Read-Write] List of Animations in Database

  • frame_rate (FrameRate): [Read-Write] FrameRate to use for sampling the database. This should generally set to the target frame rate of your game.

  • mirror_data_table (MirrorDataTable): [Read-Write] Mirror Data Table. Leave as null if you don’t want to include mirrored animations in the database.

  • pose_sampler (AnimDatabaseSampler): [Read-Write] Interpolation method used for sampling poses in the database.

  • skeleton (Skeleton): [Read-Write] Skeleton structure for Animation Sequences

find_bone_index(bone_name) int32

Finds the bone index for a given bone name in the database skeleton

Parameters:

bone_name (Name)

Return type:

int32

find_bone_indices(bone_names) Array[int32]

Finds the bone indices associated with the given bone names in the database skeleton

Parameters:

bone_names (Array[Name])

Returns:

out_bone_indices (Array[int32]):

Return type:

Array[int32]

find_sequence_index(anim_sequence, is_mirrored) int32

Finds the sequence index associated with a given animation

Parameters:
Return type:

int32

get_anim_sequence(sequence_idx) AnimSequence

Gets a pointer for the animation corresponding to a particular sequence index

Parameters:

sequence_idx (int32)

Return type:

AnimSequence

get_bone_name(bone_index) Name

Gets the bone name for the given bone index in the database skeleton

Parameters:

bone_index (int32)

Return type:

Name

get_bone_names() Array[Name]

Gets the bone names for all bones on the skeleton

Returns:

out_bone_names (Array[Name]):

Return type:

Array[Name]

get_bone_num() int32

Gets the number of bones in the database skeleton

Return type:

int32

get_bone_parent(bone_index) int32

Gets the parent bone index

Parameters:

bone_index (int32)

Return type:

int32

get_bone_parents() Array[int32]

Gets the array of bone parent indices for the database skeleton

Returns:

out_parents (Array[int32]):

Return type:

Array[int32]

get_bone_reference_location(bone_idx) Vector

Gets the bone location in the reference skeleton

Parameters:

bone_idx (int32)

Return type:

Vector

get_bone_reference_locations() Array[Vector]

Gets the bone locations in the reference skeleton

Returns:

out_reference_locations (Array[Vector]):

Return type:

Array[Vector]

get_bone_reference_rotation(bone_idx) Quat

Gets the bone rotation in the reference skeleton

Parameters:

bone_idx (int32)

Return type:

Quat

get_bone_reference_rotations() Array[Quat]

Gets the bone rotations in the reference skeleton

Returns:

out_reference_rotations (Array[Quat]):

Return type:

Array[Quat]

get_bone_reference_scale(bone_idx) Vector

Gets the bone scale in the reference skeleton

Parameters:

bone_idx (int32)

Return type:

Vector

get_closest_frame_from_sequence_time(sequence_idx, sequence_time) int32

Gets the closest frame associated with a sequence time

Parameters:
  • sequence_idx (int32)

  • sequence_time (float)

Return type:

int32

get_content_hash() int32

Gets a hash value which can be used to test if the underlying content in the database, or database properties have changed. This hash should not be relied on for detecting changes with certainty, and so should only be used for non-critical purposes (e.g. UI updates).

Return type:

int32

get_frame_rate() FrameRate

Get the database frame rate

Return type:

FrameRate

get_is_mirrored(sequence_idx) bool

Returns if a given sequence index is for a mirrored animation or not

Parameters:

sequence_idx (int32)

Return type:

bool

get_mirror_data_table() MirrorDataTable

Get a pointer to the database mirror table

Return type:

MirrorDataTable

get_sequence_asset_name(sequence_idx) str

Gets the asset name for a sequence index

Parameters:

sequence_idx (int32)

Return type:

str

get_sequence_duration(sequence_idx) float

Returns the duration of a sequence in seconds

Parameters:

sequence_idx (int32)

Return type:

float

get_sequence_frame_num(sequence_idx) int32

Gets the number of frames in a sequence

Parameters:

sequence_idx (int32)

Return type:

int32

get_sequence_num() int32

Gets the number of sequences in the database. This will be two times the number of entries when a mirror table is provided.

Return type:

int32

get_sequence_path_string(sequence_idx) str

Gets the path string for a sequence index

Parameters:

sequence_idx (int32)

Return type:

str

get_sequence_time_from_frame(sequence_idx, frame_idx) float

Gets the sequence time for the start of a given frame

Parameters:
  • sequence_idx (int32)

  • frame_idx (int32)

Return type:

float

get_skeleton() Skeleton

Get a pointer to the database skeleton

Return type:

Skeleton

get_total_duration() float

Gets the total duration of all sequences

Return type:

float

get_total_frame_num() int32

Gets the total number of frames across all sequences

Return type:

int32

wait_for_compression_on_anim_sequence(sequence_idx) None

Waits for the animation compression to complete for the given sequence. It is generally best to do this before trying to sample a sequence as otherwise the evaluation can be incredibly slow.

Parameters:

sequence_idx (int32)

wait_for_compression_on_anim_sequences(sequence_indices) None

Waits for the animation compression to complete for the given sequences. It is generally best to do this before trying to sample a sequence as otherwise the evaluation can be incredibly slow.

Parameters:

sequence_indices (Array[int32])