Skip to content

Class: SSRuntimeManager ​

Defined in: ssplayer-core/dist/index.d.ts:2264

Constructors ​

Constructor ​

new SSRuntimeManager(): SSRuntimeManager

Defined in: ssplayer-core/dist/index.d.ts:2317

Returns ​

SSRuntimeManager

Properties ​

context ​

context: SSRuntimeContext

Defined in: ssplayer-core/dist/index.d.ts:2265


onFrameData ​

onFrameData: ((frameData) => boolean) | null

Defined in: ssplayer-core/dist/index.d.ts:2594

Called with every frame getFrameData hands out, before it is handed out: the player builds the draw plans of the effect parts that frame draws. Returns whether it built any, which can grow WASM memory.

Methods ​

bindResource() ​

bindResource(resource): void

Defined in: ssplayer-core/dist/index.d.ts:2318

Parameters ​

resource ​

SSABResource

Returns ​

void


capturePassedEvents() ​

capturePassedEvents(): readonly SSPassedEvent[]

Defined in: ssplayer-core/dist/index.d.ts:2345

The events the last update reported. Take them before any listener runs: setting up an animation clears them in the runtime, and its source handles then name the new animation.

Each one remembers the animation whose source fired it, not the one set up: once a crossfade on track 0 hands the track to another animation, or an overlay is let fire, the index belongs to that animation's table, and reading it from the set-up one reports a different event or none.

Returns ​

readonly SSPassedEvent[]


crossfade() ​

crossfade(track, animationName, durationMs): void

Defined in: ssplayer-core/dist/index.d.ts:2329

