alias_api.AlAction
- class alias_api.AlAction
Bases:
AlObjectBasic interface to Alias actions
AlAction is the base class for an Alias action. An action is an entity that will map time to a value. In Alias, there are two types of actions: parameter curve actions, represented by the derived class AlParamAction, and motion path actions, represented by the derived class AlMotionAction.
You can create new AlActions by creating an AlParamAction or an AlMotionAction. Existing actions can be accessed either through the global list of actions (first_action(), next_action()) or through the list of actions which a channel uses to animate a field of an item (AlChannel.applied_action()). Note that if you delete an action, it may cause other classes to be deleted (for example, AlKeyframe, and AlChannel if the action was the base action of a channel).
- channel_reference(self: alias_api.AlAction, arg0: SupportsInt) alias_api.AlChannel
This method returns the ‘n’th AlChannel that references this AlAction. If ‘n’ is less than 1, or greater than the number of channels that reference this action (as returned by AlAction::numChannelReferences()), then NULL is returned. The list of channels is not in any particular order.
- Parameters
n (int) – the index between 1 and numChannelReferences() of the channel reference to return.
- Returns
The ‘n’th AlChannel that references this AlAction.
- Return type
- comment(self: alias_api.AlAction) str
This method returns the comment on the action.
- copy(self: alias_api.AlAction) alias_api.AlAction
This method makes a copy of this action and returns the copy. If the copy fails, NULL is returned. Note that this method copies the action NOT the wrapper object.
- eval(self: alias_api.AlAction, time: typing.SupportsFloat, compo: alias_api.AlTripleComponent = <AlTripleComponent.X_Component: 1>) float
This method evaluates this action at the given time, and returns the value of the action at that time. If the action is an AlMotionAction, then you must specify which component of the resulting (x,y,z) value to retrieve using the optional second argument.
If the action is not valid, 0.0 is returned.
Evaluation of an AlParamAction is as follows:
An animation parameter curve is a “Poon-Ross” spline (developed by Angus Poon and Dave Ross). This spline is basically a Hermite-linear spline. That is, it is a Hermite in y (the vertical axis) and a linear in x (the horizontal axis). If we call this spline C(t) = (x(t), y(t)), then we see that it is fairly straightforward to compute for the case when x = T since x(t) = t. So we would get C(t) for x = T is (T, y(T)).
To compute a point on a curve segment C(t) (which is bounded by the cvs (t1, y1), (t2, y2) and has tangents m1 and m2 at the start & end of the segment) at t = T, we first make the mapping
T’ = (T - t1) / (t2 - t1)
so that t is in the range [0, 1]. We then get the y value off of the curve segment using the standard computation
C(T) = [T’^3 T’^2 T’ 1] * H *%@ | y1 |
where H is the hermite basis matrix.
- Parameters
time (float) – the time at which to evaluate the action
compo (AlTripleComponent) – which component to get, for motion actions.
- Returns
The value of the action at the given time.
- Return type
float
- extrap_type_post(self: alias_api.AlAction) alias_api.AlActionExtrapType
This method returns the out-of-range, or extrapolation to infinite type of the action after its defined range. If the type can not be retrieved, kEXTRAP_INVALID is returned.
- Return type
- extrap_type_pre(self: alias_api.AlAction) alias_api.AlActionExtrapType
This method gets the out-of-range, or extrapolation to infinite type of the action before its defined range. If the type could not be retrieved, Invalid is returned.
- Return type
- property name
Get or set the AlAction name.
- num_channel_references(self: alias_api.AlAction) int
This method returns the number of channels that use this action. If 0 is returned, this action is considered non-referenced. Note that if one channel uses this action 2 times, this is counted as 2 references. Also note that if the action is not valid -1 will be returned.
- set_comment(self: alias_api.AlAction, new_comment: str) int
This method makes a copy of ‘newComment’ and replaces the existing comment on the action with this new comment.
- Parameters
new_comment (str) – the new comment to assign to the action
- Returns
The status code result of the operation: Success - action’s comment was changed to newComment InvalidArgument - newComment was NULL InvalidObject - this action is not valid
- Return type
- set_extrap_type_post(self: alias_api.AlAction, extrap_type: alias_api.AlActionExtrapType) int
This method sets the out-of-range, or extrapolation to infinite type of the action after its defined range to the given extrapolation type.
- Parameters
extrap_type (AlActionExtrapType) – extrapolation type to set for action after defined range
- Returns
The status code result of the operation: Success - the extrapolation type was successfully determined InvalidObject - the action was not valid InvalidArgument - the given extrapolation type was not valid.
- Return type
- set_extrap_type_pre(self: alias_api.AlAction, extrap_type: alias_api.AlActionExtrapType) int
This method sets the out-of-range, or extrapolation to infinite type of the action before its defined range to the given extrapolation type.
- Parameters
extrap_type (AlActionExtrapType) – extrapolation type to set for action before defined range
- Returns
The status code result of the operation: Success - the extrapolation type was successfully determined InvalidObject - the action was not valid InvalidArgument - the given extrapolation type was not valid.
- Return type
- type(self: alias_api.AlAction) alias_api.AlObjectType
Returns the class identifier ‘ActionType’.