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.ssabdata. 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_borrowvariant 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 withss_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_lenpointer 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_syncfor a track that does not exist. No live handle ever equals it. - SS_
RUNTIME_ LOG_ ERROR - Severity passed to
SsLogCallback. The runtime only ever emitsERRORtoday;WARNandINFOare 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_blendtakes andss_runtime_get_track_blendreturns. - SS_
RUNTIME_ TRACK_ SYNC_ FREE - Where the animations laid on a track start: what
ss_runtime_set_track_synctakes andss_runtime_get_track_syncreturns. - 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;
0for 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_loopedre-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) —
stepoperates 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_stepdrove the child at,1.0before the first or for a null slot. Usually the key’sspeed, but while the slot ignores the implicit frame-0 key it keeps the last real key’s, so the event the host resolved says1.0when 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’sspeed. - 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_instanceagainst the parent runtime context) and passes the child runtime context here so that label resolution and frame stepping happen against the right Context. Returnstransitioned == trueon EventInstance edges, having configured the child for the new key without starting it: the caller then callsss_runtime_playon the child (an independent child never advances otherwise). Draw the child atchild_frame_noon that tick too: the slot already put it whereplaysnaps it, and a synced child’s value follows the parent, which reading the frame back afterplaywould lose. - ss_
resource_ ⚠create_ borrow - Create a resource that reads the
lenbytes atptrin place, with no copy. Release it withss_resource_destroy. Returns null for a nullptror a pack of another schema version. - ss_
resource_ ⚠create_ copy - Create a resource from a copy of the
lenbytes atptr, which may be freed on return. Release it withss_resource_destroy. Returns null for a nullptror 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). ReturnsSS_RUNTIME_INVALID_HANDLEon failure. - ss_
runtime_ ⚠add_ track_ source_ by_ hash ss_runtime_add_track_sourceby 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_destroyis safe while they are: the resource lives until the last of them is destroyed, reset or bound to another. A_borrowresource’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
tracktonameoverduration_ms— the same time unit asss_runtime_update’s delta. Atrackthat does not exist yet is created. ReturnsfalsewithInvalidParameterfor aduration_msthat is not positive, aNaNor a nullname, and withAnimationNotFoundfor anamethe pack does not have or beforess_runtime_setup_animation. - ss_
runtime_ ⚠crossfade_ by_ hash ss_runtime_crossfadeby 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
tracktotarget_alphaoverduration_ms, the same time unit asss_runtime_update’s delta. ReturnsfalsewithInvalidParameterfor aduration_msthat is not positive, aNaN, or a track that does not exist. - ss_
runtime_ ⚠find_ part_ index - Resolve a part name to its
part_indexin the current primary animation. Returns-1on null context / null or invalid name / not found. - ss_
runtime_ ⚠get_ active_ effect_ event - Resolve the active
EventEffectforslot_indexon the parent’s currently selected animation, at the current frame. When no real event has fired yet, falls back toInitialEvents.effectfor the slot (withis_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
EventInstanceforslot_indexon 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 bypart_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.-1before 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 toout_dataandout_len. - ss_
runtime_ ⚠get_ frame_ no - The playhead of track 0’s main animation, with its fraction: what
ss_runtime_updatelast 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:
1EmptyData,2InvalidVersion,3AnimationNotFound,4NotLoaded,5InvalidParameter,6MemoryError,7MalformedEffect,99Unknown.0means the last such call succeeded, and so does a nullcontext. - ss_
runtime_ ⚠get_ local_ uvs - Per-part UVs for the current frame, written by
ss_runtime_get_frame_data, matchingss_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 bypart_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 bypart_index * 10. Coordinates are in part-local space withcoordinate_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. ReplacesFrameData::verticesfor renderers that consume pre-resolved SoA buffers. - ss_
runtime_ ⚠get_ loop_ count -1for 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 inss_runtime_get_mesh_indices. Partpoccupies[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 viass_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 byss_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 insidess_runtime_get_mesh_vertices_x/_y. Partpoccupies indices[offsets[p], offsets[p + 1]); non-mesh parts haveoffsets[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_offsetsto slice per-part ranges: partp’s vertices live at indicesoffsets[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 viass_runtime_get_mesh_vertex_offsets. - ss_
runtime_ ⚠get_ nines_ box_ coords - Nine-Slice per-vertex box coordinates, interleaved
[fx, fy, ...]with0at the part’s left / top edge and1at its right / bottom edge. Shares the vertex CSR ofss_runtime_get_nines_vertex_offsets. - ss_
runtime_ ⚠get_ nines_ index_ offsets - CSR-style prefix sum (length =
num_parts + 1) for the triangle indices inss_runtime_get_nines_indices. Partpoccupies[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 woundLT, 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 ofss_runtime_get_nines_vertex_offsets. Divide by the texture size to normalize, the same asss_runtime_get_local_uvs. - ss_
runtime_ ⚠get_ nines_ vertex_ offsets - CSR-style prefix sum (length =
num_parts + 1) over the vertex buffersss_runtime_get_nines_vertices/_uvs/_box_coords. Partpoccupies 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 byss_runtime_get_frame_data. Slice per part withss_runtime_get_nines_vertex_offsets; parts drawn by anotherDrawBatchKindoccupy 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_updatepassed. They stay until the next one,ss_runtime_setup_animation,ss_runtime_bind_resourceorss_runtime_reset. - ss_
runtime_ ⚠get_ passed_ event_ index - Collected event
index, as an index into theevents()of the animation of the source that fired it (ss_runtime_get_passed_event_source_handle);-1out of range. - ss_
runtime_ ⚠get_ passed_ event_ source_ handle - Which source fired the collected event at
index— parallel toss_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,
0once finished;-1for 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 bypart_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 bypart_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 bypart_index * 24. Vertices are in local space, post-pivot, post-coord-system, so a Player just multiplies them by the world matrix. Only the firstss_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 isss_runtime_get_shape_vertex_box_coords. - ss_
runtime_ ⚠get_ skip_ frames - What
ss_runtime_set_skip_framesstored. - ss_
runtime_ ⚠get_ source_ animation_ index - Which animation the source
handleplays, as an index into the ssab’sanimations();-1for a handle that names no source. An event index addresses theevents()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 NaNfor an invalid or released handle.- ss_
runtime_ ⚠get_ source_ frame - The playhead of a source;
NaNfor an invalid or released handle. - ss_
runtime_ ⚠get_ source_ weight - Returns
NaNfor an invalid or released handle, soweight == 0stays 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
.ssabbytes. Returnsfalseand writes nothing when no resource is bound (NotLoaded). - ss_
runtime_ ⚠get_ ssab_ buf - The bound resource’s
.ssabbytes, or null withNotLoadedwhen none is bound. - ss_
runtime_ ⚠get_ ssab_ len - The length of
ss_runtime_get_ssab_buf, or0withNotLoadedwhen 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
NaNfor a track that does not exist, so callers can tell it apart from a validalphaof 0. - ss_
runtime_ ⚠get_ track_ blend - Returns
SS_RUNTIME_INVALID_HANDLEfor 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 ontrack;NaNwhen it is not fading. - ss_
runtime_ ⚠get_ track_ frame - Returns
NaNwhen the track has no animation on it. - ss_
runtime_ ⚠get_ track_ frame_ rate - The rate the track’s animation plays at;
0for a track with no animation and no override,-1for a track that does not exist. - ss_
runtime_ ⚠get_ track_ loop_ count -1for a track that loops forever;0for 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_HANDLEwhen the track has no animation. - ss_
runtime_ ⚠get_ track_ outgoing_ event_ threshold NaNfor a track that does not exist.- ss_
runtime_ ⚠get_ track_ playback_ direction - 0 = forward, 1 = backward;
-1for a track that does not exist. - ss_
runtime_ ⚠get_ track_ playback_ style - 0 = normal, 1 = ping-pong;
-1for a track that does not exist. - ss_
runtime_ ⚠get_ track_ skip_ frames falsefor a track that does not exist.- ss_
runtime_ ⚠get_ track_ speed - What
ss_runtime_set_track_speedstored (a negative speed reads back as0.0);NaNfor a track that does not exist. - ss_
runtime_ ⚠get_ track_ sync - Returns
SS_RUNTIME_INVALID_HANDLEfor 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 bypart_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_hashcalls take.0for a null or non-UTF-8 string. - ss_
runtime_ ⚠is_ clock_ pausing truewhiless_runtime_pauseholds a playing clock, after track 0 has finished as well. Impliesss_runtime_is_clock_playing.- ss_
runtime_ ⚠is_ clock_ playing truefromss_runtime_playuntilss_runtime_stopor the next setup: the character’s clock, which staystrueafter track 0 finishes while the other tracks and the fades run on.ss_runtime_is_playingreads track 0’s state instead.- ss_
runtime_ ⚠is_ finished - Returns
trueonce the configured loops have completed, stayingtrueuntil the nextss_runtime_play/ss_runtime_setup_animation. Alwaysfalseunder an infinite loop count, and never raised byss_runtime_stop. - ss_
runtime_ ⚠is_ pausing truewhile a playing character is held byss_runtime_pause. Once track 0 has finished this readsfalse;ss_runtime_is_clock_pausingstill reads the hold.- ss_
runtime_ ⚠is_ playing truewhile 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 truewhile 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 withss_runtime_is_clock_playingandss_runtime_is_clock_pausing.- ss_
runtime_ ⚠is_ track_ finished trueonce the track’s animation has played its loop count out and holds its last frame, asss_runtime_is_finishedis for track 0.falsefor a track with no animation.- ss_
runtime_ ⚠just_ looped truefor the singless_runtime_updatethat 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
lenbytes atptrin place and bind it tocontext, in one call, for a caller that needs no resource handle. ReturnsfalsewithInvalidParameterfor a nullptr, orInvalidVersionfor a pack of another schema version. - ss_
runtime_ ⚠load_ ssab_ copy - Create a resource from a copy of the
lenbytes atptrand bind it tocontext, in one call, for a caller that needs no resource handle. ReturnsfalsewithInvalidParameterfor a nullptr, orInvalidVersionfor 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_stopstops 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 fromframe_no. A negativeframe_nostarts wheress_runtime_playdoes.- 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. Returnsfalse, withInvalidParameterforss_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_rateframes per second instead of the authored rate;0or a negative rate clears the override. It survivesss_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
messageis valid only during it.levelis one ofSS_RUNTIME_LOG_*. - ss_
runtime_ ⚠set_ loop_ count n > 0plays n cycles and then finishes;0or a negative count loops forever.ss_runtime_setup_animationresets 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_ltrtlbrbpoints to 4uint32=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, returnsfalsewithInvalidParameter.cascade != 0propagates a force-hide to descendants. - ss_
runtime_ ⚠set_ playback_ direction direction: 0 = forward, otherwise backward.style: 0 = normal, otherwise ping-pong. Call it beforess_runtime_play. It survivesss_runtime_setup_animation.- ss_
runtime_ ⚠set_ render_ mode - Set the render mode.
modeis 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.falseadvances 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. ReturnsfalsewithInvalidParameterfor an invalid or released handle. - ss_
runtime_ ⚠set_ source_ frame - Seek one source. Returns
falsewithInvalidParameterfor an invalid or released handle. - ss_
runtime_ ⚠set_ source_ weight - The proportion of a source within its track;
ss_runtime_set_track_alphais the strength of the track as a whole. ReturnsfalsewithInvalidParameterfor an invalid or released handle. - ss_
runtime_ ⚠set_ speed_ scale - Playback speed as a multiple of the frame rate.
0.0stops the playhead whiless_runtime_is_playingstaystrue, and a negative speed clamps to0.0; direction isss_runtime_set_playback_direction’s. It survivesss_runtime_setup_animation. - ss_
runtime_ ⚠set_ track_ alpha - The strength of
track:0contributes nothing,1all of it, and values above1extrapolate. ReturnsfalsewithInvalidParameterfor aNaNor a track that does not exist. - ss_
runtime_ ⚠set_ track_ animation - Put
nameontrack, replacing what it played and cancelling its fade. Tracks grow on demand. ReturnsfalsewithNotLoaded,AnimationNotFound(an unknown name, or noss_runtime_setup_animationyet), orInvalidParameterfor a nullname. - ss_
runtime_ ⚠set_ track_ animation_ by_ hash ss_runtime_set_track_animationby the hash of the name.- ss_
runtime_ ⚠set_ track_ blend blendis one ofSS_RUNTIME_TRACK_BLEND_*.- ss_
runtime_ ⚠set_ track_ frame - Seek the animation on
track, which is how an axis authored as an animation is driven. ReturnsfalsewithInvalidParameterwhen the track has no animation. - ss_
runtime_ ⚠set_ track_ frame_ rate - The rate in frames per second
trackplays its animations at;0or 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;
0or 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
trackthe outgoing side keeps firing events: it fires while its share of the track,1 - t, is at leastthreshold. 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; asss_runtime_set_playback_direction.- ss_
runtime_ ⚠set_ track_ skip_ frames ss_runtime_set_skip_framesfortrack. 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 isss_runtime_set_speed_scale. - ss_
runtime_ ⚠set_ track_ sync syncis one ofSS_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
nameof the bound resource and move to its first frame. This does not start it;ss_runtime_playdoes. 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. ReturnsfalsewithNotLoaded,AnimationNotFound, orInvalidParameterfor a nullname. - ss_
runtime_ ⚠setup_ animation_ by_ hash ss_runtime_setup_animationby the hashss_runtime_hash_stringgives for the name.- ss_
runtime_ ssab_ schema_ version - The
.ssabschema version this runtime reads. - ss_
runtime_ ⚠stop - Stop every track and fade where they stand. Nothing rewinds;
ss_runtime_playstarts them again. - ss_
runtime_ ⚠track_ just_ looped truefor the update in which the track’s animation wrapped back to its start, asss_runtime_just_loopedis for track 0.- ss_
runtime_ ⚠update - Advance by
deltamilliseconds and return the frame to pass toss_runtime_get_frame_data. With animation mixing it advances every track and fade; the frame returned is track 0’s.