unreal.AnimDataController

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

Bases: unreal.Object

Anim Data Controller

C++ Source:

  • Module: AnimationDataController

  • File: AnimDataController.h

add_attribute(attribute_identifier, should_transact=True) bool

Adds a new attribute with the provided information. Broadcasts a EAnimDataModelNotifyType::AttributeAdded notify if successful.

Parameters
  • attribute_identifier (AnimationAttributeIdentifier) – Identifier for the to-be-added attribute

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the attribute was successfully added

Return type

bool

add_bone_track(bone_name, should_transact=True) int32

Adds a new bone animation track for the provided name. Broadcasts a EAnimDataModelNotifyType::TrackAdded notify if successful.

Parameters
  • bone_name (Name) – Bone name for which a track should be added

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

The index at which the bone track was added, INDEX_NONE if adding it failed

Return type

int32

add_curve(curve_id, curve_flags=4, should_transact=True) bool

Adds a new curve with the provided information. Broadcasts a EAnimDataModelNotifyType::CurveAdded notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the to-be-added curve

  • curve_flags (int32) – Flags to be set for the curve

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the curve was successfully added

Return type

bool

close_bracket(should_transact=True) None

Closes a previously opened interaction bracket, used for combining a set of controller actions. Broadcasts a EAnimDataModelNotifyType::BracketClosed notify.

Parameters

should_transact (bool) – Whether or not any undo-redo changes should be generated

duplicate_attribute(attribute_identifier, new_attribute_identifier, should_transact=True) bool

Duplicated the attribute (curve) with the identifier. Broadcasts a EAnimDataModelNotifyType::AttributeAdded notify if successful.

Parameters
Returns

Whether or not the attribute was successfully duplicated

Return type

bool

duplicate_curve(copy_curve_id, new_curve_id, should_transact=True) bool

Duplicated the curve with the identifier. Broadcasts a EAnimDataModelNotifyType::CurveAdded notify if successful.

Parameters
Returns

Whether or not the curve was successfully duplicated

Return type

bool

find_or_add_curve_names_on_skeleton(skeleton, supported_curve_type, should_transact=True) None

Updates the curve names with the provided skeleton, if a display name is not found it will be added thus modifying the skeleton. Broadcasts a EAnimDataModelNotifyType::CurveRenamed for each curve name for which the UID was different or if it was added as a new smartname, wrapped within BracketOpened/BracketClosed notifies.

Parameters
  • skeleton (Skeleton) – Skeleton to retrieve the display name values from

  • supported_curve_type (RawCurveTrackTypes) – Curve type for which the names should be updated

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

get_model() AnimDataModel
Returns

The AnimDataModel instance this controller is currently targeting

Return type

AnimDataModel

insert_bone_track(bone_name, desired_index, should_transact=True) int32

Inserts a new bone animation track for the provided name, at the provided index. Broadcasts a EAnimDataModelNotifyType::TrackAdded notify if successful. The bone name is verified with the AnimModel’s outer target USkeleton to ensure the bone exists.

Parameters
  • bone_name (Name) – Bone name for which a track should be inserted

  • desired_index (int32) – Index at which the track should be inserted

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

The index at which the bone track was inserted, INDEX_NONE if the insertion failed

Return type

int32

open_bracket(title, should_transact=True) None

Opens an interaction bracket, used for combining a set of controller actions. Broadcasts a EAnimDataModelNotifyType::BracketOpened notify, this can be used by any Views or dependendent systems to halt any unnecessary or invalid operations until the (last) bracket is closed.

Parameters
  • title (Text) – Description of the bracket, e.g. “Generating Curve Data”

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

remove_all_attributes(should_transact=True) int32

Removes all stored attributes. Broadcasts a EAnimDataModelNotifyType::AttributeRemoved notify for each removed attribute.

Parameters

should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Total number of removes attributes

Return type

int32

remove_all_attributes_for_bone(bone_name, should_transact=True) int32

Removes all attributes for the specified bone name, if any. Broadcasts a EAnimDataModelNotifyType::AttributeRemoved notify for each removed attribute.

Parameters
  • bone_name (Name) – Name of the bone to remove attributes for

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Total number of removes attributes

Return type

int32

remove_all_bone_tracks(should_transact=True) None

Removes all existing Bone Animation tracks. Broadcasts a EAnimDataModelNotifyType::TrackRemoved for each removed track, wrapped within BracketOpened/BracketClosed notifies.

Parameters

should_transact (bool) – Whether or not any undo-redo changes should be generated

remove_all_curves_of_type(supported_curve_type, should_transact=True) None

