BMTR format (binarized RTM)¶
The armaio.rtm module provides utilites for reading the binarized RTM
animation format. The implementations are based on the
Community Wiki binarized RTM page
and further research.
For “binarized” RTM files, the module only supports reading. Writing is only supported through conversion to the “plain” representation.
Warning
While both the “plain” and “binarized” RTM formats use the .rtm
extension, the actual file format is completely different, and not
interchangeable.
In contrast to “plain” files, the BMTR format uses optional compression in some data blocks, and the transformation data itself is stored as relative quaternion-vector pairs, instead of absolute matrices.
Examples¶
Reading¶
from armaio.rtm import BmtrFile
bmtr = BmtrFile.read_file("animation_binarized.rtm")
print(bmtr.motion)
Converting¶
from armaio.rtm import RtmFile, BmtrFile, BoneStructure
bmtr = BmtrFile.read_file("animation_binarized.rtm")
skeleton: BoneStructure = {
"pelvis": {
"torso": {
"leftarm": {},
"rightarm": {}
}
}
}
rtm = RtmFile.from_binarized(bmtr, skeleton)
print(rtm.motion)
Exceptions¶
- class armaio.rtm.BmtrError¶
Exception raised upon BMTR reading errors.
Classes¶
- class armaio.rtm.BmtrFrame(phase: float, bones: tuple[str, ...])¶
Animation frame at a given phase, containing the transformation data for all bones.
- Parameters:
- Raises:
BmtrError – Duplicate bones
- classmethod read(stream: IO[bytes], phase: float, bones: tuple[str, ...]) Self¶
Reads an animation frame from a binary stream.
- property transforms: MappingProxyType¶
- Returns:
Bone transformations
- Return type:
MappingProxyType[str, tuple[RtmQuaternion, RtmVector] | None]
- class armaio.rtm.BmtrFile¶
Animation data read from a binarized RTM file.
- classmethod read_file(filepath: str) Self¶
Reads animation data from a binarized RTM file at a given path.
- Parameters:
filepath (str) – Path to RTM file
- Returns:
Animation data
- Return type:
Self
- property properties: tuple[RtmProperty, ...]¶