Fade track to animationName over durationMs. On track 0 the incoming animation becomes the main one from this call on, so the per-animation reads (getCurrentAnimationData, prepareFrame's guard) follow it here rather than when the fade completes.

Nothing else setupAnimation caches needs redoing: the parts table, and with it the mask flags and the effect parts, belongs to the pack.

Parameters ​

track ​

number

animationName ​

string

durationMs ​

number

Returns ​

void


destroy() ​

destroy(): void

Defined in: ssplayer-core/dist/index.d.ts:2608

Returns ​

void


getAnimationDataByName() ​

getAnimationDataByName(animationName, out?): AnimationData | null

Defined in: ssplayer-core/dist/index.d.ts:2407

SSAB AnimationData for the animation named animationName in the bound pack, set up or not, re-derived from the borrowed buffer like getCurrentAnimationData. null before a resource is bound or for a name the pack does not have.

Parameters ​

animationName ​

string

out? ​

AnimationData

Returns ​

AnimationData | null


getCellmapNames() ​

getCellmapNames(): string[]

Defined in: ssplayer-core/dist/index.d.ts:2416

Cell-map names in the bound SSAB (table order, no .ssce extension) — the cell-override target namespace. Empty before a resource is bound.

Returns ​

string[]


getCellNames() ​

getCellNames(cellmapName): string[]

Defined in: ssplayer-core/dist/index.d.ts:2422

Cell names inside cellmapName in the bound SSAB (empty if that map isn't in this SSAB). Pair with getCellmapNames to discover the valid targets of a cell override.

Parameters ​

cellmapName ​

string

Returns ​

string[]


getCurrentAnimationData() ​

getCurrentAnimationData(out?): AnimationData | null

Defined in: ssplayer-core/dist/index.d.ts:2400

SSAB AnimationData for the currently set-up animation, re-derived from the (borrowed) SSAB buffer on each call so the view stays valid across WASM memory growth. null before setup or if the name didn't resolve. Event polling reads its per-frame events table via events(eventIndex). Pass out to reuse a scratch object and avoid allocation.

Parameters ​

out? ​

AnimationData

Returns ​

AnimationData | null


getEffectParts() ​

getEffectParts(): object[]

Defined in: ssplayer-core/dist/index.d.ts:2353

Returns ​

object[]


getEventsOf() ​

getEventsOf(event): EventsPerFrame | null

Defined in: ssplayer-core/dist/index.d.ts:2352

The per-frame events entry a captured event names, or null once a listener has bound another pack or destroyed the player. Read it before calling the next listener and ask again after: a listener can grow WASM memory, which detaches this view.

Parameters ​

event ​

SSPassedEvent

Returns ​

EventsPerFrame | null


getFrameData() ​

getFrameData(frame): FrameData | null

Defined in: ssplayer-core/dist/index.d.ts:2600

The runtime's frame data for frame, as a zero-copy FlatBuffer view over WASM memory. The returned object is a per-manager scratch re-pointed on every call: don't retain it, and don't hold two at once.

Parameters ​

frame ​

number

Returns ​

FrameData | null


getInstanceParts() ​

getInstanceParts(): object[]

Defined in: ssplayer-core/dist/index.d.ts:2358

Returns ​

object[]


getLastFrameData() ​

getLastFrameData(): FrameData | null

Defined in: ssplayer-core/dist/index.d.ts:2607

The frame data the last evaluation built (prepareFrame, which every draw and InternalPlayerBase.evaluateDrawFrame go through), read without evaluating anything. Null before the first evaluation. A view over WASM memory with a scratch of its own: don't retain it.

Returns ​

FrameData | null


getLocalUVs() ​

getLocalUVs(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2472

Returns ​

Float32Array


getLocalVertices() ​

getLocalVertices(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2471

Returns ​

Float32Array


getMeshIndexOffsets() ​

getMeshIndexOffsets(): Int32Array

Defined in: ssplayer-core/dist/index.d.ts:2478

Returns ​

Int32Array


getMeshIndices() ​

getMeshIndices(): Int32Array

Defined in: ssplayer-core/dist/index.d.ts:2476

Returns ​

Int32Array


getMeshUVs() ​

getMeshUVs(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2475

Returns ​

Float32Array


getMeshVertexOffsets() ​

getMeshVertexOffsets(): Uint32Array

Defined in: ssplayer-core/dist/index.d.ts:2477

Returns ​

Uint32Array


getMeshVerticesX() ​

getMeshVerticesX(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2473

Returns ​

Float32Array


getMeshVerticesY() ​

getMeshVerticesY(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2474

Returns ​

Float32Array


getPartIndexFromName() ​

getPartIndexFromName(partName): number

Defined in: ssplayer-core/dist/index.d.ts:2445

Retrieves the index of a part based on its name.

Parameters ​

partName ​

string

Returns ​

number


getPartMaskFlags() ​

getPartMaskFlags(): Uint8Array<ArrayBufferLike> | null

Defined in: ssplayer-core/dist/index.d.ts:2387

Static per-part mask flags for the current animation (one byte per part index, parallel to the SSAB parts table), or null before setup. Bits: 0x01 visibleInsideMask, 0x02 maskWrite, 0x04 maskInfluence, 0x08 drawAsMask. The renderer reads visibleInsideMask to decide a masked part's clip polarity (show inside vs. outside the mask region); the runtime already encodes per-part mask participation in the draw batches (DrawBatchKind.Mask for contributors, flags & 0x01 for masked content), so this is only needed for the polarity bit.

Returns ​

Uint8Array<ArrayBufferLike> | null


getPartName() ​

getPartName(partIndex): string | null

Defined in: ssplayer-core/dist/index.d.ts:2441

Cached name of the part at partIndex (SSAB parts-table order), or null if out of range / before an animation is set up.

Parameters ​

partIndex ​

number

Returns ​

string | null


getPartNames() ​

getPartNames(): string[]

Defined in: ssplayer-core/dist/index.d.ts:2453

Part names in part-index order, empty before an animation is set up.

A part authored without a name reads as the empty string rather than being skipped, so the list stays index-aligned with the parts table and with the partIndex every event carries.

Returns ​

string[]


getPartsCount() ​

getPartsCount(): number

Defined in: ssplayer-core/dist/index.d.ts:2457

Returns the total number of parts in the current animation.

Returns ​

number


getPartSkinnedFlag() ​

getPartSkinnedFlag(index): boolean

Defined in: ssplayer-core/dist/index.d.ts:2463

Whether the part at index is a skinned (bone-bound) mesh, from the per-animation cache. Out-of-range or before setup reads as false. See InternalPlayerBase.isPartSkinnedMesh for the contract.

Parameters ​

index ​

number

Returns ​

boolean


getReplaceableTextureNames() ​

getReplaceableTextureNames(): string[]

Defined in: ssplayer-core/dist/index.d.ts:2436

Names that InternalPlayerBase.setCellmapTexture can replace at runtime, in table order: every cell-map name (no .ssce extension, e.g. common) followed by every external-texture file name (e.g. common.png). Both are valid replacement targets because DrawBatch.texture_hash is keyed from both namespaces — a cell-map's own name normally, and the texture file name on frames a TextureChange (TCHG) applies. Empty before a resource is bound.

Unlike getCellmapNames (cell-override targets — cell-map names only), this is the texture-replacement discovery list; the two differ whenever the SSAB carries any TCHG targets.

Returns ​

string[]


getShapeVertexBoxCoords() ​

getShapeVertexBoxCoords(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2480

Returns ​

Float32Array


getShapeVertexCounts() ​

getShapeVertexCounts(): Int32Array

Defined in: ssplayer-core/dist/index.d.ts:2479

Returns ​

Int32Array


getShapeVertices() ​

getShapeVertices(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2481

Returns ​

Float32Array


getSounds() ​

getSounds(): SoundAsset[]

Defined in: ssplayer-core/dist/index.d.ts:2411

Get all referenced sound assets (name and path) for the currently loaded SSAB.

Returns ​

SoundAsset[]


getWorldMatrices() ​

getWorldMatrices(): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2470

Returns ​

Float32Array


getWorldMatrix2D() ​

getWorldMatrix2D(partIndex, out?): Float32Array

Defined in: ssplayer-core/dist/index.d.ts:2469

Extract the 2D affine of a part's world matrix as [m00, m01, m10, m11, tx, ty] (copied out of WASM memory, so safe to retain). Used to place an instance-part child under its parent. Pass out to avoid allocation.

Parameters ​

partIndex ​

number

out? ​

Float32Array<ArrayBufferLike>

Returns ​

Float32Array


hasMaskWriterParts() ​

hasMaskWriterParts(): boolean

Defined in: ssplayer-core/dist/index.d.ts:2392

Whether any part of the bound pack can write a mask: mask_write, draw_as_mask or a mask part. False until an animation is set up.

Returns ​

boolean


invalidateFrame() ​

invalidateFrame(): void

Defined in: ssplayer-core/dist/index.d.ts:2588

Have the next prepareFrame evaluate even the frame it evaluated last. For a change made to the runtime other than through context, which notes its own writes.

Returns ​

void


prepareFrame() ​

prepareFrame(frame): number

Defined in: ssplayer-core/dist/index.d.ts:2582

Evaluates frame: builds its frame data and leaves the per-part buffers (world matrices and the rest) on it. Returns the frame data's byte length, or 0 before an animation is set up or when the runtime rejects the frame. Allocates nothing — getFrameData is this plus a view over the bytes, and the effect draw plans of the parts the frame draws.

Parameters ​

frame ​

number

Returns ​

number


setCoordinateSystem() ​

setCoordinateSystem(system): void

Defined in: ssplayer-core/dist/index.d.ts:2574

Parameters ​

system ​

WebCoordinateSystem

Returns ​

void


setTrackAnimation() ​

setTrackAnimation(track, animationName): void

Defined in: ssplayer-core/dist/index.d.ts:2331

Put animationName on track. On track 0 it becomes the main animation, as in crossfade.

Parameters ​

track ​

number

animationName ​

string

Returns ​

void


setupAnimation() ​

setupAnimation(animationName): void

Defined in: ssplayer-core/dist/index.d.ts:2319

Parameters ​

animationName ​

string

Returns ​

void


update() ​

update(deltaMs): number

Defined in: ssplayer-core/dist/index.d.ts:2364

Parameters ​

deltaMs ​

number

Returns ​

number


extractAnimationNames() ​

static extractAnimationNames(ssabBuffer): string[]

Defined in: ssplayer-core/dist/index.d.ts:2535

Parse the SSAB buffer and list its animation names in table order. Engine-agnostic introspection for host UIs (e.g. an animation picker), so consumers don't have to re-implement the FlatBuffer walk.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

string[]


extractCellMapNames() ​

static extractCellMapNames(ssabBuffer): string[]

Defined in: ssplayer-core/dist/index.d.ts:2551

Parse the SSAB buffer and list its cell-map names in table order (without the .ssce extension, as the runtime stores them). These are the names a cell override takes — see extractCellNames for the cells inside one.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

string[]


extractCellNames() ​

static extractCellNames(ssabBuffer, cellmapName): string[]

Defined in: ssplayer-core/dist/index.d.ts:2565

Parse the SSAB buffer and list the cell names in the named cell map (empty if that map isn't in this SSAB). Together with extractCellMapNames this is enough to discover every valid target of a cell override.

Parameters ​

ssabBuffer ​

Uint8Array

cellmapName ​

string

Returns ​

string[]


extractEmbeddedTextures() ​

static extractEmbeddedTextures(ssabBuffer): object[]

Defined in: ssplayer-core/dist/index.d.ts:2510

Parse the SSAB buffer and collect the textures whose raw image bytes are embedded directly in the file (the converter's --embedded mode) instead of shipping as sibling files.

Embedded assets are keyed by the FILE-name hash (fnv1a(image_path) == CellMap.imagePathHash() for a cell-map, fnv1a(name) == nameHash() for an external texture); this joins them back to both tables and returns them under the render-time keys, matching extractTexturePaths. Returns an empty array for external-file (non-embedded) SSABs.

The returned bytes are views over ssabBuffer — the caller must consume them (e.g. decode into a texture) before that buffer is detached/freed.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]


extractInstancePackRefs() ​

static extractInstancePackRefs(ssabBuffer): object[]

Defined in: ssplayer-core/dist/index.d.ts:2526

Parse the SSAB buffer and collect the unique animation packs referenced by PartType::Instance parts (the referenced animation may live in an external pack that the host must load before setup).

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]


extractPackInfo() ​

static extractPackInfo(ssabBuffer): object

Defined in: ssplayer-core/dist/index.d.ts:2517

Read a pack's own name and name-hash from its SSAB buffer.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object

hash ​

hash: number

name ​

name: string | null


extractParts() ​

static extractParts(ssabBuffer): object[]

Defined in: ssplayer-core/dist/index.d.ts:2542

Parse the SSAB buffer and list its parts in table order, each with its type. The names are what the part overrides take; the type is what decides which override applies (colour: normal parts; cell: normal and mask parts), so a host UI can offer only the parts a given override can change.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]


extractReplaceableTextureNames() ​

static extractReplaceableTextureNames(ssabBuffer): string[]

Defined in: ssplayer-core/dist/index.d.ts:2559

Parse the SSAB buffer and list every name a runtime texture replacement can target: cell-map names (table order, no .ssce extension) followed by external-texture file names (the TCHG targets, e.g. common.png). This is the union of the two hash namespaces extractTexturePaths loads, by name; deduplicated by string so a name appearing in both tables lists once.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

string[]


extractSounds() ​

static extractSounds(ssabBuffer): SoundAsset[]

Defined in: ssplayer-core/dist/index.d.ts:2573

Parse the SSAB buffer and list all referenced sound assets (name and path). Useful for preloading audio files via the Web Audio API.

A sound the .ssab embeds also carries its bytes, as a view over ssabBuffer — consume or copy it before that buffer is detached or freed.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

SoundAsset[]


extractTexturePaths() ​

static extractTexturePaths(ssabBuffer): object[]

Defined in: ssplayer-core/dist/index.d.ts:2492

Parse the SSAB buffer and extract the image paths and their name hashes.

Two tables feed this, because DrawBatch.texture_hash is drawn from two namespaces: a cell-map's own name hash for an ordinary part, and a texture FILE-name hash for a part whose drawing applies a texture change (TCHG). The latter live in external_textures, so a player that reads only cellmaps leaves those batches without a texture and drops the part. Both go into one hash-keyed list, exactly as the runtime looks them up.

Parameters ​

ssabBuffer ​

Uint8Array

Returns ​

object[]