Skip to main content

Module cmt

Module cmt 

Source
Expand description

“cmt “ documents: CSP’s binary tree format for animation track mixers (Track.TrackActionMixer and TrackActionMixer2).

A document is "cmt ", a four-character version (0100 or 0110), "binc", a CRC-32 (little endian) of everything after it, then a string table and one root node. All numbers are little endian. Version 0110 puts a 12-byte header before each node (16, then the offsets of the attribute count and of the child count from the node’s start).

The string table starts with the type names of the version (see TYPES_0100 / TYPES_0110), followed by every other string in the order a pre-order walk first uses it: node name, string values, attribute names and values, then the children. Document::to_bytes rebuilds the table that way, so documents CSP wrote are reproduced byte for byte. See docs/spec/08-animation.md.

Structs§

Document
A whole document.
Node
One node: a name, a value, attributes (name, value) and children.

Enums§

Value
A node’s value. Quat and Matrix44 have not been seen in a file and are refused rather than guessed.

Constants§

TYPES_0100
Type names of version 0100 (single precision arrays and pairs).
TYPES_0110
Type names of version 0110 (double precision arrays and pairs).

Functions§

crc32
CRC-32 (zlib’s) of data.
pack
The external chunk payload of a document’s bytes, compressed as CSP does.
unpack
Decode an external chunk payload holding a zlib-compressed document: u64 big endian (bytes that follow), u32 little endian (zlib stream length), the stream.