alias_api.AlKeyframe

class alias_api.AlKeyframe

Bases: AlObject

Basic interface to Alias keyframes on parameter curve actions.

AlKeyframe represents a keyframe belonging to an AlParamAction. The keyframe class does not have a create method. New keyframes are created using the AlParamAction.add_key_frame() methods. (this is faster than creating the keyframes, then adding them to the paramaction).

A keyframe cannot belong to more than one action. Thus attempting to add a keyframe that has already been added to an AlParamAction will fail.

If an AlKeyframe is deleted and if the AlKeyframe belongs to an AlParamAction and it is the last keyframe of that parameter curve action, then the AlParamAction will also be deleted. This ensures that no AlParamAction parameter curves will exist with no keyframes.

If a keyframe is added to an AlParamAction, and another keyframe already exists in that AlParamAction with the same location as the keyframe to be added, then the existing keyframe in the AlParamAction will be deleted.

The method that applies tangent types to a keyframe (i.e. setTangentTypes()) does not make much sense if the keyframe is not part of an AlParamAction. It is best to add all the desired keyframes to an AlParamAction, and then walk the list of keyframes, and calling the tangent methods.

You can lock a keyframe by calling the method AlKeyframe::setLock(TRUE). If an AlKeyframe is locked, then none of the AlKeyframe methods that change its location, value or tangents will succeed. The keyframe is non-modifiable. You can unlock the keyframe again by calling AlKeyframe::setLock(FALSE).

copy_wrapper(self: alias_api.AlKeyframe) alias_api.AlObject

Return an exact duplicate of this AlKeyframe wrapper.

delete_object(self: alias_api.AlKeyframe) int

This method deletes a keyframe. If the keyframe is part of an action, then the keyframe will be removed from the action’s list of keyframes. If the keyframe is the last keyframe in an action, the action will also be deleted.

Returns

The status code result of the operation: Success - the object was deleted Failure - the object could not be deleted InvalidObject - the object was invalid

Return type

AlStatusCode

in_tangent(self: alias_api.AlKeyframe) float

This method returns the value of the in-tangent of the keyframe. The value will be between 90.0 and -90.0, where 0.0 represents a flat (horizontal) tangent pointing to the left, 90.0 means the tangent points straight up, and -90.0 means the tangent points straight down. 0.0 is returned in the case of an error.

is_locked(self: alias_api.AlKeyframe) int

This method returns TRUE if the keyframe is locked, FALSE if it is not. A locked keyframe means that you cannot change its time, value or tangents. FALSE is returned in the case of an error.

location(self: alias_api.AlKeyframe) float

This method returns the time value for this keyframe, or 0.0 if the keyframe is invalid.

next(self: alias_api.AlKeyframe) alias_api.AlKeyframe

If this keyframe belongs to a parameter curve action (AlParamAction), then this method will return the next AlKeyframe in the action (or NULL if this keyframe is the last keyframe in the action). If this keyframe does not belong to an action, NULL is returned.

out_tangent(self: alias_api.AlKeyframe) float

This method returns the value of the out-tangent of the keyframe. The value will be between 90.0 and -90.0, where 0.0 represents a flat (horizontal) tangent pointing to the right, 90.0 means the tangent points straight up, and -90.0 means the tangent points straight down. This method returns 0.0 if the keyframe is invalid.

prev(self: alias_api.AlKeyframe) alias_api.AlKeyframe

If this keyframe belongs to a parameter curve action (AlParamAction), then this method will return the previous AlKeyframe in the action (or NULL if this keyframe is the first keyframe in the action). If this keyframe does not belong to an action, NULL is returned.

set_in_tangent(self: alias_api.AlKeyframe, in_tangent: SupportsFloat) int

This method sets the in-tangent of the keyframe to the given value. The tangent value must be in the range -90.0 < inTangent < 90.0 If the given tangent value is outside this range, it is clamped to within this range.

This method requires the AlKeyframe to have been attached to an AlParamAction, otherwise an assertion will fail.

Parameters

in_tangent (float) – the angle in degrees to which the keyframe’s in tangent should be set.

Returns

The status code result of the operation: Success - keyframe’s inTangent was successfully changed Failure - keyframe is locked, thus cannot be changed or failed to make tangent FIXED InvalidObject - the keyframe was invalid

