3

Animation File Operations

In This Section:


Introduction to Animation File Operations


File > Export > Anim and File > Import > Anim let you save and retrieve animation SDL files. Use them to save the animation from one object, hierarchy, or scene, and apply it to another model or scene.

About Animation SDL Files

An Animation SDL file is similar to, but distinct from, a regular SDL file (see File > Export > SDL in Rendering in Alias). It consists of two or three sections, the DEFINITION section, and optional IK section, and the HIERARCHY section.

>
Note: The HIERARCHY section may be omitted when writing out files-in which case, the Animation SDL file contains just a library of animation curves (or actions). However, you will not be able to read these files back into Alias since it requires the HIERARCHY section to import animation.

The DEFINITION section

In the DEFINITION section, specify the description of the curves (or actions) as you do in regular SDL. The syntax for actions is the same for Animation SDL and regular SDL.

In the IK section, specify the IK handles which are attached to the hierarchy and how their channels are animated. The syntax of the IK section looks like the following:



IK
{
type "single chain" ( ik_handle, rootName, endEffectorName );
channel "X Translate" ( ik_handle.X_Translate );
channel "Y Translate" ( ik_handle#2.Y_Translate );
(and so on)
}

{
type "spline" ( ik_handle#2, rootName#2, endEffectorName#2 ):
channel "X Translate" ( ik_handle#2.X_Translate );
channel "Y Translate" ( ik_;handle#2.Y_Translate );
(and so on)
}
(and so on)

The HIERARCHY section

The HIERARCHY section describes how the animation curves in the DEFINITION section are applied to the model's hierarchy.

The braces, { }, bracket these descriptions. You must supply at least one set of braces. The order of the braces describes the hierarchy. Matching pairs of braces inside another matching pair indicates that the inner pair refers to an object that is a child of the outer pair's object. Matching pairs that follow one another indicate that the pairs are children of the same parent. See the following example.



HIERARCHY 

{ <----- Picked object
Animation here applies to picked object.
{ <----- A child of the picked object.
Animation here applies to child of picked object.
{ <----- A child of a child of the picked object.
Animation applies to child of a child of picked object.
}
}
{ <----- Another child of the picked object.
Animation applies to other child of picked object.
}
}

If an object has no animation, but a descendant does, you must still specify the braces for the object, but omit the statements applying any animation to it. This is also necessary for siblings. If the leftmost sibling is unanimated, but the one to its right is animated, you must specify an empty pair of braces as a placeholder for the leftmost child.

See File > Import > Anim on page 126.

Note that you may still supply the object's type statement (see the next section) if you want to make the animation SDL more readable or specify the object's name for later retrieval by name.

The type statement

There are two statements in the HIERARCHY section that apply animation to objects. The first is the type statement, which indicates the type of object that will receive the animation.

The general form of the type statement is:



type "animatable item type name" ( <additional information> );

Examples of the animatable item type name are DAG Node, Camera, Light, Shader, Surface CV, Curve CV, and Polyset Vertex.

  • For DAG Node, specify a name for the DAG node.
  • For the purposes of animation SDL, a Shader includes textures. (Lights and shaders have no additional information, so the parentheses should be empty.)
  • For a Surface CV, specify the U and V values for the CV, separated by a comma. For example, if the u=2 and v=3 CV on a surface is animated, the type statement is:
type "Surface CV" (2, 3);
  • For a Curve CV, specify which CV of the curve is being referred to.
If the curve is part of a face, specify two values separated by a comma. The first value specifies the curve of the face, and the second value specifies the CV on the curve.
For example, if a face is made up of 3 curves then the type statement to refer to the 4th CV on the 2nd curve of the face is:
type "Curve CV" (2, 4);
  • For a Polyset Vertex, specify the vertex number in the polyset.
type "Polyset Vertex" (62);
  • All other animatable items have no additional information, so their parentheses should be empty.

The statements following the type statements indicate how animation is applied to each of the item's animation parameters. These are called channel statements, and specify how the animation parameter uses the actions from the DEFINITION section.

The channel statement

The general form of the channel statement is:



channel "channel name" (action_name [extract axis] (action_name...));

Each animatable item type has its own set of animation parameter names, which can be seen in the param control window (see Animation > Param control on Animation > Param control on page 19 for details).

For example, DAG Nodes have X Translate, Y Translate, Z Scale, and Visibility. These names, which appear in the param control window, can be used as channel name.

>
Note: Some channels cannot be animated: for example, knot spacing or an item's position in a hierarchy. You cannot assign a channel that is not part of the current animation item type. For example, Animation SDL does not differentiate between different types of lights, so it is possible to try to read a Spot spread channel onto a point light, but this will result in an error.

Within the parentheses of the channel statement, you specify the list of actions that make up the channel. If the action is a motion path, you must specify which axis of the 3D NURBS curve to use. Additional actions contained within additional parentheses act as timewarps on the original curve (see Anim > Time Warps > New time warp).

Example SDL File

The following is a commented example animation SDL file of an animated cylinder.



DEFINITION

/* the 3-D NURBS curve used by the motion path action */
curve curve#2 (
degree = 3,
knots = (0.0, 0.0, 0.0, 1.0, 1.0 , 1.0 ),
cvs = (
cv( (0.0, 0.0, 0.0),1.0),
cv( (3.0, 3.0, 3.0),1.0),
cv( (-4.0, 2.0, -6.0),1.0),
cv( (-3.0, 2.0, 3.0),1.0) )
);
/* a motion path action */
motion_curve motion_path ( curve#2, in = PRE_CONSTANT, out = POST_CONSTANT );

/* several parameter curve actions */
parameter_curve param_curve.Timing ( in = PRE_LINEAR, out = POST_LINEAR, cvs = (
parameter_vertex(1.0,0.0 , TAN_SMOOTH, ( -0.27852, -0.96043 ), TAN_SMOOTH,
(0.27852,0.96043) ),
parameter_vertex(30.0,30.0, TAN_SMOOTH, (-0.27852,-0.96043 ), TAN_SMOOTH,
(0.27852,0.96043) )
) );

parameter_curve param_curve.X_Scale ( in = PRE_CONSTANT, out = POST_CONSTANT, cvs = (
parameter_vertex(1.0 , 1.0 , TAN_SMOOTH, (1.0 ,0.0), TAN_SMOOTH, (1.0 , 0.0) ),
parameter_vertex( 30.0 , 4.0 , TAN_SMOOTH, (1.0 ,0.0), TAN_SMOOTH, (1.0 , 0.0) )
) );

parameter_curve param_curve.Z_Rotate ( in = PRE_CONSTANT, out = POST_CONSTANT, cvs = (
parameter_vertex(1.0 , 0.0, TAN_SMOOTH, (-1.0 , 0.0), TAN_SMOOTH, (1.0 , 0.0) ),
parameter_vertex(30.0 ,360.0 , TAN_SMOOTH, (-1.0 , 0.0 ), TAN_SMOOTH, (1.0, 0.0) )
) );

parameter_curve timewarp ( in = PRE_IDENTITY, out = POST_IDENTITY, cvs = (
parameter_vertex(1.0 , 1.0, TAN_SMOOTH, (-0.70711,-0.70711 ), TAN_SMOOTH,
(0.70711,0.70711) ),
parameter_vertex(30.0 ,30.0 ,TAN_SMOOTH, (-0.70711,-0.70711 ),TAN_SMOOTH,
(0.70711,0.70711) )
) );

parameter_curve param_curve.X_Position ( in = PRE_CONSTANT, out = POST_CONSTANT, cvs = (
parameter_vertex(1.0 , -0.2612 , TAN_SMOOTH, (-1.0 ,0.0), TAN_SMOOTH, (-1.0 ,0.0) ),
parameter_vertex( 30.0 , -0.18593, TAN_SMOOTH, (-1.0 ,0.0), TAN_SMOOTH, (-1.0 ,0.0) )
) );

parameter_curve param_curve.Y_Position ( in = PRE_CONSTANT, out = POST_CONSTANT, cvs = (
parameter_vertex(1.0 ,0.2612 , TAN_SMOOTH, (-1.0 ,0.0 ), TAN_SMOOTH, (-1.0 ,0.0) ),
parameter_vertex( 30.0 , 0.58722, TAN_SMOOTH, ( -1.0, 0.0 ), TAN_SMOOTH, (-1.0 ,0.0))
) );

parameter_curve param_curve.Z_Position ( in = PRE_CONSTANT, out = POST_CONSTANT, cvs = (
parameter_vertex( 1.0, 0.5, TAN_SMOOTH, ( -1.0, 0.0 ), TAN_SMOOTH, ( 1.0, 0.0 ) ),
parameter_vertex( 30.0, 0.90137, TAN_SMOOTH,( -1.0 , 0.0 ), TAN_SMOOTH,(-1.0 ,0.0))
) );

HIERARCHY
{
type "Dag Node" ( cylinder );

/* The cylinder is moved along a motion path. */
/* Each channel is extracted from a motion path */
/* with one timing curve modifying all three. */
channel "X Translate" ( motion_path [X] ( param_curve.Timing ));
channel "Y Translate" ( motion_path [Y] ( param_curve.Timing ));
channel "Z Translate" ( motion_path [Z] ( param_curve.Timing ));
/* The width of the cylinder is also animated. */
channel "X Scale" ( param_curve.X_Scale );
{
/* This is the first child of the top level */
/* of the cylinder. It spins around the Z */
/* axis. A timewarp has been applied. */
type "Dag Node" ( cyl_body );
channel "Z Rotate" ( param_curve.Z_Rotate ( timewarp ));
}
{
/* Cap A of the cylinder is not animated, */
/* nor are any of its CVs, but these braces */
/* are necessary to maintain to maintain the*/
/* hierarchy structure. */
/* If these braces were omitted Cap B's */
/* animation would be read onto Cap A. */
}
{
/* Cap B is not animated but one of its cvs */
/* is. */
{
type "Surface CV" ( 2, 4 );
/* Surface CV u = 2, v = 4 is animated. */
channel "X Position" ( param_curve.X_Position );
channel "Y Position" ( param_curve.Y_Position );
channel "Z Position" ( param_curve.Z_Position );
}
}
}




Copyright © 1998, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. Please send questions or comments regarding the documentation to:
[email protected]