Difference between revisions of "ANIM"

From Battlepedia
Jump to navigationJump to search
m
m (reduce redundancy)
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
|games=Night of 100 Frights<br>Battle for Bikini Bottom<br>The SpongeBob SquarePants Movie<br>The Incredibles<br>Rise of the Underminer}}
 
|games=Night of 100 Frights<br>Battle for Bikini Bottom<br>The SpongeBob SquarePants Movie<br>The Incredibles<br>Rise of the Underminer}}
  
==ANIM Importer (Old)==
+
==Tools==
[https://cdn.discordapp.com/attachments/446321271635050508/614641973273296915/anim.zip These are scripts to import most .ANIM files into 3ds Max.] Note: they may look a little wonky or broken.
+
The following tools can be used to work with ANIM files.
 +
===ANIM Importer (Deprecated)===
 +
[https://cdn.discordapp.com/attachments/446321271635050508/614641973273296915/anim.zip These are scripts to import most .ANIM files into 3ds Max.] You really should not use these. They are listed for historical reasons.
  
==The New Anim Importer/Exporter (BFBBAnimTools by Seil)==
+
===BFBBAnimTools===
On October 4th, 2019, user [[User:Seil|Seil]] figured out the ANIM file format and has created a tool called BFBBAnimTools for 3DS Max in MAXScript format. The tool allows a proper import of BFBB's original ANIM files to 3DS Max, as well as now the long awaited export feature, allowing you to create custom anim files for already existing models, or even possibly in the future custom models. The tool allows exporting ANIM files for the PlayStation 2, Xbox, and the GameCube versions of BFBB.
+
This is a 3ds Max script written by [[User:Seil|Seil]] for working with ANIM files. You may get it from [https://battlepedia.org/File:BFBBAnimTools.ms here]
You can download the new BFBBAnimTools utility [http://www.mediafire.com/file/0zt4sx0y9o1206d/BFBBAnimTools.ms/file here.]
 
  
 
==Format==
 
==Format==

Latest revision as of 00:18, 13 October 2019

ANIM
Animation
Type Binary
Object ID -
Games used Night of 100 Frights
Battle for Bikini Bottom
The SpongeBob SquarePants Movie
The Incredibles
Rise of the Underminer

Tools

The following tools can be used to work with ANIM files.

ANIM Importer (Deprecated)

These are scripts to import most .ANIM files into 3ds Max. You really should not use these. They are listed for historical reasons.

BFBBAnimTools

This is a 3ds Max script written by Seil for working with ANIM files. You may get it from here

Format

Animation assets are stored using the SKB format. The overall format looks like this:

iAnimSKBHeader header;
iAnimSKBKey keys[header.KeyCount];
float times[header.TimeCount];
unsigned short offsets[header.TimeCount - 1][header.BoneCount];

Header

The header is defined by an iAnimSKBHeader struct:

struct iAnimSKBHeader
{
	unsigned int Magic;
	unsigned int Flags;
	unsigned short BoneCount;
	unsigned short TimeCount;
	unsigned int KeyCount;
	float Scale[3];
};
  • Magic is always 'SKB1'.
  • Flags
  • BoneCount is the number of bones in the model.
  • TimeCount is the number of times (frames) in the animation.
  • KeyCount is the total number of keyframes in the animation.
  • Scale

Keys

Each keyframe in the keys array is defined by an iAnimSKBKey struct:

struct iAnimSKBKey
{
	unsigned short TimeIndex;
	short Quat[4];
	short Tran[3];
};
  • TimeIndex is an index into the times array
  • Quat represents an quaternion rotation (X, Y, Z, W) for a bone at this keyframe.
  • Tran represents an offset position (X, Y, Z) for a bone at this keyframe.

Times

The times array maps each frame of the animation to a time in seconds. Typically this starts at 0 and increases by a multiple of 0.01666... (1/60th of a second). The last time in the animation can be interpreted as the length of the animation in seconds.

Offsets

The offsets array maps each bone in the model to a starting index in the keys array, for each time (frame) in the animation (except for the last one, because it signifies the end of the animation and doesn't have a keyframe associated with it).

For example, if a model has 3 bones, and each bone has a keyframe on every time (so 3 keyframes per time), then the offsets array would look like this:

offsets[0][0] = 0
offsets[0][1] = 3
offsets[0][2] = 6
offsets[1][0] = 1
offsets[1][1] = 4
offsets[1][2] = 7
offsets[2][0] = 2
...