Skip to main content

Module ffi

Module ffi 

Source
Expand description

The C ABI — how every non-Rust Player talks to the runtime.

A flat set of extern "C" functions mirroring the Rust API, plus the opaque handles that carry state across the boundary. cbindgen generates ssruntime.h from this module and opens it with this text, so it is written for the C or C++ integrator.

§Handles

Every handle is an opaque void *. The two that every Player holds:

  • Resource (ss_resource_create_copy / _borrow → ss_resource_destroy) — parsed .ssab data. Internally reference-counted, so it is safe to destroy a resource that contexts are still bound to; the buffer stays alive until the last one lets go. The _borrow variant does not copy, so the caller’s buffer must outlive the resource and every context and effect slot holding it.
  • Context (ss_runtime_create → ss_runtime_destroy) — the playback state of one animated object: a stack of tracks, each playing an animation, layered onto the setup pose. Bind a resource with ss_runtime_bind_resource; several contexts may share one.

Effect and instance parts get their own handles (ss_effect_slot_create, ss_instance_slot_create), stepped once per tick by the Player.

§Calling convention

Fallible calls return bool (or a null pointer, or SS_RUNTIME_INVALID_HANDLE) and record the reason on the context. ss_runtime_get_last_error reads back a stable code, and ss_runtime_error_message turns that code into the text to put in front of a user — which is what a Player owes its caller. The message takes the code, not the context, so it is a pure lookup with nothing to own and nothing to outlive. The track and source getters that return a float use NaN for a track or source that does not exist, which is distinguishable from a legitimate 0.0. The context-wide ones (ss_runtime_get_frame_no, ss_runtime_get_speed_scale and ss_runtime_update) have no such case, and return 0.0 for a null context.

The two ss_resource_create_* constructors and ss_effect_slot_create are the exception: they take no context, so a null return is the whole report. For a resource that is enough, because there are only two ways to get one — a null ptr, which the caller passed, and an .ssab whose schema version this runtime does not read. (Bytes that are not an .ssab at all are not among them; nothing here validates the input. See Validation below.)

§Building a resource

ss_resource_create_* then ss_runtime_bind_resource is the full form: it leaves you holding the resource handle, which is what ss_effect_slot_create takes and what lets one parsed pack serve several contexts. ss_runtime_load_ssab_* is the one-liner for when you need neither — it creates, binds, and drops its own reference.

They are alternatives, not a sequence. Calling both on the same bytes parses the pack twice, and the parse is where every animation’s metadata is built.

Buffers handed out through out_data / out_len pairs point into runtime-owned memory and stay valid only until the next call that rewrites them. Copy anything you need to keep.

§Safety

Every entry point that takes a handle or a pointer relies on one contract, stated here rather than on each of them (it is why they are unsafe to call from Rust):

  • A handle is null, or what its own create function returned and not yet destroyed: a context where a context is asked for, a slot where a slot is. A null handle is never dereferenced.
  • A handle is not used from two threads at once. Different handles may be used from different threads at the same time, contexts that share one resource included.
  • An out_data / out_len pointer is null or valid for a write.

The ones that read a data or string pointer add their own # Safety section.

§Validation

Loading does not validate the .ssab (see “Limitations to design around” in the ssruntime crate docs). Every entry point that takes a data pointer trusts it.

Re-exports§

pub use crate::types::*;

Constants§

SS_RUNTIME_INVALID_HANDLE
Sentinel returned on failure by the functions that return a source handle, and by ss_runtime_get_track_blend / ss_runtime_get_track_sync for a track that does not exist. No live handle ever equals it.
SS_RUNTIME_LOG_ERROR
Severity passed to SsLogCallback. The runtime only ever emits ERROR today; WARN and INFO are reserved so a host can switch on the level without its arms going stale when the runtime starts using them.
SS_RUNTIME_LOG_INFO
See SS_RUNTIME_LOG_ERROR.
SS_RUNTIME_LOG_WARN
See SS_RUNTIME_LOG_ERROR.
SS_RUNTIME_TRACK_BLEND_ADDITIVE
SS_RUNTIME_TRACK_BLEND_MIX
Track blend operators: what ss_runtime_set_track_blend takes and ss_runtime_get_track_blend returns.
SS_RUNTIME_TRACK_SYNC_FREE
Where the animations laid on a track start: what ss_runtime_set_track_sync takes and ss_runtime_get_track_sync returns.
SS_RUNTIME_TRACK_SYNC_START

