Skip to main content

Crate ssab

Crate ssab 

Source
Expand description

The .ssab / .ssqb binary format — SpriteStudio’s on-disk runtime data.

This crate is the schema, not a library of behaviour: almost everything under ssab and ssqb is FlatBuffers code generated from fbs/ssab.fbs and fbs/ssqb.fbs. It sits between the two halves of the SDK — ssconverter writes these binaries, ssruntime reads them zero-copy.

ModuleRoot tableHolds
ssabSsAnimeBinaryanimations, parts, keyframes, cell maps, effects
ssqbSsSequenceBinarysequence packs (.ssqe)

§Reading (default)

The default feature set is read-only and zero-copy, which is what a Player wants: accessors borrow directly out of the mapped buffer, with no parse step and no allocation.

use ssab::ssab::ss::format::root_as_ss_anime_binary;

let bytes = std::fs::read("character.ssab")?;
let binary = root_as_ss_anime_binary(&bytes)?;
println!("{}", binary.name());
for anime in binary.animations() {
    println!("  {} @ {} fps", anime.name(), anime.fps());
}

§Writing (converter)

Enabling converter selects the modules generated with the FlatBuffers object API (--gen-object-api), which add owned …T structs that can be built up in memory and packed back into a buffer. Only tools that emit data need this; it implies std.

§Feature flags

FeaturePurpose
std (default)std support in flatbuffers. Disable for no_std Players.
converterRead/write object API (SsAnimeBinaryT and friends). Implies std.

§Validation

root_as_* verifies the buffer; the _unchecked variants do not. ssruntime deliberately uses the unchecked path in the playback hot loop, which is why validating untrusted assets is the Player’s responsibility.

§Regenerating

The Rust modules are generated output — edit fbs/*.fbs and re-run scripts/generate.sh (or .ps1), which needs flatc on PATH. Never hand-edit src/runtime/ or src/converter/.

See the schema documentation for the field-by-field design spec.

Modules§

ssab
ssqb

Constants§

NO_CURVE
Keyframes.curve for a key that reads neither a curve nor an easing rate.
NO_KEYS
A PartAnimationData field with no run: the animation has no keys for that attribute on that part. It is the fields’ schema default, so it is never written.
SSAB_SCHEMA_VERSION
The .ssab schema version the converter stamps into every pack it emits and the runtime refuses to read anything else as.
SSQB_SCHEMA_VERSION
The .ssqb counterpart of SSAB_SCHEMA_VERSION.

Functions§

ssab_schema_version
.ssab schema version. See SSAB_SCHEMA_VERSION.
ssqb_schema_version
.ssqb schema version. See SSQB_SCHEMA_VERSION.