Difference between revisions of "Anim File Format"
Aura Linden (talk | contribs) |
Aura Linden (talk | contribs) |
||
Line 1: | Line 1: | ||
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) | |||
== Definitions == | == Definitions == | ||
* S32 Signed 32-bit integer | |||
* U8 Unsigned 8-bit integer (char) | |||
* U16 Unsigned 16-bit integer | |||
* U32 Signed 32-bit integer | |||
-F32 32-bit float. | * 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 | 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. | |||
{| class="wikitable" | {| class="wikitable" | ||
!Type | !Type | ||
Line 69: | Line 72: | ||
|Num Hand Poses | |Num Hand Poses | ||
| | | | ||
|// | |//Treating as 0 for this example. | ||
|- | |- | ||
|U32 | |U32 | ||
Line 77: | Line 80: | ||
|} | |} | ||
Next, the following block is read for each joint with motion (as defined by Num Joint Motions above) | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 93: | Line 96: | ||
|Num Rot Keys | |Num Rot Keys | ||
|Number of rotation keys for this joint | |Number of rotation keys for this joint | ||
|} | |} | ||
Following the number of rotation keys are the blocks of rotation data: | |||
{| class="wikitable" | |||
|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 | |||
|} | |||
Following the rotations for this joint is the number of position keys: | |||
{| class="wikitable" | |||
|S32 | |||
|Num Pos Keys | |||
|Number of position keys for this joint | |||
|} | |||
This is followed by the blocks of position key data. For each position key: | |||
{| class="wikitable" | |||
|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 | |||
|} | |||
S32 num_constraints | S32 num_constraints |
Revision as of 09:41, 8 August 2018
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)
Definitions
- 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, LOW_PRIORITY = 0, MEDIUM_PRIORITY, HIGH_PRIORITY, HIGHER_PRIORITY, HIGHEST_PRIORITY, ADDITIVE_PRIORITY = LL_CHARACTER_MAX_PRIORITY |
//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. |
Next, the following block is read for each joint with motion (as defined by Num Joint Motions above)
String | Joint name | joint to move | |
S32 | Joint priority | See above | |
S32 | Num Rot Keys | Number of rotation keys for this joint |
Following the number of rotation keys are the blocks of rotation data:
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 |
Following the rotations for this joint is the number of position keys:
S32 | Num Pos Keys | Number of position keys for this joint |
This is followed by the blocks of position key data. 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 |
S32 num_constraints For each constraint:
- U8 chain_length (number of joints in chain.
- U8 constraint_type //Types: CONSTRAINT_TYPE_POINT, CONSTRAINT_TYPE_PLANE
- 16bytes source_volume //Collision volume ID string.
- 12bytes source_offset (A Vector3; 3 F32s)
- 16bytes target_volume //GROUND or collision_volume_id
- 12bytes target_offset (A vector3; F32s)
- 12bytes target_dir (A vector3 of F32s)
- F32 constraint ease_in_start
- F32 constraint ease_in_stop
- F32 constraint ease_out_start
- F32 constraint ease_out_stop