Functions§

ss_effect_slot_create⚠
Create a new EffectSlot bound to resource. Returns null on failure (resource not loaded, effect_name_hash not found, malformed effect data).
ss_effect_slot_destroy⚠
Release a slot and its share of the resource. Null is ignored.
ss_effect_slot_get_seed⚠
The seed the slot was created with; 0 for a null slot.
ss_effect_slot_is_independent⚠
Whether the slot is currently running independently of the parent’s frame. Reflects the most recently seen EventEffect.independent. Callers use this to decide whether to schedule continuous tick updates regardless of parent frame change.
ss_effect_slot_reset⚠
Reset the slot’s playback / “last started key” memory to its just-created state without destroying it. Call on an explicit head-out (ss_runtime_play / replay) so a re-played animation re-fires its effect from scratch instead of debouncing the first key as the same one the slot last started. The resource binding and emitter caches are preserved.
ss_effect_slot_step⚠
Advance the slot one frame. The caller resolves the active effect event (via ss_runtime_get_active_effect_event) and feeds it here together with timing inputs. parent_looped re-arms transition detection across the parent’s loop edge.
ss_instance_slot_create
Create a fresh InstanceSlot. Slots are stateless at construction (no resource binding) — step operates against a child runtime context supplied per call.
ss_instance_slot_destroy⚠
Release a slot. Null is ignored.
ss_instance_slot_get_speed⚠
The speed the most recent ss_instance_slot_step drove the child at, 1.0 before the first or for a null slot. Usually the key’s speed, but while the slot ignores the implicit frame-0 key it keeps the last real key’s, so the event the host resolved says 1.0 when the child is not running at it. Scale the elapsed time handed to the child’s own instance and effect slots by its absolute value, not by the resolved event’s speed.
ss_instance_slot_is_independent⚠
Whether the slot’s current key plays the child on its own time rather than the parent’s frame.
ss_instance_slot_reset⚠
Reset the slot’s “last started key” memory to its just-created state without destroying it. Call on an explicit head-out (ss_runtime_play / replay) so a re-played animation re-fires the instance child from scratch instead of debouncing the first key as the same one the slot last started.
ss_instance_slot_step⚠
Drive the instance slot for one tick. The caller resolves the active EventInstance (via ss_runtime_get_active_event_instance against the parent runtime context) and passes the child runtime context here so that label resolution and frame stepping happen against the right Context. Returns transitioned == true on EventInstance edges, having configured the child for the new key without starting it: the caller then calls ss_runtime_play on the child (an independent child never advances otherwise). Draw the child at child_frame_no on that tick too: the slot already put it where play snaps it, and a synced child’s value follows the parent, which reading the frame back after play would lose.
ss_resource_create_borrow⚠
Create a resource that reads the len bytes at ptr in place, with no copy. Release it with ss_resource_destroy. Returns null for a null ptr or a pack of another schema version.
ss_resource_create_copy⚠
Create a resource from a copy of the len bytes at ptr, which may be freed on return. Release it with ss_resource_destroy. Returns null for a null ptr or a pack of another schema version.
ss_resource_destroy⚠
Release this handle. Null is ignored. A context or effect slot bound to the resource keeps its own share, so this is safe while they live.
ss_runtime_add_track_source⚠
Add another weighted source to track (locomotion-style blending). Returns SS_RUNTIME_INVALID_HANDLE on failure.
ss_runtime_add_track_source_by_hash⚠
ss_runtime_add_track_source by the hash of the name.
ss_runtime_bind_resource⚠
Bind a resource to a context, which takes its own share of it. One resource can be bound to several contexts, and ss_resource_destroy is safe while they are: the resource lives until the last of them is destroyed, reset or bound to another. A _borrow resource’s buffer is the caller’s to keep alive for as long.
ss_runtime_cancel_track_fade⚠
Cancel the fade on track, leaving its alpha and weights where they stand.
ss_runtime_clear_all_part_overrides⚠
Clear every per-part override on the context.
ss_runtime_clear_part_cell_override⚠
Clear a part’s cell override.
ss_runtime_clear_part_color_override⚠
Clear a part’s color override.
ss_runtime_clear_part_visibility_override⚠
Clear a part’s visibility override (revert to animation).
ss_runtime_clear_track⚠
Silence track: its sources are released and its fade cancelled. Track 0 cannot be cleared (InvalidParameter); fade it to alpha 0 instead.
ss_runtime_create
Create an empty context. Bind a resource and set up an animation before playing. Release it with ss_runtime_destroy.
ss_runtime_crossfade⚠
Fade track to name over duration_ms — the same time unit as ss_runtime_update’s delta. A track that does not exist yet is created. Returns false with InvalidParameter for a duration_ms that is not positive, a NaN or a null name, and with AnimationNotFound for a name the pack does not have or before ss_runtime_setup_animation.
ss_runtime_crossfade_by_hash⚠
ss_runtime_crossfade by the hash of the name.
ss_runtime_destroy⚠
Release a context and its share of the bound resource. Null is ignored.
ss_runtime_error_message
The wording behind a code from ss_runtime_get_last_error, as NUL-terminated UTF-8.
ss_runtime_fade_track⚠
Drive the alpha of track to target_alpha over duration_ms, the same time unit as ss_runtime_update’s delta. Returns false with InvalidParameter for a duration_ms that is not positive, a NaN, or a track that does not exist.
ss_runtime_find_part_index⚠
Resolve a part name to its part_index in the current primary animation. Returns -1 on null context / null or invalid name / not found.
ss_runtime_get_active_effect_event⚠
Resolve the active EventEffect for slot_index on the parent’s currently selected animation, at the current frame. When no real event has fired yet, falls back to InitialEvents.effect for the slot (with is_synthetic_default = true); if neither exists, returns full SS6 defaults (start_time = 0, speed = 1.0, independent = false).
ss_runtime_get_active_event_instance⚠
Resolve the active EventInstance for slot_index on the parent’s currently selected animation, at the current frame. Returns SS6 default semantics (is_synthetic_default = true, loop_num = 1, speed = 1.0) when no event is active, so callers don’t need to branch on the no-event case.
ss_runtime_get_cell_meta⚠
Per-part resolved cell metadata for the current frame, written by ss_runtime_get_frame_data. Layout: [pivot_x, pivot_y, size_w, size_h, rect_left, rect_top] per part, indexed by part_index * 6. (rect_left, rect_top) is the cell rectangle origin in the cellmap’s texture pixel space, letting a Player build a complete source rect (origin + size) without its own cellmap lookup. Parts without a current cell carry zeros.
ss_runtime_get_coordinate_system⚠
0 = Y-up, 1 = Y-down.
ss_runtime_get_current_animation_index⚠
Which animation track 0’s main source plays, as an index into the ssab’s animations(): a crossfade or a track animation on track 0 changes it from the call on. -1 before anything is set up.
ss_runtime_get_end_frame⚠
The last frame of the playback range: the section’s when one is set, otherwise the animation’s.
ss_runtime_get_frame_data⚠
Build the FrameData of frame_no, which is in [first frame, last frame + 1) of the animation, and write where it is to out_data and out_len.
ss_runtime_get_frame_no⚠
The playhead of track 0’s main animation, with its fraction: what ss_runtime_update last returned, or where a seek put it.
ss_runtime_get_frame_rate⚠
The rate track 0’s animation plays at, in frames per second: the override when one is set, otherwise the rate it was authored at.
ss_runtime_get_last_error⚠
Why the last call that tracks a reason failed, as a stable code: 1 EmptyData, 2 InvalidVersion, 3 AnimationNotFound, 4 NotLoaded, 5 InvalidParameter, 6 MemoryError, 7 MalformedEffect, 99 Unknown. 0 means the last such call succeeded, and so does a null context.
ss_runtime_get_local_uvs⚠
Per-part UVs for the current frame, written by ss_runtime_get_frame_data, matching ss_runtime_get_local_vertices: [lt.u, lt.v, rt.u, rt.v, lb.u, lb.v, rb.u, rb.v, center.u, center.v] = 10 floats, indexed by part_index * 10, in the cellmap’s texture-pixel space. Divide by the texture size to normalize.
ss_runtime_get_local_vertices⚠
Per-part local-space vertex positions for the current frame, written by ss_runtime_get_frame_data. Layout per part: [lt.x, lt.y, rt.x, rt.y, lb.x, lb.y, rb.x, rb.y, center.x, center.y] = 10 floats, indexed by part_index * 10. Coordinates are in part-local space with coordinate_system (Y-Up/Y-Down) flip already applied, so a Player just multiplies them by the world matrix. Includes pivot, image flip, and per-frame vertex deformation. Parts without a current cell carry zeros. Replaces FrameData::vertices for renderers that consume pre-resolved SoA buffers.
ss_runtime_get_loop_count⚠
-1 for an animation that loops forever, otherwise the cycles it plays.
ss_runtime_get_mesh_index_offsets⚠
CSR-style prefix sum (length = num_parts + 1) for the triangle indices in ss_runtime_get_mesh_indices. Part p occupies [offsets[p], offsets[p + 1]); non-mesh parts have an empty range.
ss_runtime_get_mesh_indices⚠
Mesh triangle indices (part-local, 0-based), concatenated across all parts. Static. Slice part p’s range via ss_runtime_get_mesh_index_offsets: [offsets[p], offsets[p + 1]).
ss_runtime_get_mesh_uvs⚠
Mesh per-vertex UV coordinates in cellmap texture-pixel space, interleaved [u, v, ...], concatenated across all parts. Static — resolved once from each mesh part’s frame-0 Cell. Sliced per-part by ss_runtime_get_mesh_vertex_offsets, identically to the vertex buffers.
ss_runtime_get_mesh_vertex_offsets⚠
CSR-style prefix sum (length = num_parts + 1) describing where each part’s mesh vertices live inside ss_runtime_get_mesh_vertices_x / _y. Part p occupies indices [offsets[p], offsets[p + 1]); non-mesh parts have offsets[p] == offsets[p + 1].
ss_runtime_get_mesh_vertices_x⚠
Mesh per-vertex X coordinates in world space, concatenated across all parts. Pair with ss_runtime_get_mesh_vertex_offsets to slice per-part ranges: part p’s vertices live at indices offsets[p]..offsets[p + 1]. Non-mesh parts contribute an empty range. SceneGraph render mode leaves the buffer empty (length 0).
ss_runtime_get_mesh_vertices_y⚠
Mesh per-vertex Y coordinates. SoA companion to ss_runtime_get_mesh_vertices_x; sliced identically via ss_runtime_get_mesh_vertex_offsets.
ss_runtime_get_nines_box_coords⚠
Nine-Slice per-vertex box coordinates, interleaved [fx, fy, ...] with 0 at the part’s left / top edge and 1 at its right / bottom edge. Shares the vertex CSR of ss_runtime_get_nines_vertex_offsets.
ss_runtime_get_nines_index_offsets⚠
CSR-style prefix sum (length = num_parts + 1) for the triangle indices in ss_runtime_get_nines_indices. Part p occupies [offsets[p], offsets[p + 1]); non-nines parts have an empty range.
ss_runtime_get_nines_indices⚠
Nine-Slice triangle indices, concatenated across all parts and sliced by ss_runtime_get_nines_index_offsets. Values are part-local (0..vertex_count), so a Player passes them alongside the part’s vertex slice without rebasing. Each quad is wound LT, RT, LB / LB, RT, RB.
ss_runtime_get_nines_uvs⚠
Nine-Slice per-vertex UVs in cellmap texture-pixel space, interleaved [u, v, ...]. Shares the vertex CSR of ss_runtime_get_nines_vertex_offsets. Divide by the texture size to normalize, the same as ss_runtime_get_local_uvs.
ss_runtime_get_nines_vertex_offsets⚠
CSR-style prefix sum (length = num_parts + 1) over the vertex buffers ss_runtime_get_nines_vertices / _uvs / _box_coords. Part p occupies vertices [offsets[p], offsets[p + 1]) — multiply by 2 to index the interleaved floats. Non-nines parts have an empty range.
ss_runtime_get_nines_vertices⚠
Nine-Slice per-vertex positions for the current frame, interleaved [x, y, ...] and concatenated across all parts, written by ss_runtime_get_frame_data. Slice per part with ss_runtime_get_nines_vertex_offsets; parts drawn by another DrawBatchKind occupy an empty range.
ss_runtime_get_origin⚠
0 = the canvas center, 1 = its top-left corner.
ss_runtime_get_passed_event_count⚠
How many events the last ss_runtime_update passed. They stay until the next one, ss_runtime_setup_animation, ss_runtime_bind_resource or ss_runtime_reset.
ss_runtime_get_passed_event_index⚠
Collected event index, as an index into the events() of the animation of the source that fired it (ss_runtime_get_passed_event_source_handle); -1 out of range.
ss_runtime_get_passed_event_source_handle⚠
Which source fired the collected event at index — parallel to ss_runtime_get_passed_event_index, and read with the same index.
ss_runtime_get_playback_direction⚠
0 = forward, 1 = backward.
ss_runtime_get_playback_style⚠
0 = normal, 1 = ping-pong.
ss_runtime_get_remaining_loops⚠
The cycles left, 0 once finished; -1 for an animation that loops forever.
ss_runtime_get_render_mode⚠
0 = Direct, 1 = SceneGraph.
ss_runtime_get_shape_vertex_box_coords⚠
Per-vertex normalized bounding-box coordinates paired with ss_runtime_get_shape_vertices. Layout: 12 vertices × (fx, fy) = 24 floats (SHAPE_VERTICES_STRIDE) per part, indexed by part_index * 24. (0, 0) corresponds to the LT corner of the shape’s pre-pivot bounding box, (1, 1) to the RB corner, regardless of pivot offset or coordinate system. Players use this to interpolate the four part-color corners without re-deriving the box layout.
ss_runtime_get_shape_vertex_counts⚠
Per-part valid vertex count for ss_runtime_get_shape_vertices. Indexed by part_index. Zero for parts that are not shape parts (or shape parts whose size collapsed to zero).
ss_runtime_get_shape_vertices⚠
Per-part shape vertex positions for the current frame, written by ss_runtime_get_frame_data. Layout: 12 vertices × (x, y) = 24 floats (SHAPE_VERTICES_STRIDE) per part, indexed by part_index * 24. Vertices are in local space, post-pivot, post-coord-system, so a Player just multiplies them by the world matrix. Only the first ss_runtime_get_shape_vertex_counts(...)[part_index] vertices are valid; remaining slots are zero-initialized. Non-shape parts carry zero count and zero-filled vertex slots. When no part of the pack is a shape, the buffer is empty, as is ss_runtime_get_shape_vertex_box_coords.
ss_runtime_get_skip_frames⚠
What ss_runtime_set_skip_frames stored.
ss_runtime_get_source_animation_index⚠
Which animation the source handle plays, as an index into the ssab’s animations(); -1 for a handle that names no source. An event index addresses the events() of the animation of the source that fired it (ss_runtime_get_passed_event_source_handle), track 0’s included: after a crossfade on track 0 that is the incoming animation.
ss_runtime_get_source_event_threshold⚠
NaN for an invalid or released handle.
ss_runtime_get_source_frame⚠
The playhead of a source; NaN for an invalid or released handle.
ss_runtime_get_source_weight⚠
Returns NaN for an invalid or released handle, so weight == 0 stays distinguishable from “no such source”.
ss_runtime_get_speed_scale⚠
The playback speed in effect, as a multiple of ss_runtime_get_frame_rate.
ss_runtime_get_ssab⚠
The bound resource’s .ssab bytes. Returns false and writes nothing when no resource is bound (NotLoaded).
ss_runtime_get_ssab_buf⚠
The bound resource’s .ssab bytes, or null with NotLoaded when none is bound.
ss_runtime_get_ssab_len⚠
The length of ss_runtime_get_ssab_buf, or 0 with NotLoaded when none is bound.
ss_runtime_get_start_frame⚠
The first frame of the playback range: the section’s when one is set, otherwise the animation’s.
ss_runtime_get_track_alpha⚠
Returns NaN for a track that does not exist, so callers can tell it apart from a valid alpha of 0.
ss_runtime_get_track_blend⚠
Returns SS_RUNTIME_INVALID_HANDLE for a track that does not exist.
ss_runtime_get_track_count⚠
How many tracks exist, silent ones included; at least 1.
ss_runtime_get_track_fade_progress⚠
Progress in [0, 1] of the fade on track; NaN when it is not fading.
ss_runtime_get_track_frame⚠
Returns NaN when the track has no animation on it.
ss_runtime_get_track_frame_rate⚠
The rate the track’s animation plays at; 0 for a track with no animation and no override, -1 for a track that does not exist.
ss_runtime_get_track_loop_count⚠
-1 for a track that loops forever; 0 for a track with no animation.
ss_runtime_get_track_main_source⚠
Handle of the source carrying the track’s animation, so it can be given a weight once the track holds several. SS_RUNTIME_INVALID_HANDLE when the track has no animation.
ss_runtime_get_track_outgoing_event_threshold⚠
NaN for a track that does not exist.
ss_runtime_get_track_playback_direction⚠
0 = forward, 1 = backward; -1 for a track that does not exist.
ss_runtime_get_track_playback_style⚠
0 = normal, 1 = ping-pong; -1 for a track that does not exist.
ss_runtime_get_track_skip_frames⚠
false for a track that does not exist.
ss_runtime_get_track_speed⚠
What ss_runtime_set_track_speed stored (a negative speed reads back as 0.0); NaN for a track that does not exist.
ss_runtime_get_track_sync⚠
Returns SS_RUNTIME_INVALID_HANDLE for a track that does not exist.
ss_runtime_get_unit⚠
0 = pixels, 1 = normalized.
ss_runtime_get_world_matrices⚠
Per-part world matrices for the current frame, written by ss_runtime_get_frame_data: 16 floats per part, indexed by part_index * 16, with the translation at [12] and [13]. The SceneGraph render mode does not compute them.
ss_runtime_hash_string⚠
The FNV-1a hash the converter stores for a name, which the _by_hash calls take. 0 for a null or non-UTF-8 string.
ss_runtime_is_clock_pausing⚠
true while ss_runtime_pause holds a playing clock, after track 0 has finished as well. Implies ss_runtime_is_clock_playing.
ss_runtime_is_clock_playing⚠
true from ss_runtime_play until ss_runtime_stop or the next setup: the character’s clock, which stays true after track 0 finishes while the other tracks and the fades run on. ss_runtime_is_playing reads track 0’s state instead.
ss_runtime_is_finished⚠
Returns true once the configured loops have completed, staying true until the next ss_runtime_play / ss_runtime_setup_animation. Always false under an infinite loop count, and never raised by ss_runtime_stop.
ss_runtime_is_pausing⚠
true while a playing character is held by ss_runtime_pause. Once track 0 has finished this reads false; ss_runtime_is_clock_pausing still reads the hold.
ss_runtime_is_playing⚠
true while the clock runs and track 0 has not finished. A paused character is still playing.
ss_runtime_is_playing_forward⚠
Whether track 0’s playhead is moving forward now. A ping-pong’s return leg reads false, as does a backward animation’s outward leg.
ss_runtime_is_stack_in_motion⚠
true while the track stack would move the pose on a running clock for a reason other than track 0’s own animation stepping: a fade on any track, or another source still playing on a track that is heard. Independent of the clock; read it with ss_runtime_is_clock_playing and ss_runtime_is_clock_pausing.
ss_runtime_is_track_finished⚠
true once the track’s animation has played its loop count out and holds its last frame, as ss_runtime_is_finished is for track 0. false for a track with no animation.
ss_runtime_just_looped⚠
true for the single ss_runtime_update that took playback back to the start of its cycle; the next update clears it. Never raised on the last cycle of a finite loop count, which finishes instead.
ss_runtime_load_ssab_borrow⚠
Create a resource that reads the len bytes at ptr in place and bind it to context, in one call, for a caller that needs no resource handle. Returns false with InvalidParameter for a null ptr, or InvalidVersion for a pack of another schema version.
ss_runtime_load_ssab_copy⚠
Create a resource from a copy of the len bytes at ptr and bind it to context, in one call, for a caller that needs no resource handle. Returns false with InvalidParameter for a null ptr, or InvalidVersion for a pack of another schema version.
ss_runtime_next_frame⚠
Step track 0 one whole frame forward, whatever the direction and style. Does nothing on the range’s last frame.
ss_runtime_pause⚠
Holds playback where it stands, keeping the current frame. With animation mixing it holds every track and every fade, as ss_runtime_stop stops them.
ss_runtime_play⚠
Start track 0 from the start of its range (the end when playing backward), with its loop count re-armed, and start the clock the other tracks and fades run on.
ss_runtime_play_with_start_frame⚠
ss_runtime_play, starting from frame_no. A negative frame_no starts where ss_runtime_play does.
ss_runtime_prev_frame⚠
Step track 0 one whole frame back, whatever the direction and style. Does nothing on the range’s first frame.
ss_runtime_reset⚠
Return a context to its just-created state: the resource is unbound, and the last error, the overrides and the playback and coordinate settings are cleared.
ss_runtime_resume⚠
Lifts a ss_runtime_pause, carrying on from the frame it stopped at.
ss_runtime_set_animation_section⚠
Limits playback to [start_frame, end_frame], both ends included. An end out of the animation’s range (-1, say) is the animation’s edge on that side. Returns false, with InvalidParameter for ss_runtime_get_last_error, when both ends are in range and the end is before the start; the section and the playhead stay as they were.
ss_runtime_set_coordinate_system⚠
0 = Y-up (the default), 1 = Y-down, which flips Y coordinates and rotation. Any other value is Y-up.
ss_runtime_set_frame_no⚠
Seek track 0 to frame, clamped to the playback range. The events of the frames in between do not fire.
ss_runtime_set_frame_rate⚠
Play at frame_rate frames per second instead of the authored rate; 0 or a negative rate clears the override. It survives ss_runtime_setup_animation.
ss_runtime_set_log_callback
Register the function that receives a message for every failure the runtime records, for the whole process. It runs on the thread of the failing call, and message is valid only during it. level is one of SS_RUNTIME_LOG_*.
ss_runtime_set_loop_count⚠
n > 0 plays n cycles and then finishes; 0 or a negative count loops forever. ss_runtime_setup_animation resets it to looping forever, so set it after.
ss_runtime_set_origin⚠
0 = the canvas center (the default), 1 = its top-left corner, which offsets root parts by half the canvas. Any other value is the center.
ss_runtime_set_part_cell_override⚠
Set a per-part cell override, identified by FNV-1a hashes of the cellmap name (without .ssce) and the cell name. (0, 0) reverts to the animation. priority_mode: 0=OverwriteOnNextKeyframe 1=HoldUntilNextAnimation 2= Permanent. Normal + Mask parts only. Fails if the cell cannot be resolved.
ss_runtime_set_part_color_override⚠
Set a per-part color override from a single packed RGBA (0xRRGGBBAA, fills all four corners). blend_op: 0=Mix 1=Mul 2=Add 3=Sub. priority_mode: 0=OverwriteOnNextKeyframe 1=HoldUntilNextAnimation 2=Permanent. Normal parts only.
ss_runtime_set_part_color_override_corners⚠
Set a per-part color override from four packed RGBA corners in ssruntime order lt, rt, lb, rb (rgba_ltrtlbrb points to 4 uint32 = 0xRRGGBBAA).
ss_runtime_set_part_visibility_override⚠
Set or clear a per-part visibility override. force: 0 = clear/revert, 1 = force-hide. Anything else, 2 (reserved for force-visible) included, returns false with InvalidParameter. cascade != 0 propagates a force-hide to descendants.
ss_runtime_set_playback_direction⚠
direction: 0 = forward, otherwise backward. style: 0 = normal, otherwise ping-pong. Call it before ss_runtime_play. It survives ss_runtime_setup_animation.
ss_runtime_set_render_mode⚠
Set the render mode. mode is interpreted as: 0 = Direct (pre-bake world matrices; default) 1 = SceneGraph (skip world matrix pre-computation) Unknown values fall back to Direct.
ss_runtime_set_skip_frames⚠
true (the default) advances by the time elapsed, skipping frames to keep up. false advances one frame at a time, at most one per update.
ss_runtime_set_source_event_threshold⚠
A source fires events once its weight reaches threshold. The default, +inf, keeps every source silent but track 0’s main one, which always fires. Returns false with InvalidParameter for an invalid or released handle.
ss_runtime_set_source_frame⚠
Seek one source. Returns false with InvalidParameter for an invalid or released handle.
ss_runtime_set_source_weight⚠
The proportion of a source within its track; ss_runtime_set_track_alpha is the strength of the track as a whole. Returns false with InvalidParameter for an invalid or released handle.
ss_runtime_set_speed_scale⚠
Playback speed as a multiple of the frame rate. 0.0 stops the playhead while ss_runtime_is_playing stays true, and a negative speed clamps to 0.0; direction is ss_runtime_set_playback_direction’s. It survives ss_runtime_setup_animation.
ss_runtime_set_track_alpha⚠
The strength of track: 0 contributes nothing, 1 all of it, and values above 1 extrapolate. Returns false with InvalidParameter for a NaN or a track that does not exist.
ss_runtime_set_track_animation⚠
Put name on track, replacing what it played and cancelling its fade. Tracks grow on demand. Returns false with NotLoaded, AnimationNotFound (an unknown name, or no ss_runtime_setup_animation yet), or InvalidParameter for a null name.
ss_runtime_set_track_animation_by_hash⚠
ss_runtime_set_track_animation by the hash of the name.
ss_runtime_set_track_blend⚠
blend is one of SS_RUNTIME_TRACK_BLEND_*.
ss_runtime_set_track_frame⚠
Seek the animation on track, which is how an axis authored as an animation is driven. Returns false with InvalidParameter when the track has no animation.
ss_runtime_set_track_frame_rate⚠
The rate in frames per second track plays its animations at; 0 or a negative rate clears it. The track keeps it, as it does its speed.
ss_runtime_set_track_loop_count⚠
How many times the track’s animation plays before it holds its last frame; 0 or a negative count loops forever. It belongs to the animation on the track: laying another one there starts it looping forever again.
ss_runtime_set_track_outgoing_event_threshold⚠
How far into a crossfade on track the outgoing side keeps firing events: it fires while its share of the track, 1 - t, is at least threshold. The default, +inf, keeps it silent from the moment the fade begins.
ss_runtime_set_track_playback_direction⚠
direction: 0 = forward, otherwise backward. style: 0 = normal, otherwise ping-pong; as ss_runtime_set_playback_direction.
ss_runtime_set_track_skip_frames⚠
ss_runtime_set_skip_frames for track. The track keeps it, as it does its speed.
ss_runtime_set_track_speed⚠
The speed of track, as a multiple of each animation’s frame rate. The track keeps it across a crossfade or a new animation. Track 0’s is ss_runtime_set_speed_scale.
ss_runtime_set_track_sync⚠
sync is one of SS_RUNTIME_TRACK_SYNC_*. Set it before laying an animation on the track; a track with nothing on it yet is created for it.
ss_runtime_set_unit⚠
0 = pixels (the default), 1 = normalized, which divides each part’s position by the canvas size. Sizes, local vertices and UVs stay in pixels. Any other value is pixels.
ss_runtime_setup_animation⚠
Select the animation name of the bound resource and move to its first frame. This does not start it; ss_runtime_play does. It drops every track but 0, the section and the loop count, and keeps the speed, the frame rate, the frame skip and the direction. Returns false with NotLoaded, AnimationNotFound, or InvalidParameter for a null name.
ss_runtime_setup_animation_by_hash⚠
ss_runtime_setup_animation by the hash ss_runtime_hash_string gives for the name.
ss_runtime_ssab_schema_version
The .ssab schema version this runtime reads.
ss_runtime_stop⚠
Stop every track and fade where they stand. Nothing rewinds; ss_runtime_play starts them again.
ss_runtime_track_just_looped⚠
true for the update in which the track’s animation wrapped back to its start, as ss_runtime_just_looped is for track 0.
ss_runtime_update⚠
Advance by delta milliseconds and return the frame to pass to ss_runtime_get_frame_data. With animation mixing it advances every track and fade; the frame returned is track 0’s.

Type Aliases§

SsLogCallback