Anim File Format

From Second Life Wiki
Jump to navigation Jump to search
KBtip2.png Tip: You may find the contents of Internal Animation Format page helpful in addition to this page.

The file format parser may be found in the open-source viewer code in the directory indra/llcharacter/llkeyframemotion.cpp LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id)


  • S32 Signed 32-bit integer
  • U8 Unsigned 8-bit integer (char)
  • U16 Unsigned 16-bit integer
  • U32 Signed 32-bit integer
  • F16 16-bit float.
  • F32 32-bit float.

Strings from binary unpacker take the form of a S32 for the length of the string followed by the string data. There is no null terminator. EX: cat=3cat

File organization

The anim format consists of the following header and then 0 or more recurrent blocks in sequence.

Type Name Values possible Notes
U16 Version 1 //Required to be 1.
U16 Sub Version 0 //Required as 0.
S32 Base Priority USE_MOTION_PRIORITY = -1,
//Needs to be UI element in anim exporter.
F32 Duration Number secs for anim to run
String Emote_Name String to identify animation. //Verify
F32 Loop In Point Sec where loop starts
F32 Loop Out Point Sec where loop ends
S32 Loop True/False //Converts to bool
F32 Ease-in duration Secs
F32 Ease-out duration Secs
U32 Num Hand Poses //Treating as 0 for this example.
U32 Num Joint Motions <= max joints of skeleton //Number of joints that move in this anim.

Number of joints is followed by joint data. Foreach joint, read:

String Joint name joint to move
S32 Joint priority See above
S32 Num Rot Keys Number of rotation keys for this joint

Foreach rotation key on this joint:

F16 time time (relative to start of animation) //This becomes less accurate the longer the overall duration of the animation.
3 U16 X Y Z The rotation on each axis

After the rotation keys are read, get the position keys.

S32 Num Pos Keys Number of position keys for this joint

For each position key:

F16 time time (relative to start of animation) //This becomes less accurate the longer the overall duration of the animation.
3 U16 X Y Z The position relative each joint's start position. //This range is clamped to +- 5.0m

The joint keys have all be read, now it is time for constraints:

S32 Num Constraints Number of constraints

For each constraint:

U8 chain_length number of joints in chain.
16bytes source_volume Collision volume ID string.
3 F32 source_offset X,Y,Z
16bytes target_volume Collision volume ID string.
3 F32 target_offset X,Y,Z
3 F32 target_direction X,Y,Z
F32 Constraint ease_in_start
F32 Constraint ease_in_stop
F32 Constraint ease_out_start
F32 Constraint ease_out_stop

See also

scripts/content_tools/ in the viewer source