pub struct AnimationResource<'a> { /* private fields */ }Expand description
A parsed .ssab. It is read-only, and can back any number of
Contexts.
Implementations§
Source§impl<'a> AnimationResource<'a>
impl<'a> AnimationResource<'a>
Sourcepub unsafe fn new(data: &'a [u8]) -> Result<Self, SSRuntimeError>
pub unsafe fn new(data: &'a [u8]) -> Result<Self, SSRuntimeError>
Parses the animations’ metadata out of data. Fails on a schema-version mismatch.
§Safety
The bytes must be a valid .ssab. They are read through FlatBuffers accessors that do not
bounds-check in release builds, so any other bytes are undefined behaviour (out-of-bounds
reads). A pack the converter wrote is valid; for any other, run the FlatBuffers verifier
first (the ssab crate’s checked root_as_ss_anime_binary).
Sourcepub fn get_ssab_data(&self) -> &'a [u8] ⓘ
pub fn get_ssab_data(&self) -> &'a [u8] ⓘ
The .ssab bytes this resource reads.
Sourcepub fn animations(&self) -> &[AnimationMetadata<'a>]
pub fn animations(&self) -> &[AnimationMetadata<'a>]
The pack’s animations, in the order of the ssab’s animations().
Sourcepub fn get_animation_names(&self) -> Vec<String>
pub fn get_animation_names(&self) -> Vec<String>
The animations’ names, in the same order as Self::animations.
Sourcepub fn find_animation_index(&self, name: &str) -> Option<usize>
pub fn find_animation_index(&self, name: &str) -> Option<usize>
The position of the animation name in Self::animations.
Sourcepub fn find_animation_index_by_hash(&self, hash: u32) -> Option<usize>
pub fn find_animation_index_by_hash(&self, hash: u32) -> Option<usize>
Self::find_animation_index by the fnv1a_hash_str of the name.