Return type

AlStatusCode

set_location(self: alias_api.AlKeyframe, new_time: SupportsFloat, recompute: SupportsInt = True) int

This method sets the time of the keyframe to be the value given by newTime.

If this keyframe is part of a parameter curve action, the list of keyframes may be reordered to reflect the new position of the keyframe. If the given newTime has the same value as the time of an existing keyframe, then this keyframe will not be moved.

Parameters
  • new_time (float) – the new value for the time of the keyframe

  • recompute (bool) – whether or not to remcompute tangents now

Returns

The status code result of the operation: Success - keyframe’s time was successfully changed Failure - keyframe is locked, thus cannot be changed InvalidObject - the keyframe was invalid

Return type

AlStatusCode

set_lock(self: alias_api.AlKeyframe, flag: SupportsInt) int

This method sets the lock flag of a keyframe. If the keyframe is locked, its time, value and tangents will not be modifiable.

Parameters

flag (bool) – TRUE (if the keyframe should be locked) or FALSE (if not)

Returns

The status code result of the operation: Success - normal completion. InvalidObject - object is invalid

Return type

AlStatusCode

set_out_tangent(self: alias_api.AlKeyframe, arg0: SupportsFloat) int

This method sets the out-tangent of the keyframe to the given value. The tangent value must be in the range -90.0 < outTangent < 90.0 If the given tangent value is outside this range, it is clamped to within this range.

This method requires the AlKeyframe to have been attached to an AlParamAction, otherwise an assertion will fail.

Parameters

out_tangent (float) – the angle in degrees to which the keyframe’s out tangent should be set.

Returns

The status code result of the operation: Success - keyframe’s outTangent was successfully changed Failure - keyframe is locked, thus cannot be changed or failed to make tangent FIXED InvalidObject - the keyframe was invalid

Return type

AlStatusCode

set_tangent_types(self: alias_api.AlKeyframe, in_tangent_type: alias_api.AlTangentType, out_tangent_type: alias_api.AlTangentType, recompute: SupportsInt = True) int

This method sets the in and out tangents of this keyframe to a specific type. Use kTangentUnchanged if you want either to remain unchanged.

This method requires the AlKeyframe to have been attached to an AlParamAction, otherwise an assertion will fail.

Note that this function sets the tangents on a segment. So depending on your choice of tangents, the tangents of the keyframe’s neighbors may be changed.

Parameters
  • in_tangent_type (AlTangentType) – the type of the in tangent

  • out_tangent_type (AlTangentType) – the type of the out tangent

  • recompute (bool) – recompute the spline

Returns

The status code result of the operation: Success - keyframe’s tangents were successfully changed Failure - keyframe is locked, thus cannot be changed InvalidObject - the keyframe was invalid

Return type

AlStatusCode

set_value(self: alias_api.AlKeyframe, new_val: SupportsFloat, recompute: SupportsInt = True) int

This method sets the value of the keyframe to be the value given by newVal.

Parameters
  • new_val (float) – the new value for the value of the keyframe

  • recompute (bool) – whether to recompute the tangents or not.

Returns

The status code result of the operation: Success - keyframe’s value was successfully changed Failure - keyframe is locked, thus cannot be changed InvalidObject - the keyframe was invalid

Return type

AlStatusCode

tangent_types(self: alias_api.AlKeyframe) tuple[int, alias_api.AlTangentType, alias_api.AlTangentType]

This method gets the in and out tangent types of this keyframe. If this method fails to determine the type of either the in or out tangent, sFailure is returned, and either or both of the arguments are set to kTangentUnchanged.

Returns

A tuple containing: (1) The status code result of the operation:

Success - successfully determined keyframe’s tangents. Failure - failed to determine one of the keyframe’s tangents. InvalidObject - the keyframe was invalid

  1. The in tangent type of the keyframe

  2. The out tangent type of the keyframe

Return type

tuple<AlStatusCode, AlTangentType, AlTangentType>

type(self: alias_api.AlKeyframe) alias_api.AlObjectType

Returns the class identifier ‘KeyframeType’.

value(self: alias_api.AlKeyframe) float

This method returns the value of this keyframe, or 0.0 if the keyframe is not valid.