FB00791E
FB00791E | |
---|---|
Short name: | ANIM |
Long name: | Animation |
This is a type of Scenegraph block that controls animation in Objects and Sims.
Contents |
File Format
ANIM header
7BITSTR "cAnimResourceConst"
Standard Scenegraph followed by custom Animation header.
DWORD Block ID (0xFB00791E) DWORD version (6) -- insert cSGResource
Custom header stuff:
DWORD data length WORD Total Length of Animation (probably in Milliseconds or Frames) WORD count1 count to a list of object modifiers WORD count2 Count for part 7 BYTE ""ObjectModifierLength"" (this is the count for the 2nd string below is non null) BYTE 6 BYTE 4,5,6,7 BYTE 0,2,3,5 BYTE 0,1,6,7,8,9,11,12,14,15,16,30,31,33,34,35,36 BYTE ""ObjectNameLength"" 16 BYTES - FILLER (from old version) (0X11BA05F0) 9 FLOATS unknown the last 2 are generally 1 and -1 ZDSTR Object Name (first object name) ZDSTR Object Modifier string (looks like code to add to a output file always starts out "\nuser_data=") there can be between 0 and 3 bytes here (00 01 02) the logic used for this is explained below
Object
-Repetition count1 8 BYTES - FILLER (from old version) WORD WORD count WORD part5_count WORD length of blend`s name. 12 BYTES - FILLER (from old version) -repetition count1 ZDSTR seems to be a list of objects to blend with 1st object there can be between 0 and 3 bytes here (00 01 02) the logic used for this is explained below
Assignment
-repetition all the count's in part 1 added together 8 BYTES - FILLER (from old version) DWORD - CRC32 of the bone/joint/blend's name DWORD - FILLER (from old version) DWORD - Anim Flags (Highest 3 Bits (Bit 31-29) contain the Number of "Part 3" Items, Bits 23-16 describe the Transformation Type (0=Translation, C=Rotation).) Bits 0-15 of this are the time of the animation for this bone with the highest bit (15) set. DWORD - FILLER (from old version) -repetition all the count's in part 1 added together ZDSTR seems to be a list of transforms and rotations there can be between 0 and 3 bytes here (00 01 02) the logic used for this is explained below
Movements
-repetition (total repetitions are calculated by adding the top 3 bits of all Anim flags from part 2) WORD - number of frames WORD - type of bone (bits 0 and 1) plus how many shorts per part 4 block (bits 2 and 3) DWORD - FILLER (from old version)
Transforms
This Block represents the Transformation Data. Each "Part 4" Block contains all transformations for a specific Axis, ordered by TimeCode. So you can animate the diffrent Axis independently!!
The count for this section is derived with the following code. The code is used on each Unknown1 and 2 in part 3 it uses the 1st, 2nd and 5th bits of Unknown2 then multiplying by Unknown1.
int mult=0; switch(p3.Unk2&3) { case 0: mult=1; break; case 1: mult=3; break; case 2: mult=4; break; } if ((p3.Unk2&16)!=0) mult++; size=(p3.Unk1*mult);
-repetition See above code
WORD seems to be compressed floats. The Values here are stored in Blocks (Number of values per Block = mult). The offset index for a Block can be calculated by offset=mult*blocknr. Here is what we know so far about the Block Structure:
offset + 0 : TimeCode (when should the stored Transformation happen) offset + 1 : (optional) Transformation Value (like the translation amount, or the rotation angle) offset + 2 : (optional, unknown) offset + 3 : (optional, unknown)
Part 5
-repetition (total repetitions are calculated by adding the lower 6( or less?) bits of all part5_count from part 1) 8 BYTES - FILLER (from old version) WORD unknown BYTE count 55 unknown DWORD - FILLER (from old version)
Part 6
-repetition (for each count in Part 5) 8 BYTES - FILLER (from old version) 35 unknown
Events
This on the end of the file if count2 in the header is non zero.
-repetition count2 from begining of file DWORD - FILLER (from old version) WORD unknown WORD unknown WORD unknown DWORD - FILLER (from old version) -repetition count2 ZDS - Event Assignment String
After each of the first 3 sets of text above there is generally an array of up to 3 bytes. This array is probably to bring the section to a specific word cut off. Logic is as follows:
if the length of the strings from the first letter to the end of the section is even the length must be brought up to a even DWORD if the length is odd the length must be brought up to a even WORD that is not also a DWORD
Examples:
- If length =14 then an array of 2 bytes{0,1} must be added to bring it up to a even DWORD(total length divisible by 4).
- If length =15 then an array of 3 bytes{0,1,2} must be added to bring it up to a even WORD(total length divisible by 2).
- Also note that the odd value must not be divisible by 4 but only by 2.
- If length =16 then no array needs to be added as the total length is already divisible by 4.
- If length =17 then one byte{0} must be added to the file to bring it up to a even WORD(total length divisible by 2 but not 4).