Difference between revisions of "Anim File Format"

From Second Life Wiki
Jump to navigation Jump to search
Line 80: Line 80:
|}
|}


Next, the following block is read for each joint with motion (as defined by Num Joint Motions above) 
Number of joints is followed by joint data.
Foreach joint, read:


{| class="wikitable"
:{| class="wikitable"
|String  
|String  
|Joint name  
|Joint name  
Line 98: Line 99:
|}
|}


Following the number of rotation keys are the blocks of rotation data:
Foreach rotation key on this joint:
{| class="wikitable"
::{| class="wikitable"
|F16  
|F16  
|time  
|time  
Line 110: Line 111:
|}
|}


Following the rotations for this joint is the number of position keys:
After the rotation keys are read, get the position keys.
{| class="wikitable"
:{| class="wikitable"
|S32  
|S32  
|Num Pos Keys  
|Num Pos Keys  
|Number of position keys for this joint  
|Number of position keys for this joint  
|}
|}
This is followed by the blocks of position key data.  For each position key:
For each position key:
{| class="wikitable"
::{| class="wikitable"
|F16  
|F16  
|time  
|time  
Line 128: Line 129:
|//This range is clamped to +- 5.0m
|//This range is clamped to +- 5.0m
|}
|}
 
S32 num_constraints
The joint keys have all be read, now it is time for constraints:
{| class="wikitable"
|S32  
|Num Constraints
|Number of constraints
|}
 
For each constraint:  
For each constraint:  
 
:{| class="wikitable"
* U8 chain_length (number of joints in chain.  
|U8  
* U8 constraint_type  //Types:  CONSTRAINT_TYPE_POINT, CONSTRAINT_TYPE_PLANE  
|chain_length
* 16bytes source_volume  //Collision volume ID string.  
|number of joints in chain.  
* 12bytes source_offset (A Vector3; 3 F32s)
|-
* 16bytes target_volume  //GROUND or collision_volume_id
|U8  
* 12bytes target_offset (A vector3; F32s)
|constraint_type   
* 12bytes target_dir (A vector3 of F32s)
|Types:  CONSTRAINT_TYPE_POINT, CONSTRAINT_TYPE_PLANE  
* F32 constraint ease_in_start  
|-
* F32 constraint ease_in_stop  
|16bytes  
* F32 constraint ease_out_start  
|source_volume   
* F32 constraint ease_out_stop
|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
|
|}

Revision as of 11:02, 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.

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.
U8 constraint_type Types: CONSTRAINT_TYPE_POINT, CONSTRAINT_TYPE_PLANE
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