com.motorola.iden.micro3d
Class ActionTable
java.lang.Object
|
+--com.motorola.iden.micro3d.ActionTable
- public class ActionTable
- extends java.lang.Object
The ActionTable
class is used to hold 3D animation data. The
Micro3D animation data is stored in a .mtra file.
The .mtra files are used to store keyframe-based animation actions for
the figures. The .mtra files are created with Micro3D plug-ins.
Each .mtra file can contain several actions. When an
ActionTable
object is created with a
createActionTable()
method, all of the actions contained in
the specifed resource or data array are added to the ActionTable
instance. At the minimum, an ActionTable will contain one action. The
method getNumberOfActions()
can be used to obtain the number
of actions associated with the given ActionTable object.
The method getNumberOfFrames
can be used to obtain the number
of frames per each animation. The animations are identified by an index,
an integer number from 0 to (number of actions - 1). The number of frames
obtained with the getNumberOfFrames
method is the number of
frames for that action multiplied by 65536. For example, if an action has
30 frames, then the number obtained by this method is 1966080 (30 * 65536).
MOTOROLA and the Stylized M Logo are registered trademarks of
Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© COPYRIGHT 2003-2004 MOTOROLA, Inc. All Rights Reserved.
Method Summary |
static ActionTable |
createActionTable(byte[] data,
int offset,
int length)
Creates an ActionTable which is decoded from the data stored in
the specified byte array at the specified offset and length. |
static ActionTable |
createActionTable(java.lang.String name)
Creates an ActionTable from the data obtained from the named
resource. |
int |
getNumberOfActions()
Obtains the number of actions found in the ActionTable .
|
int |
getNumberOfFrames(int actionIndex)
Obtains the number of frames for the specified action found in the
ActionTable .
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
createActionTable
public static ActionTable createActionTable(byte[] data,
int offset,
int length)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.ArrayIndexOutOfBoundsException,
java.io.IOException
- Creates an
ActionTable
which is decoded from the data stored in
the specified byte array at the specified offset and length. The data
must be in the format supported by the implementation (.mtra).
The offset
and length
parameters specify
a range of data within the data
byte array. The
offset
parameter specifies the offset into the array of the
first data byte to be used. It must therefore lie within the range
[0..(data.length-1)]. The length
parameter specifies the
number of data bytes to be used. It must be a positive integer and it must
not cause the range to extend beyond the end of the array. That is, it
must be true that offset + length <= data.length.
This method is intended for use when loading an action table from a variety
of sources, such as from persistent storage or from the network.
- Parameters:
data
- the array of animation data in mtra format.offset
- the offset of the start of the data in the array.length
- the length of the data in the array.- Returns:
- the created action table.
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if offset and length specify an
invalid range.java.lang.IllegalArgumentException
- if the array does not contain valid
mtra data.java.io.IOException
- if the data contained cannot be decoded.java.lang.NullPointerException
- if the data array is null
.
createActionTable
public static ActionTable createActionTable(java.lang.String name)
throws java.io.IOException,
java.lang.NullPointerException
- Creates an
ActionTable
from the data obtained from the named
resource. The specified parameter must name a valid resource file
containing the .mtra data.
- Parameters:
name
- the name of the resource containing the animation data in the
supported .mtra format.- Returns:
- the created action table.
- Throws:
java.io.IOException
- if the resource does not exist, the data cannot be
loaded, or the animation data cannot be decoded.java.lang.NullPointerException
- if the resource name is null
.
getNumberOfActions
public int getNumberOfActions()
- Obtains the number of actions found in the
ActionTable
.
- Returns:
- the number of actions in the
ActionTable
.
getNumberOfFrames
public int getNumberOfFrames(int actionIndex)
throws java.lang.IllegalArgumentException
- Obtains the number of frames for the specified action found in the
ActionTable
.
The index of the action requested must be at least 0 and one less than the
value returned by getNumberOfActions() method
. The number
returned by this method is multiplied by 65536.
- Returns:
- the number of frames for the specified action in the
ActionTable
multiplied by 65536. - Throws:
java.lang.IllegalArgumentException
- if actionIndex
is not valid
(less than zero or greater than or equal to the number of actions).