Removes all the curves of the provided type. Broadcasts a EAnimDataModelNotifyType::CurveRemoved for each removed curve, wrapped within BracketOpened/BracketClosed notifies.

Parameters
  • supported_curve_type (RawCurveTrackTypes) – Type for which all curves are to be removed

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

remove_attribute(attribute_identifier, should_transact=True) bool

Removes an attribute, if found, with the provided information. Broadcasts a EAnimDataModelNotifyType::AttributeRemoved notify if successful.

Parameters
  • attribute_identifier (AnimationAttributeIdentifier) – Identifier for the to-be-removed attribute

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the attribute was successfully removed

Return type

bool

remove_attribute_key(attribute_identifier, time, should_transact=True) bool

Remove a single key from the attribute with provided identifier. Broadcasts a EAnimDataModelNotifyType::AttributeChanged notify if successful.

Parameters
  • attribute_identifier (AnimationAttributeIdentifier) – Identifier for the attribute from which the key is to be removed

  • time (float) – Time of the key to be removed

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the attribute key was successfully removed

Return type

bool

remove_bone_track(bone_name, should_transact=True) bool

Removes an existing bone animation track with the provided name. Broadcasts a EAnimDataModelNotifyType::TrackRemoved notify if successful.

Parameters
  • bone_name (Name) – Bone name of the track which should be removed

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the removal was successful

Return type

bool

remove_curve(curve_id, should_transact=True) bool

Remove the curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveRemoved notify if successful.

Parameters
Returns

Whether or not the curve was successfully removed

Return type

bool

remove_curve_key(curve_id, time, should_transact=True) bool

Remove a single key from the curve with provided identifier and name. Broadcasts a EAnimDataModelNotifyType::CurveChanged notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the curve for which the key is to be removed

  • time (float) – Time of the key to be removed

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the curve key was successfully removed

Return type

bool

remove_transform_curve_key(curve_id, time, should_transact=True) bool

Removes a single key for the transform curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveChanged notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the transform curve for which the key is to be removed

  • time (float) – Time of the key to be removed

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the transform curve key was successfully removed

Return type

bool

rename_curve(curve_to_rename_id, new_curve_id, should_transact=True) bool

Renames the curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveRenamed notify if successful.

Parameters
Returns

Whether or not the curve was successfully renamed

Return type

bool

resize(length, t0, t1, should_transact=True) None

Sets the total play-able length in seconds and resizes curves. Broadcasts EAnimDataModelNotifyType::SequenceLengthChanged and EAnimDataModelNotifyType::CurveChanged notifies if successful. T0 and T1 are expected to represent the window of time that was either added or removed. E.g. for insertion T0 indicates the time at which additional time starts and T1 were it ends. For removal T0 indicates the time at which time should be started to remove, and T1 indicates the end. Giving a total of T1 - T0 added or removed length. The number of frames and keys for the provided length is recalculated according to the current value of UAnimDataModel::FrameRate.

Parameters
  • length (float) – Total new play-able length value, has to be positive and non-zero

  • t0 (float) – Point between 0 and Length at which the change in time starts

  • t1 (float) – Point between 0 and Length at which the change in time ends

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

resize_play_length(new_length, t0, t1, should_transact=True) None

Sets the total play-able length in seconds. Broadcasts a EAnimDataModelNotifyType::SequenceLengthChanged notify if successful. T0 and T1 are expected to represent the window of time that was either added or removed. E.g. for insertion T0 indicates the time at which additional time starts and T1 were it ends. For removal T0 indicates the time at which time should be started to remove, and T1 indicates the end. Giving a total of T1 - T0 added or removed length. The number of frames and keys for the provided length is recalculated according to the current value of UAnimDataModel::FrameRate.

Parameters
  • new_length (float) –

  • t0 (float) – Point between 0 and Length at which the change in time starts

  • t1 (float) – Point between 0 and Length at which the change in time ends

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

scale_curve(curve_id, origin, factor, should_transact=True) bool

Scales the curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveScaled notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier of the curve to scale

  • origin (float) – Time to use as the origin when scaling the curve

  • factor (float) – Factor with which the curve is supposed to be scaled

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not scaling the curve was successful

Return type

bool

set_bone_track_keys(bone_name, positional_keys, rotational_keys, scaling_keys, should_transact=True) bool

Removes an existing bone animation track with the provided name. Broadcasts a EAnimDataModelNotifyType::TrackChanged notify if successful. The provided number of keys provided is expected to match for each component, and be non-zero.

