This module provides base classes to read Acclaim Skeleton and Motion Files (ASF/AMC) containing the definition of a character and its motion. The classes parse the files and call handler methods that can be implemented in a derived class.
The ASFReader class reads Acclaim Skeleton Files (ASF) and calls appropriate methods which have to be implemented in a derived class.
filename is the name of the ASF file that should be read.
Read the entire file.
This method is called when the file format version is encountered. version is a float containing the version number.
This method is called when the skeleton name is read.
This method is called when the units section was read. units is a dictionary that contains all definitions that were present in the units section of the input file. The key is the unit name (such as mass, length and angle) and the value is the corresponding value. If possible the value was cast to float, otherwise it’s still a string.
This method is called when the file documentation was read. doc contains the documentation (which may contain several lines).
This method is called when the root section was read. This section contains information about the root of the skeleton. data is a dictionary that contains all the key-value pairs in the root section. The value is always a tuple (even when it’s only one single value).
This method is called after the entire bone data was read. bones is a list of bone definitions. Each definition is a data dictionary containing the key-value pairs in the respective bone section. All values are tuples (even when it’s only one single value). An exception to this is the limits attribute which is a list of (min, max) tuples that contain the minumum and maximum limits as floats (or as the special strings "-inf" and "inf").
This method is called after the hierarchy section was read. links is a list of 2-tuples (parent, children) where parent is the name of the parent bone and children is a list of children bone names.
The AMCReader class reads Acclaim Motion Capture Data (AMC) files and calls onFrame() for every motion sample in the file.
filename is the name of the AMC file that should be read.
Read the entire file.
This method is called for every frame. framenr is the frame number and data is a list of 2-tuples (bone, values) where bone is a bone name and values the corresponding position/orientation for this frame. The number of values and the meaning of the values is defined in the corresponding ASF file.