Parameters
  • bone_name (Name) – Bone name of the track for which the keys should be set

  • positional_keys (Array(Vector)) – Array of keys for the translation component

  • rotational_keys (Array(Quat)) – Array of keys for the rotation component

  • scaling_keys (Array(Vector)) – Array of keys for the scale component

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the keys were successfully set

Return type

bool

set_curve_color(curve_id, color, should_transact=True) bool

Changes the color of the curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveRenamed notify if successful. Currently changing curve colors is only supported for float curves.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier of the curve to change the color for

  • color (LinearColor) – Color to which the curve is to be set

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the curve color was successfully changed

Return type

bool

set_curve_flag(curve_id, flag, state=True, should_transact=True) bool

Set an individual flag for the curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveFlagsChanged notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the curve for which the flag state is to be set

  • flag (AnimAssetCurveFlags) – Flag for which the state is supposed to be set

  • state (bool) – State of the flag to be, true=set/false=not set

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the flag state was successfully set

Return type

bool

set_curve_flags(curve_id, flags, should_transact=True) bool

Replace the flags for the curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveFlagsChanged notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the curve for which the flag state is to be set

  • flags (int32) – Flag mask with which the existings flags are to be replaced

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the flag mask was successfully set

Return type

bool

set_curve_key(curve_id, key, should_transact=True) bool

Sets a single key for the curve with provided identifier and name. Broadcasts a EAnimDataModelNotifyType::CurveChanged notify if successful. In case a key for the provided key time already exists the key is replaced.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the curve for which the key is to be set

  • key (RichCurveKey) – Key to be set

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the curve key was successfully set

Return type

bool

set_curve_keys(curve_id, curve_keys, should_transact=True) bool

Replace the keys for the curve with provided identifier and name. Broadcasts a EAnimDataModelNotifyType::CurveChanged notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the curve for which the keys are to be replaced

  • curve_keys (Array(RichCurveKey)) – Keys with which the existing keys are to be replaced

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not replacing curve keys was successful

Return type

bool

set_frame_rate(frame_rate, should_transact=True) None

Sets the frame rate according to which the bone animation is expected to be sampled. Broadcasts a EAnimDataModelNotifyType::FrameRateChanged notify if successful. The number of frames and keys for the provided frame rate is recalculated according to the current value of UAnimDataModel::PlayLength.

Parameters
  • frame_rate (FrameRate) – The new sampling frame rate, has to be positive and non-zero

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

set_model(model) None

Sets the AnimDataModel instance this controller is supposed to be targeting

Parameters

model (AnimDataModel) – UAnimDataModel instance to target

set_play_length(length, should_transact=True) None

Sets the total play-able length in seconds. Broadcasts a EAnimDataModelNotifyType::SequenceLengthChanged notify if successful. The number of frames and keys for the provided length is recalculated according to the current value of UAnimDataModel::FrameRate.

Parameters
  • length (float) – New play-able length value, has to be positive and non-zero

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

set_transform_curve_key(curve_id, time, value, should_transact=True) bool

Sets a single key for the transform curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveChanged notify if successful. In case a key for any of the individual transform channel curves already exists the value is replaced.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the transform curve for which the key is to be set

  • time (float) – Time of the key to be set

  • value (Transform) – Value of the key to be set

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the transform curve key was successfully set

Return type

bool

set_transform_curve_keys(curve_id, transform_values, time_keys, should_transact=True) bool

Replace the keys for the transform curve with provided identifier. Broadcasts a EAnimDataModelNotifyType::CurveChanged notify if successful.

Parameters
  • curve_id (AnimationCurveIdentifier) – Identifier for the transform curve for which the keys are to be set

  • transform_values (Array(Transform)) – Transform Values with which the existing values are to be replaced

  • time_keys (Array(float)) – Time Keys with which the existing keys are to be replaced

  • should_transact (bool) – Whether or not any undo-redo changes should be generated

Returns

Whether or not the transform curve keys were successfully set

Return type

bool

update_curve_names_from_skeleton(skeleton, supported_curve_type, should_transact=True) None

Updates the display name values for any stored curve, with the names being retrieved from the provided skeleton. Broadcasts a EAnimDataModelNotifyType::CurveRenamed for each to-be-updated curve name, wrapped within BracketOpened/BracketClosed notifies.

Parameters
  • skeleton (Skeleton) – Skeleton to retrieve the display name values from

  • supported_curve_type (RawCurveTrackTypes) – Curve type for which the names should be updated

  • should_transact (bool) – Whether or not any undo-redo changes should be generated