Bindings: Python¶
473 public names in bindings/python/sona/__init__.py, bindings/python/sona/editor.py, bindings/python/sona/track.py.
Functions¶
| Declaration | What it does |
|---|---|
result_name(code) |
The name of a code ("licence", "gate",...): the same words as the web SDK's SonaError.code. Calls sona_result_name. |
version() |
The library's version, "1.1.0". Calls sona_version. |
platform() |
The binary platform id: "linux-x64", "windows-x64", Calls sona_platform. |
check_layout()check_layout(lib) |
The number of struct sizes and field offsets checked against the library (done once at import). Calls sona_editor_struct_size, sona_editor_struct_offset, sona_track_struct_size, sona_track_struct_offset. |
skeleton_bone(skeleton, joint) |
The bone a joint is in a skeleton ("unity", "vrm", "vrm0", "ue4", "ue5"); None when it has none. Calls sona_skeleton_bone. |
skeleton_joint(skeleton, bone) |
The joint a bone of that skeleton is; -1 when none. Calls sona_skeleton_joint. |
vrm_expression_name(expression) |
The VRM 1.0 preset name of a sona_vrm_expression ("aa"... Calls sona_vrm_expression_name. |
joint_find(name) |
A joint by name: "Hips", "Head", "PropRight", "shape_04", "joint_33". Calls sona_joint_find. |
joint_name(joint) |
None past the last joint. Calls sona_joint_name. |
lod_defaults() |
The level-of-detail defaults, with sprites on at 48 px. Calls sona_lod_defaults. |
placeholder_defaults() |
size set; delay_seconds 0 (never a hole), appear_seconds 0.2, reveal_seconds 0.4, failed_seconds 2, tint 0.16, 0.19, 0.25 (a cool grey), failed_tint 0.25, 0.15, 0.15 (a muted red), glow 0.5. Calls sona_placeholder_defaults. |
preview_defaults() |
Fills the defaults above. Calls sona_preview_defaults. |
pixel_defaults() |
size set, height 32, colours 16, flags SONA_PIXEL_OUTLINE, outline 0 (from the palette), alpha_cut 0.5, no palette. Calls sona_pixel_defaults. |
sticker_defaults() |
size set, pixels 512, time -1, framing SONA_PRESET_FULL, outline_px 10, outline 0xffffffff, shadow 0x59000000 (off while shadow_px is 0), padding 8. Calls sona_sticker_defaults. |
sheet_defaults() |
size set, 8 frames, 8 directions, px_per_metre 64, padding 2, max_page 4096, draw_flags SONA_DRAW_NO_BLOOM; every other field 0 (the whole clip, facing the camera first, side on, orthographic, packed and trim Calls sona_sheet_defaults. |
lighting_defaults() |
sona_lighting_defaults: a key and fill switched off, the built-in environment, a fitted shadow map. Calls sona_lighting_defaults. |
environment_irradiance(sh9) |
The irradiance the lit shader evaluates for 9 RGB SH coefficients of radiance (27 floats). Calls sona_environment_defaults, sona_environment_irradiance. |
style_defaults(kind="original", outline=False, override=False, **fields) |
A sona_style: the defaults, then kind, the OUTLINE and OVERRIDE flags and fields (bands, shade, highlight, outline_px, outline_colour, colour). Calls sona_style_defaults. |
quality_defaults() |
The web SDK's renderer quality: SONA_MSAA_AUTO with MIPS | CUTOUT_MIPS. Calls sona_quality_defaults. |
section_name(section) |
"shirt", "facialHair", Calls sona_catalogue_section_name. |
stock_clip(clip) |
A stock clip by name ("wave"), asset id, legacy key ("GenericWave") or id; None when there is none. Calls sona_stock_clip_get. |
stock_clips(tags=(), without=(), body=0) |
Every stock clip with all of tags and none of without that suits body (0 any, 1 male, 2 female), by id. Calls sona_stock_clips_tagged. |
stock_clip_for_body(clip, body) |
The clip of this one's family made for body (1 male, 2 female). Calls sona_stock_clip_for_body. |
clip_tag_name(bit) |
The name of one tag bit ("idle", "travel",...); NULL for 0, several bits or an unknown bit. Calls sona_clip_tag_name. |
idle_defaults() |
size set, parts SONA_IDLE_ALL, seed 0, amount 1, face_px 240. Calls sona_idle_defaults. |
idle_sample(seconds, seed, parts=None) |
The idle's channels at seconds for a seed, before amount: IdleState(blink, gaze, shift, breath). Calls sona_idle_sample. |
clear_filter(ctx) |
The ctx's filter: a copy of f (NULL takes it away), applied to an avatar when its manifest is read, whoever's it is (sona_avatar_add, headless renders); an avatar read before the change keeps what it wore until it is r Calls sona_ctx_set_filter. |
filter_report(avatar) |
What the ctx's filter changed on an avatar, or None before its manifest is read or when no filter was set. Calls sona_avatar_filter_report. |
view_defaults() |
The web's full-body framing, as a sona_view (fields eye, target, fov_deg, near_z, far_z, width, height). Calls sona_view_defaults. |
camera_orbit(view, target, yaw_deg, pitch_deg, distance) |
Places the eye on an orbit around target. Calls sona_camera_orbit. |
view_matrices(view) |
(view, projection) as 16 floats each, row-vector, D3D depth 0..1. Calls sona_view_matrices. |
guid_parse(text) |
Parses the 36-character text form. Calls sona_guid_parse. |
guid_format(g) |
The id in its lowercase 36-character form. Calls sona_guid_format. |
slot_of(g) |
(route, mask): route "rejected", "worn", "bare" or "face". Calls sona_slot_of. |
base64_decode(text) |
The bytes the base64 text holds. Calls sona_base64_decode. |
import_formats() |
The formats this build reads: a set of "gltf", "fbx", "bvh". Calls sona_import_formats. |
shader_source(lang, prog, stage) |
Text or SPIR-V bytes for one program and stage (0 vertex, 1 fragment); None when not in this build. Calls sona_shader_source. |
mask_preset(name) |
72 weights: "none", "full", "upper_body", "lower_body", "head", "left_arm", "right_arm" or "arms". Calls sona_mask_preset. |
mask_branch(mask, joint, weight) |
A copy of mask with joint and every joint below it set to weight. Calls sona_mask_branch. |
phoneme_mouth(symbol) |
The mouth for a phoneme symbol (ARPAbet, IPA, viseme names or ids); None when it is none of them. Calls sona_phoneme_mouth. |
lipsync_phonemes(phonemes) |
(symbol, start, end) tuples to (time, mouth, open) keys. Calls sona_lipsync_phonemes. |
lipsync_text(text, samples=None, sample_rate=48000, s16=False) |
Text to (time, mouth, open) keys, aligned to mono audio when given, else at an even pace. Calls sona_lipsync_text. |
mouth_keys_sample(keys, t) |
(mouth, open) at time t of (time, mouth, open) keys. Calls sona_mouth_keys_sample. |
headless_devices(backend=None) |
Every device a headless renderer can open: dicts of backend, software, type, vendor_id, device_id, name, driver. Calls sona_headless_devices. |
render_defaults() |
256 x 256, SONA_PRESET_FULL, zoom 1, transparent, no clip. Calls sona_render_defaults. |
sequence_defaults() |
The sequence options as sona_sequence_defaults sets them: frames 0 (the clip's length), the default frame rate, no turn. Calls sona_sequence_defaults. |
video_defaults() |
The defaults are format from the path, a frame rate of 30 fps, opaque black background, every other field 0. Calls sona_video_defaults. |
video_formats(ffmpeg=None) |
The formats this machine can write: a subset of {"png", "gif", "mp4", "webm"}. Calls sona_video_formats. |
players_placeholder() |
The built-in placeholder look: 1000 bytes. Calls sona_players_placeholder. |
outfit_check(manifest, maker=None) |
(report dict, OutfitIssue): every issue of a manifest; without a maker the catalogue's checks are left out. Calls sona_outfit_check. |
outfit_fix(manifest, maker=None) |
(fixed manifest bytes, report dict after): every error but no_body mended. Calls sona_outfit_fix. |
outfit_clash(a, b, maker=None) |
(SONA_CLASH_* bits, shared slots) by the ids alone, or with a maker by the catalogue too. Calls sona_outfit_clash. |
state_info(blob) |
What a saved state holds, without a context: (info dict, manifest bytes or None). Calls sona_state_info_get. |
region_name(region) |
"none", "head", "neck", "torso", "hips", "leftArm", "rightArm", "leftHand", "rightHand", "leftLeg", "rightLeg", "leftFoot", "rightFoot"; NULL past the last. Calls sona_region_name. |
view_ray(view, x, y) |
The ray through (x, y) of the view's picture, pixels from its top left: (origin, unit direction). Calls sona_view_ray. |
pick_ray(ctx, origin, direction, flags=0, max_distance=0.0, ignore=()) |
The nearest hit along the ray, or None. Calls sona_pick_ray. |
pick_screen(ctx, view, x, y, flags=0, max_distance=0.0, ignore=()) |
The nearest hit under (x, y) of the view's picture, or None. Calls sona_pick_screen. |
pick_ray_all(ctx, origin, direction, cap=64, flags=0, max_distance=0.0, ignore=()) |
Every avatar the ray hits, its nearest hit each, nearest first (at most cap). Calls sona_pick_ray_all. |
avatar_pick(avatar, origin, direction, flags=0, max_distance=0.0) |
The ray against one avatar alone, or None. Calls sona_avatar_pick. |
pick_gpu(ctx, renderer, view, x, y, flags=0, max_distance=0.0, ignore=()) |
The pick through the id buffer of a renderer (a Headless, or a raw sona_renderer pointer), or None. Calls sona_pick_gpu. |
pick_gpu_ids(ctx, renderer, view, x, y, w, h, flags=0) |
The id buffer of a region of the view's picture: (avatar ids, mesh index + 1) as arrays of w * h, row 0 on top. Calls sona_pick_gpu_ids. |
prop_options(joint="auto", position=(0, 0, 0), rotation=(0, 0, 0, 1), scale=1.0, hidden=False, play=False, once=False, perform=False, body_scale=True, hand=None, hand_position=(0, 0, 0), hand_rotation=None, hand_pole=None, wrist=False, hand_weight=1.0, fade=0.2, speed=1.0, start=0.0) |
A sona_prop_attach. Calls sona_prop_attach_defaults. |
prop_pets() |
The catalogue's pets (the site's pet mode list), as item ids. Calls sona_prop_pet_count, sona_prop_pet. |
prop_is_pet(item_id) |
1 when the item id is one of the pets. Calls sona_prop_is_pet. |
abi() |
The loaded library's ABI: abi, oldest_abi (the oldest a caller may be built against), major, minor, patch. Calls sona_abi_query. |
emote_from_text(text) |
A sentence to stock clips and a face: dict of clips (SONA_STOCK_* id, weight), speed, confidence, expression (5 parts, 255 leaves one to the clip), and the raw struct for Avatar.emote. Calls sona_emote_from_text. |
tier_defaults() |
size set; target_fps 60, avatars 20. Calls sona_tier_defaults. |
load_library() |
Loads the sona library from SONA_LIB_DIR, then the system's library path. |
theme(which="dark", **overrides) |
A theme struct: "dark" or "light", then any field overridden (colours as 0xAARRGGBB). Calls sona_editor_theme_defaults. |
N_error(r) |
Raises SonaError for a failed sona_result of the editor module. |
blendshape_name(i) |
The name of blendshape index ("eyeBlinkLeft", Calls sona_track_blendshape_name. |
blendshape_find(name) |
The index of a blendshape by name; -1 when unknown. Calls sona_track_blendshape_find. |
quat_from_matrix(rows) |
A 3x3 (or the upper left of a 4x4) as rows of floats to (x, y, z, w). Calls sona_track_quat_from_matrix. |
quat_from_euler(pitch_deg, yaw_deg, roll_deg) |
Degrees, right-handed about the camera axes: pitch about +X (nodding down is positive), yaw about +Y (turning towards the image's right, the subject's own left, is positive), roll about +Z; applied roll, then pitch, then Calls sona_track_quat_from_euler. |
SonaError¶
class SonaError(Exception): code: the sona_result (negative); name: its word ("licence", "gate",...); message; fix.
| Declaration | What it does |
|---|---|
__init__(code, message="", fix="") |
Made by the binding when a call returns one; not made by hand. |
Request¶
class Request: One read in flight.
| Declaration | What it does |
|---|---|
__init__(raw) |
Made by the binding when a call returns one; not made by hand. |
id() |
The read's id, as the source was given it. |
finish(status, data=b"") |
Finishes one read, exactly once, also after cancel; the request stays valid until then. Calls sona_complete. |
complete(data) |
Finishes one read, exactly once, also after cancel; the request stays valid until then. |
not_found() |
Answers the read: the source has no such file (SONA_E_NOT_FOUND). |
failed() |
Answers the read: the source failed and a retry may work (SONA_E_IO). |
FrameStats¶
class FrameStats: The C type sona_frame_stats.
| Declaration | What it does |
|---|---|
__init__(s) |
Made by the binding when a call returns one; not made by hand. |
SceneStats¶
class SceneStats: The C type sona_scene_stats.
| Declaration | What it does |
|---|---|
__init__(s) |
Made by the binding when a call returns one; not made by hand. |
Event¶
class Event: The C type sona_event.
| Declaration | What it does |
|---|---|
__init__(e, avatar) |
Made by the binding when a call returns one; not made by hand. |
Context¶
class Context: sona.Context(app_id=None, licence=path_or_bytes, sources=("dir", path),...).
| Declaration | What it does |
|---|---|
__init__(app_id=None, licence=None, sources=(), worker_threads=None, seed=None, max_avatars=None, build_budget_ms=None, face_size=None, flags=0, budget=None, check_host=None, log=None) |
Made by the binding when a call returns one; not made by hand. Calls sona_config_defaults, sona_open. |
close() |
Closes a context. Calls sona_close. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
app_id() |
The app id this context runs as. Calls sona_app_id. |
add(manifest, clip=None, **opts) |
Queues an avatar from its 1000 manifest bytes. Calls sona_avatar_add. |
add_base64(text, clip=None, **opts) |
The same, from base64 text of at most 4096 characters, as the web. Calls sona_avatar_add_base64. |
add_state(blob, **opts) |
A new avatar with a saved state's look and state. Calls sona_avatar_add_state. |
add_waiting(clip=None, **opts) |
An avatar whose manifest is not known: QUEUED, a neutral figure while placeholders are on, until Avatar. Calls sona_avatar_add_waiting. |
update(dt, view=None) |
Advances every avatar by dt seconds, builds, culls and poses. Calls sona_update. |
events() |
Every waiting event, oldest first. Calls sona_poll_event. |
clips() |
How many clips the context knows. Calls sona_clip_count, sona_clip_get. |
stats() |
The scene statistics. Calls sona_stats. |
shading() |
The fixed shading inputs, or None until the data files load (update and ask again). Calls sona_shading_get. |
credit(scale=1) |
{"text", "url", "width", "height", "rgba"}: the badge, copied. Calls sona_credit_get. |
png_encode(rgba, width, height) |
PNG bytes with the web's three tEXt chunks. Calls sona_png_encode, sona_free. |
fit_crowd(view) |
Fits every ready avatar in view (the web's preset "crowd"). Calls sona_camera_fit_crowd. |
add_item_preview(item_id, gender=0, slot=0, play=False, colours=None, skin=0, priority=0, time=None, margin=None) |
One item worn alone on a grey stand-in body, framed by its slot. Calls sona_item_preview_add. |
import_clip(anim, key=None, take=None, flags=0, fps=0.0, start=0.0, end=0.0, root_scale=0.0, bone_map=None, tries=600) |
Retargets a take of an AnimFile onto the rig and keeps it here under key (default: the take's name), so avatar. Calls sona_clip_import. |
imported_clips() |
How many clips have been imported into the ctx. Calls sona_clip_imported_count, sona_clip_imported_get. |
remove_imported_clip(key) |
Avatars playing it finish with their own reference; new plays of the key fail with SONA_E_ARGUMENT. Calls sona_clip_imported_remove. |
sway_world(gravity=(0, -9.81, 0), wind=(0, 0, 0), gust=0.35, gust_seconds=1.5) |
The gravity and wind every swaying avatar of this ctx feels. Calls sona_sway_world_defaults, sona_sway_world_set. |
set_lod(options=None, **fields) |
Crowd LOD and sprites from the next update. Calls sona_lod_set. |
lod() |
The LOD options in use, as a sona_lod_options. Calls sona_lod_get. |
lod_stats() |
The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw. Calls sona_lod_stats_get. |
set_placeholders(options=None, **fields) |
Loading avatars show a neutral figure until READY (off on a new ctx). Calls sona_placeholder_set. |
placeholders() |
The options in use, as a sona_placeholder_options; None while placeholders are off. Calls sona_placeholder_get. |
placeholders_off() |
Figures shown now fade out over appear_seconds. Calls sona_placeholder_off. |
placeholder_stats() |
Figures in view at the last sona_update (by phase, and how many as sprites), how many were posed and the time that took, and the figure draws of the last sona_draw or sona_snapshot. Calls sona_placeholder_stats_get. |
param_id(name) |
The id of a parameter name, numbered from 0 in the order first asked for; -1 for a bad name or past 32. Calls sona_param_id. |
prop_mesh(parts) |
A prop mesh from triangles. Calls sona_prop_part_defaults, sona_prop_mesh_create. |
prop_mesh_load(data=None, path=None, scale=1.0, center=False, textures=True, scene=-1) |
A glTF 2.0 file as a prop mesh, from bytes (data) or a path. Calls sona_prop_load_defaults, sona_prop_mesh_open, sona_prop_mesh_load. |
prop_mesh_stock(item_id) |
A stock prop item (a carryable) of the catalogue; its state is "pending" until it has loaded. Calls sona_prop_mesh_stock. |
interaction_layout(kind, a, b=None, **opts) |
Where an interaction would stand its avatars and where the contacts meet, as a dict; None while the avatars (or the stock sit clip) are still loading. Calls sona_interaction_layout. |
interaction(kind, a, b=None, **opts) |
Starts one: kind "hold_hands", "high_five", "handshake", "hug" or "sit" (b may be None). Calls sona_interaction_start. |
blend_space(param_x, samples, param_y=None, unsynced=False, smooth_seconds=0.1) |
samples: (clip, x) or (clip, x, y) or (clip, x, y, speed). Calls sona_blend_space_defaults, sona_blend_space_create. |
state_machine(states, transitions=(), initial=None) |
states: dicts with name, clip or blend (a BlendSpace), loop (default True), speed. Calls sona_state_machine_defaults, sona_state_machine_create. |
pixel_art(rgba, width, height, size=32, colours=16, outline=True, thin=False, dither=False, keep_frame=False, outline_colour=0, alpha_cut=0.5, palette=None) |
Crisp pixel art from a straight RGBA8 picture, size pixels tall: (rgba bytes, width, height). Calls sona_pixel_art, sona_free. |
pixel_palette(pictures, colours=16) |
One palette (0xFFRRGGBB, darkest first) for several (rgba, width, height) pictures. Calls sona_pixel_palette. |
Interaction¶
class Interaction: A running interaction (Context.interaction).
| Declaration | What it does |
|---|---|
__init__(ctx, raw) |
Made by the binding when a call returns one; not made by hand. |
end() |
Begins the end phase: letting go, standing up. Calls sona_interaction_end. |
move(position, turn_deg) |
Moves the place (or the seat) while it runs. Calls sona_interaction_move. |
status() |
Where an interaction is: its kind and phase, the time in the phase and how far through it, whether the contacts are together, the widest gap at a contact, the clearance between the two bodies (negative: into each other), Calls sona_interaction_status_get. |
events() |
(kind, phase, time, value) since the last call; kind "start", "contact", "hold", "shake", "release", "end" or "cancel". Calls sona_interaction_events. |
remove() |
Stops at once and frees it: its IK targets go, the avatars stay where they are and keep their clip. Calls sona_interaction_remove. |
Avatar¶
class Avatar: One avatar.
| Declaration | What it does |
|---|---|
__init__(ctx, raw) |
Made by the binding when a call returns one; not made by hand. |
id() |
A number unique within the ctx. Calls sona_avatar_id. |
state() |
"queued", "loading", "ready", "failed" or "removed". Calls sona_avatar_state_of. |
ready() |
True once the avatar is built and drawn (sona_avatar_state is READY). |
settled() |
True once the avatar is READY or FAILED: nothing more will load for it. |
play(clip, loop=True, speed=1.0, start=0.0) |
Plays a clip. Calls sona_avatar_play. |
stop() |
Holds the current pose. Calls sona_avatar_stop. |
move(position=(0, 0, 0), turn_deg=0.0, scale=1.0, over_seconds=0.0) |
Moves the avatar to a new placement over over_seconds. Calls sona_avatar_move. |
set_visible(visible) |
Shows or hides it. Calls sona_avatar_set_visible. |
bounds() |
(centre, radius) Calls sona_avatar_bounds. |
export(format="vrm", bone_names="unity", name=None, authors=None, licence_url=None, flags=0, thumbnail_png=None) |
The avatar as a.vrm (format "vrm" or "vrm0") or "glb" file: (bytes, report dict). Calls sona_export_defaults, sona_export_avatar, sona_free. |
save_state(look=True) |
The whole state as a blob (bytes); None before READY. Calls sona_avatar_save_state, sona_free. |
load_state(blob) |
Puts a saved state on at the next update(s), once READY and its clips are loaded. Calls sona_avatar_load_state. |
puppet(on=True) |
A puppet's clocks stand still: its clip, layers, fades, moves, IK smoothing and idle change only when a state is put on it. Calls sona_avatar_puppet. |
state_status() |
{"mode": "live" | "waiting" | "puppet", "pending", "missing", "applied"} Calls sona_avatar_state_status. |
remove() |
Removes the avatar and frees what only it used. Calls sona_avatar_remove. |
pose() |
The pose as of the last update; SonaError "not_ready" before READY. Calls sona_pose. |
pose_vertices(mesh, space="avatar", normals=False, stride=3) |
CPU skinning of one mesh: (positions, normals or None) as array('f') of vertex_count * stride. Calls sona_pose_vertices. |
camera_preset(preset, view=None) |
Sets the view's eye and target to "full", "upper", "bust" or "face" on this ready avatar. Calls sona_camera_preset. |
joint_world(joint) |
A joint's world matrix (16 floats, row-vector, metres, placement applied) at the last update. Calls sona_joint_world. |
override(joint, rotation, weight=1.0, mode="replace") |
A unit quaternion (x, y, z, w) after the clip: "replace" from the rest orientation, "add" on top of the clip's. Calls sona_avatar_override. |
clear_overrides() |
Clears every override of the avatar. Calls sona_avatar_clear_overrides. |
crossfade(clip, seconds, loop=True, speed=1.0, start=0.0) |
play, blending from the current pose over seconds (0: a cut). Calls sona_avatar_crossfade. |
queue(clip, fade=0.0, loop=True, speed=1.0, start=0.0) |
Plays clip when the current one ends. Calls sona_avatar_queue. |
queued() |
How many clips are waiting in the queue. Calls sona_avatar_queued. |
ik_target(limb, position=None, rotation=None, pole=None, joint=None, space="world", wrist=False, weight=1.0, fade=0.2) |
A hand or foot target. Calls sona_avatar_ik_target, sona_ik_target_defaults. |
ik_feet(ground="plane", plane=(0, 1, 0, 0), query=None, weight=1.0, max_hips_offset=0.45, max_tilt_deg=35, smoothing=0.1) |
Foot planting. Calls sona_avatar_ik_feet, sona_ik_feet_defaults. |
ik_ground(foot, point=None, normal=(0, 1, 0)) |
POINTS: the ground under "left_foot" or "right_foot" (or 2, 3); point None: no ground there. Calls sona_avatar_ik_ground. |
ik_look(target=None, head=True, eyes=True, weight=1.0, **limits) |
Look at a world point; target None eases back to the clip. Calls sona_avatar_ik_look, sona_ik_look_defaults. |
style() |
The avatar's own art style (sona_style; the defaults when it has none). Calls sona_avatar_style. |
set_style(kind=None, outline=False, **fields) |
Its own art style: kind "original", "toon", "flat", "silhouette" or "promo" (None: none, the renderer's applies); outline draws an outline; fields: bands, shade, highlight, outline_px, outline_colour, colour (0xAARRGGBB) Calls sona_avatar_set_style. |
ik_limits(body=True, **fields) |
Joint limits (elbow_max_deg, knee_max_deg, wrist_swing_deg, Calls sona_ik_limits_defaults, sona_avatar_ik_limits. |
ik_clear() |
Every target, the planting and the look-at off at once. Calls sona_avatar_ik_clear. |
set_placeholder(mode) |
Its loading placeholder: -1 follows the ctx, 0 never, 1 always. Calls sona_avatar_placeholder. |
placeholder() |
Its loading placeholder now, as a dict: phase, opacity, height, gender, clip, seconds, sprite. Calls sona_avatar_placeholder_info. |
set_manifest(manifest) |
The manifest of an avatar added with Context. Calls sona_avatar_set_manifest_base64, sona_avatar_set_manifest. |
ik_status() |
What the last pose did, as a dict; None before the avatar was posed with IK on. Calls sona_avatar_ik_status. |
prop_attach(mesh, **opts) |
Attaches a PropMesh; returns its id on this avatar. Calls sona_avatar_prop_attach. |
prop_set(prop_id, **opts) |
New placement, flags or hand for an attached prop (each frame for one that moves on the joint). Calls sona_avatar_prop_set. |
prop_swap(prop_id, mesh) |
Another mesh in the same place: a sword for a stick, an item for a placeholder. Calls sona_avatar_prop_swap. |
prop_detach(prop_id) |
Takes the prop off at once (its hand's IK target eases off). Calls sona_avatar_prop_detach. |
prop_detach_all() |
Takes every prop off the avatar at once. Calls sona_avatar_prop_detach_all. |
props() |
The ids of the avatar's props, in attach order. Calls sona_avatar_prop_list. |
prop_frame(prop_id) |
dict: flags ("posed", "ready", "drawn"), joint, time, world and avatar (16 floats, row-vector), hand_error, joints, palette (joints * 12 floats, avatar space). Calls sona_avatar_prop_frame. |
ragdoll(all_capsules=False, rest_pose=False, total_mass=0.0, coverage=0.9, limits=None) |
The 16 bodies fitted to this avatar now, as dicts: joint, parent, shape, colliders, mass and the joint to the parent (frames and limits). Calls sona_ragdoll_defaults, sona_ik_limits_defaults, sona_avatar_ragdoll. |
ragdoll_state() |
The bodies at the last pose: position, rotation, velocity and angular_velocity tuples; None before ragdoll. Calls sona_avatar_ragdoll_state. |
ragdoll_drive(bodies, weight=1.0, keep_lengths=False) |
The host's bodies onto the avatar: 16 (position, rotation) pairs or ragdoll_state dicts; None stops. Calls sona_avatar_ragdoll_drive. |
ragdoll_release(blend_seconds=0.5) |
Back to the animation: the last drawn ragdoll pose stays where it is in the world and blends into the clip's pose over blend_seconds (smoothstep; 0: at once), turn by turn down the body, so limbs stay joined. Calls sona_avatar_ragdoll_release. |
ragdoll_info() |
mode, weight, blend_left, face_up, hips, lowest, getup_position, getup_turn_deg; None before a pose. Calls sona_avatar_ragdoll_info. |
ragdoll_clear() |
Off at once: no tracking, no drive, no blend. Calls sona_avatar_ragdoll_clear. |
sway(on=True, parts=None, quality="medium", **fields) |
Hair and cloth sway. Calls sona_avatar_sway, sona_sway_defaults. |
sway_reset() |
Back to the modelled shape, at rest, at the next pose. Calls sona_avatar_sway_reset. |
sway_info() |
What sways on this avatar and what the last pose did, as a dict; None before READY. Calls sona_avatar_sway_info. |
sway_mesh_parts(mesh) |
The SONA_SWAY_* kinds one of sona_pose's meshes sways with; 0 for one that does not, a bad index, or an avatar with sway off or not READY. Calls sona_avatar_sway_mesh_parts. |
capsule() |
(a, b, radius): a vertical capsule around the posed body, in world space. Calls sona_avatar_capsule. |
expression(values) |
mouth, left eyebrow, right eyebrow, left eye, right eye: shape indexes, None (or 255) for the clip's. Calls sona_avatar_expression. |
mouth(shape) |
Only the mouth: a SONA_MOUTH_* or shape index, or None (255) to hand it back to the clip. Calls sona_avatar_mouth. |
voice(state, level, dt) |
Voice chat: a VoiceMouth state for this speaker, its audio level (linear RMS) and the time step. Calls sona_avatar_voice. |
expression_counts() |
(mouths, eyebrows, eyes): how many shapes this face has. Calls sona_avatar_expression_counts. |
clip_events() |
Every clip event since the last call, oldest first. Calls sona_avatar_clip_events. |
mark(seconds, mark_id) |
A "mark" clip event with this id each time the current clip passes seconds. Calls sona_avatar_mark. |
clear_marks() |
Removes the avatar's marks. Calls sona_avatar_clear_marks. |
root_motion(mode) |
"off", "extract" (collect the travel for take_root_motion) or "apply" (move the placement by it). Calls sona_avatar_root_motion. |
take_root_motion() |
(x, y, z): the travel since the last call, in world metres; clears it. Calls sona_avatar_take_root_motion. |
lod() |
(step, fade): "full", "sampled", "quarter" or "sprite" at the last update, and mesh (0) to sprite (1). Calls sona_avatar_lod. |
play_stock(clip, fade=0.0, loop=None, speed=1.0, start=0.0) |
A stock clip (a name, an id or a StockClip), the variant for this avatar's body; fade > 0 crossfades. Calls sona_avatar_play_stock. |
idle(on=True, parts=None, seed=0, amount=1.0, face_px=240.0) |
The procedural idle: blinks, glances, weight shifts and breathing over any clip. Calls sona_avatar_idle. |
idle_options() |
The idle's options in use (seed resolved); parts 0 when off. Calls sona_avatar_idle_get. |
idle_state() |
What the idle gave the last pose: IdleState(blink, gaze, shift, breath). Calls sona_avatar_idle_state. |
layer_play(layer, clip, **opts) |
Plays a clip on a layer (0..7). Calls sona_avatar_layer_play. |
layer_blend(layer, blend, **opts) |
Plays a blend space of the same ctx on the layer. Calls sona_avatar_layer_blend. |
layer_machine(layer, machine, **opts) |
Runs a state machine of the same ctx on the layer from its initial state (a STATE event with from_state -1). Calls sona_avatar_layer_machine. |
layer_goto(layer, state, fade_seconds=0.2) |
Sends a machine layer to state now, crossfading over fade_seconds. Calls sona_avatar_layer_goto. |
layer_weight(layer, weight, over_seconds=0.0) |
Moves the layer's weight linearly to weight (0..1) over over_seconds; 0 or less sets it at once. Calls sona_avatar_layer_weight. |
layer_mask(layer, mask) |
72 weights 0..1, or None for every joint. Calls sona_avatar_layer_mask. |
layer_stop(layer, fade_seconds=0.2) |
Fades the layer out over fade_seconds and then empties it (a STOPPED event); 0 empties it now. Calls sona_avatar_layer_stop. |
layer_info(layer) |
The layer now: kind, mode, state (machines, else -1), clip (the sona_clip_get index, -1 for a raw id), weight with fades, time and normalized through the clip or cycle, ready (its clips have loaded) and Calls sona_avatar_layer_info. |
layer_events() |
Every layer event since the last call, oldest first. Calls sona_avatar_layer_events. |
set_param(param, value) |
Sets one parameter on the avatar; read at the next sona_update. Calls sona_avatar_set_param. |
set_params(first, values) |
Parameters first.. Calls sona_avatar_set_params. |
param(param) |
A parameter's value; 0 when unset or unknown. Calls sona_avatar_param. |
preview_bounds() |
(lo, hi): the item's world box. Calls sona_item_preview_bounds. |
preview_view(width, height) |
The framed camera for a width x height picture, as a sona_view. Calls sona_item_preview_view. |
ClipEvent¶
class ClipEvent: kind: "started", "looped", "ended", "foot_left", "foot_right" or "mark"; mark: its id; clip: the clips index (-1 for a prop or raw clip); time: seconds into the clip.
| Declaration | What it does |
|---|---|
__init__(e) |
Made by the binding when a call returns one; not made by hand. |
LodStats¶
class LodStats: The C type sona_lod_stats.
| Declaration | What it does |
|---|---|
__init__(s) |
Made by the binding when a call returns one; not made by hand. |
StockClip¶
class StockClip: One stock clip, copied: id (its SONA_STOCK_* number), name, family, asset_id, caption, tags (names), body (1 male, 2 female, 3 both), frames, fps, seconds, same_as (an id or 0).
| Declaration | What it does |
|---|---|
__init__(c) |
Made by the binding when a call returns one; not made by hand. |
IdleState¶
class IdleState: The C type sona_idle_state.
| Declaration | What it does |
|---|---|
__init__(s) |
Made by the binding when a call returns one; not made by hand. |
Item¶
class Item: One catalogue item, copied: guid, id, kind, gender, section (a name), mask, flags, route, colour_set, name, game, type, family, description, subcategory, colour_choices, texture_type, shape_type.
| Declaration | What it does |
|---|---|
__init__(i) |
Made by the binding when a call returns one; not made by hand. |
Catalogue¶
class Catalogue: sona-catalogue.bin, from a path or its bytes.
| Declaration | What it does |
|---|---|
__init__(source, ctx=None) |
Made by the binding when a call returns one; not made by hand. Calls sona_catalogue_load_memory, sona_catalogue_load. |
close() |
Frees it and every string it handed out. Calls sona_catalogue_free. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
__len__() |
Items, sorted by id. Calls sona_catalogue_count. |
get(index) |
One item. Calls sona_catalogue_get. |
__getitem__(index) |
The item at an index (sona_catalogue_get). |
__iter__() |
Every item, in the catalogue's order. |
find(item) |
The index of an item id (text in any spelling, or a Guid), or -1. Calls sona_catalogue_find, sona_catalogue_find_guid. |
search(text=None, game=None, slots=0, section=0, gender=0, require=0, exclude=0, offset=0, limit=None) |
(indexes, total): matches in id order, up to limit (None: all) after offset; total counts every match. Calls sona_catalogue_search. |
games() |
(name, items) sorted by name: the games and sources items come from. Calls sona_catalogue_game_count, sona_catalogue_game. |
generated() |
When its data was made, ISO 8601. Calls sona_catalogue_generated. |
FilterChange¶
class FilterChange: One change a filter made: from_id, to_id (None when hidden or for the head's own shape), action ("replaced" or "hidden"), reason (SONA_CONTENT_BY_*), tag (a name or None) and section (a name).
| Declaration | What it does |
|---|---|
__init__(c, tag_name) |
Made by the binding when a call returns one; not made by hand. |
Filter¶
class Filter: Which items a game allows: by section, slot, game, tag, source or item id.
| Declaration | What it does |
|---|---|
__init__(catalogue=None, ctx=None) |
Made by the binding when a call returns one; not made by hand. Calls sona_filter_create. |
close() |
Frees the filter. Calls sona_filter_free. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
preset(*names) |
"family", "no-logos", "no-licensed". Calls sona_filter_preset. |
reset() |
Every rule goes; tags stay. Calls sona_filter_reset. |
sections(*sections, allow=False) |
Adds a rule on sections: bits (1u << sona_section). Calls sona_filter_sections. |
slots(mask, allow=False) |
Adds a rule on slots (AssetMask bits): an item matches when it covers any of them. Calls sona_filter_slots. |
sources(bits, allow=False) |
Adds a rule on where items come from (SONA_CONTENT_STOCK and the other source bits). Calls sona_filter_sources. |
game(name, allow=False) |
A game as sona_catalogue_game names it (ASCII case folded). Calls sona_filter_game. |
tag(name, allow=False) |
A tag by name ("weapon", "logo", or one the host defined). Calls sona_filter_tag. |
item(item, allow=False) |
Adds a rule on one item by id. Calls sona_filter_item. |
load(json_text) |
Rules from JSON (Content filters); all or nothing. Calls sona_filter_load. |
allowed_count() |
Catalogue items allowed. Calls sona_filter_allowed_count. |
tags() |
(name, catalogue items carrying it) for every tag. Calls sona_filter_tag_name, sona_filter_tag_items, sona_filter_tag_count. |
tag_name(tag) |
NULL past the last. Calls sona_filter_tag_name. |
define_tag(name) |
A new tag (a name of 1 to 31 bytes of a-z, 0-9 and '-'), or the index of the one of that name. Calls sona_filter_tag_define. |
set_tag(item, tag, on=True) |
-1 when unknown. Calls sona_filter_tag_find, sona_filter_tag_set. |
item_tags(item) |
The names of an item's tags. Calls sona_filter_item_tags. |
allows(item) |
1 when the item is allowed; a NULL filter allows everything. Calls sona_filter_allows. |
check(item) |
The verdict: a sona_filter_verdict (allowed, reason, tag, index, section, source, tags). Calls sona_filter_check. |
search(catalogue, section=0, limit=None) |
(indexes, total) of allowed catalogue items, optionally of one section. Calls sona_filter_search. |
filter_manifest(manifest) |
(new 1000 bytes, FilterChange): the manifest through the filter; the same bytes when nothing is denied. Calls sona_filter_manifest_bytes. |
apply_to(ctx) |
Gives ctx a copy: every avatar it reads from then on goes through it. Calls sona_ctx_set_filter. |
Mesh¶
class Mesh: The runtime vertex, 76 bytes, in host byte order: +0 float3 position (bind pose, avatar space) +12 uint8 x4 joint index * 3 (the palette's float4 row) +16 uint8 x4 weight (sum 255) +20 uint8 x4 normal, (n * 0.5 + 0.5) * The C type sona_mesh.
| Declaration | What it does |
|---|---|
__init__(m) |
Made by the binding when a call returns one; not made by hand. |
Material¶
class Material: Address modes: bit 0 set = U wraps, bit 1 set = V wraps; clear = clamp. The C type sona_material.
| Declaration | What it does |
|---|---|
__init__(m) |
Made by the binding when a call returns one; not made by hand. |
Texture¶
class Texture: The C type sona_texture.
| Declaration | What it does |
|---|---|
__init__(t) |
Made by the binding when a call returns one; not made by hand. |
Prop¶
class Prop: A prop the avatar holds this frame: its item, palette and whether it plays (sona_prop_palette).
| Declaration | What it does |
|---|---|
__init__(p) |
Made by the binding when a call returns one; not made by hand. |
Pose¶
class Pose: Plain objects over sona_pose_data.
| Declaration | What it does |
|---|---|
__init__(ctx, p) |
Made by the binding when a call returns one; not made by hand. |
valid() |
False once an update, remove or close has happened since this pose was taken. |
Manifest¶
class Manifest: An avatar's description (raw: the sona_manifest struct) and its edit verbs: wear, take off, colours, gender, body shape.
| Declaration | What it does |
|---|---|
__init__(data) |
Made by the binding when a call returns one; not made by hand. Calls sona_manifest_parse. |
to_bytes() |
The manifest as its 1,000 bytes. Calls sona_manifest_write. |
gender() |
Derived: 1 male, 2 female, 0 unknown. The C field sona_manifest. |
valid() |
Derived: IsValid. The C field sona_manifest. |
wear(item, colours=(0, 0, 0), flags=0) |
Puts an item on, with its three colours. Calls sona_manifest_wear. |
unwear(slot_mask, flags=0) |
Takes off what is in the slots of slot_mask. Calls sona_manifest_unwear. |
undress_all() |
Takes everything off. Calls sona_manifest_undress_all. |
set_colour(slot, argb) |
Sets one of the nine body colours, by its index in colours. Calls sona_manifest_set_colour. |
set_gender(gender, flags=0) |
Sets the gender: 1 male, 2 female. Calls sona_manifest_set_gender. |
set_shape(weight, height) |
Sets the weight and height. Calls sona_manifest_set_shape. |
ready_for_xbox() |
1 when the body (and so the gender) is known and the editor's Xbox clean-up would change nothing: the manifest can be saved to Xbox as it is. Calls sona_manifest_ready_for_xbox. |
AnimFile¶
class AnimFile: A glTF, FBX or BVH clip file, parsed (no ctx).
| Declaration | What it does |
|---|---|
__init__(data=None, path=None, bone_map=None, flags=0, fmt=0) |
Made by the binding when a call returns one; not made by hand. Calls sona_anim_file_open, sona_anim_file_load. |
takes() |
How many takes (animations) the file holds. Calls sona_anim_file_takes, sona_anim_file_take. |
bones() |
(name, parent index or -1, the avatar joint it drives or None) per bone. Calls sona_anim_file_bones, sona_anim_file_bone. |
close() |
Imported clips do not need the file once sona_clip_import returned. Calls sona_anim_file_free. |
BlendSpace¶
class BlendSpace: A blend space of one context (Context.blend_space).
| Declaration | What it does |
|---|---|
__init__(ctx, raw, n) |
Made by the binding when a call returns one; not made by hand. |
weights(x, y=0.0) |
Each sample's weight at (x, y), a list that sums to 1; y is ignored in 1D. Calls sona_blend_space_weights. |
destroy() |
Lets go of the host's handle. Calls sona_blend_space_destroy. |
StateMachine¶
class StateMachine: A state machine of one context (Context.state_machine).
| Declaration | What it does |
|---|---|
__init__(ctx, raw) |
Made by the binding when a call returns one; not made by hand. |
find(state) |
A state's index by name, -1 if unknown. Calls sona_state_machine_find. |
state_name(state) |
A state's name, NULL past the last. Calls sona_state_machine_state_name. |
destroy() |
As sona_blend_space_destroy. Calls sona_state_machine_destroy. |
LayerInfo¶
class LayerInfo: kind: "empty", "clip", "blend" or "machine"; mode: "override" or "additive"; state (machines, else -1); clip; weight; time; normalized; ready; fading.
| Declaration | What it does |
|---|---|
__init__(i) |
Made by the binding when a call returns one; not made by hand. |
LayerEvent¶
class LayerEvent: kind: "started", "looped", "ended", "state" or "stopped"; layer; state and from_state (machines); time.
| Declaration | What it does |
|---|---|
__init__(e) |
Made by the binding when a call returns one; not made by hand. |
LipSyncFrame¶
class LipSyncFrame: One step of the lip sync analysis: time, mouth (SONA_MOUTH_*), open, level in dB, the shape weights, the two formants and flags (sona_lipsync_frame).
| Declaration | What it does |
|---|---|
__init__(f) |
Made by the binding when a call returns one; not made by hand. |
LipSync¶
class LipSync: Audio in, mouths out: feed PCM in any chunks, a frame every 10 ms.
| Declaration | What it does |
|---|---|
__init__(sample_rate=48000, channels=1, s16=False) |
Made by the binding when a call returns one; not made by hand. Calls sona_lipsync_create. |
feed(samples) |
frames: samples per channel. Calls sona_lipsync_feed. |
read() |
The frames made since the last read, oldest first. Calls sona_lipsync_read. |
current() |
The newest frame (a shut mouth before the first). Calls sona_lipsync_current. |
latency() |
Seconds from a sample being fed to the first frame that hears it. Calls sona_lipsync_latency. |
hint(phonemes) |
(symbol, start, end) tuples a TTS reported, on the fed audio's clock. Calls sona_lipsync_hint. |
reset() |
Back to time 0: hints and frames waiting to be read are dropped. Calls sona_lipsync_reset. |
close() |
Frees the analyser. Calls sona_lipsync_destroy. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
VoiceMouth¶
class VoiceMouth: Voice chat: one speaker's mouth from its audio level alone.
| Declaration | What it does |
|---|---|
__init__(seed=0) |
Made by the binding when a call returns one; not made by hand. Calls sona_voice_mouth_init. |
step(level, dt) |
(mouth, open) after dt seconds at this level (linear RMS). Calls sona_voice_mouth_step. |
Headless¶
class Headless: A renderer on the library's own device: the best GPU, or lavapipe or llvmpipe.
| Declaration | What it does |
|---|---|
__init__(ctx, device="auto", backend=None, adapter=-1, validation=False, batch_in_flight=8, wait_seconds=60) |
Made by the binding when a call returns one; not made by hand. Calls sona_headless_open. |
close() |
Frees the renderer and the device. Calls sona_headless_close. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
style() |
The art style of every avatar without its own; None when the device's backend draws no styles. Calls sona_renderer_style, sona_headless_renderer. |
set_style(kind=None, outline=False, override=False, **fields) |
The art style of every avatar without its own (override: of every avatar); kind None clears it. Calls sona_renderer_set_style, sona_headless_renderer. |
info() |
The device it drew on. Calls sona_headless_info_get. |
set_lighting(lighting=None) |
The host's lights from the next picture (lighting_defaults to start from); None: the original look. Calls sona_headless_renderer, sona_renderer_set_lighting. |
set_environment_sh(sh9=None, skin_red=1.2) |
The lit avatars' environment as 9 RGB SH coefficients of radiance; None: the built-in cube. Calls sona_headless_renderer, sona_renderer_set_environment, sona_environment_defaults. |
shadow_map() |
The renderer's own shadow map after its last lit picture with shadows (sona_shadow_map), or None. Calls sona_renderer_shadow_map, sona_headless_renderer. |
render(avatar, **opts) |
One picture of an avatar of the context, alone. Calls sona_headless_render. |
render_manifest(manifest, **opts) |
Adds the avatar (hidden, standing still or playing clip from time), draws it and removes it. Calls sona_headless_render_manifest. |
batch(manifests, **opts) |
A list of (result, rgba bytes or None), one per manifest, in order. Calls sona_headless_batch. |
sequence(avatar, frames=0, fps=30.0, turn_deg=0.0, orbit=False, **opts) |
Every frame as bytes: frame i at the clip's start + i / fps, turned turn_deg * i / frames. Calls sona_headless_sequence. |
record(avatar, video, frames=0, fps=30.0, turn_deg=0.0, orbit=False, **opts) |
sona_headless_sequence into a video. Calls sona_headless_record. |
Video¶
class Video: A PNG sequence, GIF, MP4 or WebM.
| Declaration | What it does |
|---|---|
__init__(ctx, path, width, height, format="auto", fps=30.0, loops=0, quality=0, background=0xff000000, opaque=False, dither=True, colours=0, ffmpeg=None) |
Made by the binding when a call returns one; not made by hand. Calls sona_video_open. |
frame(rgba) |
One frame of width * height straight RGBA8, row 0 at the top. Calls sona_video_frame. |
finish() |
Ends the file; the bytes of an in-memory video, else None. Calls sona_video_finish, sona_free. |
PlayerLook¶
class PlayerLook: state ("waiting", "fresh", "stale", "private", "none"), manifest (bytes to add), placeholder, version, name, error (a sona_result word, "" when the last check worked), fetched_at, checked_at, next_check (clock seconds).
| Declaration | What it does |
|---|---|
__init__(raw) |
Made by the binding when a call returns one; not made by hand. |
PlayerEvent¶
class PlayerEvent: kind ("look", "gone", "failed"), id (as watched), code (a sona_result word, "" for ok).
| Declaration | What it does |
|---|---|
__init__(raw) |
Made by the binding when a call returns one; not made by hand. |
Players¶
class Players: Friends, lobby members and leaderboard rows by id (a gamertag, "a:<account>/<slot>", "w:<case key>").
| Declaration | What it does |
|---|---|
__init__(host=None, client=None, cache_dir=None, placeholder=None, max_players=0, refresh_s=0, per_hour=0, in_flight=0, timeout_ms=0) |
Made by the binding when a call returns one; not made by hand. Calls sona_players_defaults, sona_players_open. |
watch(ids, priority=0) |
Returns "ok", or the word of the first problem ("argument" for a string that is not an id, "limit"). Calls sona_players_watch. |
unwatch(ids=None) |
Stops asking; looks stay cached. Calls sona_players_unwatch. |
refresh(ids=None) |
Asks again now, inside the limits. Calls sona_players_refresh. |
update() |
Each frame: takes answers, sends due requests, writes the cache file (at most every 2 s). Calls sona_players_update. |
poll() |
Every event waiting, oldest first; an empty list when there are none. Calls sona_players_poll. |
look(player_id) |
Always fills out with a look to draw (the placeholder when nothing is known). Calls sona_players_look. |
forget(player_id) |
Drops the id's look from memory and, at the next write, from the cache file, and stops watching it. Calls sona_players_forget. |
stats() |
Looks kept, ids watched, requests in flight and due, and counts since open: requests, changed, the same, 304s, gone, failed, read from disk, disk writes, waits for per_hour; paused_until. Calls sona_players_stats_get. |
close() |
Writes the cache file when it changed; answers still in flight are dropped. Calls sona_players_close. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
OutfitIssue¶
class OutfitIssue: The C type sona_outfit_issue.
| Declaration | What it does |
|---|---|
__init__(i) |
Made by the binding when a call returns one; not made by hand. Calls sona_outfit_issue_name. |
Maker¶
class Maker: A catalogue's outfit rules, indexed once: seeded random avatars, dress like, clashes, matched sets and the outfit check.
| Declaration | What it does |
|---|---|
__init__(catalogue, ctx=None) |
Made by the binding when a call returns one; not made by hand. Calls sona_maker_create. |
close() |
Frees the maker. Calls sona_maker_free. |
__enter__() |
Opens a with block; the object is closed when the block ends. |
__exit__(*exc) |
Closes the object at the end of a with block. |
random(seed, body=0, style="any", palette="natural", flags=0, require=0, exclude=0, skip_sections=0, game=None, tag=None, base=None, skin=None, hair=None, eyes=None, available=None) |
(manifest bytes, report dict): a seeded random avatar. Calls sona_random_defaults, sona_make_random. |
dress_like(body, like, parts=0, match=N.SONA_MATCH_SIMILAR, layer=False, available=None) |
(manifest bytes, report dict): body wearing like's parts (SONA_LIKE_* bits; 0: clothes and props). Calls sona_like_defaults, sona_make_dress_like. |
variant(item, body, match=N.SONA_MATCH_SIMILAR) |
(outcome, item id or None): what body (1 or 2) wears for item. Calls sona_make_variant. |
clash(a, b) |
(SONA_CLASH_* bits, the slots they share). |
conflicts(manifest, item) |
The ids wearing item would take off manifest. Calls sona_outfit_conflicts. |
sets() |
Every matched set: dicts of index, name, game, title, count, bodies, sections, slots. Calls sona_outfit_set_count, sona_outfit_set_get. |
set_of(item) |
The matched set an item is in, or -1. Calls sona_outfit_set_of. |
set_items(index, body=0) |
Catalogue indexes of a set's items a body wears (0: all). Calls sona_outfit_set_items. |
check(manifest) |
(report dict, OutfitIssue) errors first. |
fix(manifest) |
(fixed manifest bytes, report dict after). |
NetSender¶
class NetSender: One avatar's stream to one receiver: write a packet each tick, ack what comes back.
| Declaration | What it does |
|---|---|
__init__(ctx, tick_hz=30, history=64, full_after=0) |
Made by the binding when a call returns one; not made by hand. Calls sona_net_sender_create. |
look(id=None) |
None: the avatar's manifest goes along; else this id (a gamertag, a player id). Calls sona_net_sender_look. |
write(avatar, tick) |
One packet of a's state at tick, coded against the newest acknowledged tick (or full). Calls sona_net_write. |
ack(tick) |
The receiver holds tick. Calls sona_net_ack. |
stats() |
Packets and bytes written, those without a baseline (full), the last packet's size and the newest acknowledged tick. Calls sona_net_sender_stats. |
close() |
Frees the sender. Calls sona_net_sender_destroy. |
NetReceiver¶
class NetReceiver: The receiving end: read each packet (send back what it returns), drive a puppet at any tick.
| Declaration | What it does |
|---|---|
__init__(ctx, tick_hz=30, history=64, full_after=0) |
Made by the binding when a call returns one; not made by hand. Calls sona_net_receiver_create. |
read(packet) |
The tick to acknowledge; raises SonaError ("not_found" when its baseline is no longer held). Calls sona_net_read. |
look() |
None before a look arrived; else ("manifest", bytes) or ("id", str). Calls sona_net_receiver_look. |
drive(avatar, tick) |
Shows tick on a, which becomes a puppet: a held tick as it is, a fraction between two held ticks as their blend, before the oldest the oldest, past the newest the newest. Calls sona_net_drive. |
stats() |
Packets and bytes read, packets refused for want of a baseline (full), the newest and oldest ticks held. Calls sona_net_receiver_stats. |
close() |
Frees the receiver. Calls sona_net_receiver_destroy. |
Recorder¶
class Recorder: Avatars' states each tick into one replay file; keep_seconds > 0 keeps only about the last seconds.
| Declaration | What it does |
|---|---|
__init__(ctx, tick_hz=30, keyframe_ticks=0, keep_seconds=0.0) |
Made by the binding when a call returns one; not made by hand. Calls sona_record_defaults, sona_recorder_create. |
track(avatar, name=None) |
Records the avatar from the next capture on, under name if given; returns its track number. Calls sona_recorder_track. |
capture(tick) |
Every track's state at tick (rising). Calls sona_recorder_capture. |
save() |
The file's bytes, freed with sona_free. Calls sona_recorder_save, sona_free. |
close() |
Frees the recorder and what it captured. Calls sona_recorder_destroy. |
Replay¶
class Replay: A recording: drive(track, avatar, seconds) at any time, in any order.
| Declaration | What it does |
|---|---|
__init__(ctx, data) |
Made by the binding when a call returns one; not made by hand. Calls sona_replay_open. |
info() |
The replay's tracks, tick rate, first and last tick, the captures it holds and its length in seconds. Calls sona_replay_info_get. |
track(track) |
(manifest bytes, name, from seconds, to seconds) Calls sona_replay_track. |
drive(track, avatar, seconds) |
Shows the track at seconds from the replay's start on a, which becomes a puppet, blending the two frames around it. Calls sona_replay_drive. |
close() |
Frees the replay. Calls sona_replay_close. |
PickHit¶
class PickHit: One pick: the avatar (an Avatar of its context), the item, mesh and triangle, the joint and body region, where.
| Declaration | What it does |
|---|---|
__init__(h, ctx) |
Made by the binding when a call returns one; not made by hand. Calls sona_region_name. |
PropMesh¶
class PropMesh: A prop mesh of one context (Context.prop_mesh, prop_mesh_load, prop_mesh_stock).
| Declaration | What it does |
|---|---|
__init__(ctx, raw) |
Made by the binding when a call returns one; not made by hand. |
state() |
"ready", "pending", or the failure's code name. Calls sona_prop_mesh_state. |
info() |
dict: kind ("host" or "stock"), parts, vertices, triangles, textures, joints, hand, joint, lo, hi, seconds, item, pet, clip, untextured; None while pending. Calls sona_prop_mesh_info_get. |
meshes() |
The data API's Mesh objects of the prop (joint bytes index the prop frame's palette). Calls sona_prop_mesh_data. |
release() |
The host's reference goes; avatars it is attached to keep it until they detach it. Calls sona_prop_mesh_release. |
Control¶
class Control: One control of the editor's screen: its role, place, text and value (sona_editor_control).
| Declaration | What it does |
|---|---|
__init__(c) |
Made by the binding when a call returns one; not made by hand. |
Editor¶
class Editor: The C type sona_editor.
| Declaration | What it does |
|---|---|
__init__(ctx, catalogue, mode="full", start=None, theme_=None, theme="dark", width=1280, height=720, seed=1, flags=0, title=None, filter=None, look=None, sound=None) |
Made by the binding when a call returns one; not made by hand. Calls sona_editor_defaults, sona_editor_open. |
close() |
Removes its avatars from the ctx. Calls sona_editor_close. |
button(code, down) |
A gamepad button pressed or let go (sona_editor_input). |
press(code, dt=1.0 / 60) |
Down, a frame, up, a frame. |
axis(code, value) |
A gamepad axis moved, -1 to 1 (sona_editor_input). |
key(code, mods=0) |
A key pressed, with modifier bits (sona_editor_input). |
text(s) |
Typed text, for the search box (sona_editor_input). |
pointer(x, y, down, pointer=0) |
down: True pressed, False released, None moved. |
wheel(lines, x, y) |
A mouse wheel turned at a point, in lines (sona_editor_input). |
update(dt) |
Advances dt seconds: stick repeat, animations, avatar builds and (unless HOST_UPDATES) sona_update on the ctx. Calls sona_editor_update. |
status() |
SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned. Calls sona_editor_status. |
result() |
The avatar as it stands (at any time): SONA_MANIFEST_BYTES. Calls sona_editor_result. |
busy() |
1 while an avatar is still building (the shown one or a change on its way); thumbnails do not count. Calls sona_editor_busy. |
build_failures() |
How many avatar builds failed since open (the screen reader is told each time). Calls sona_editor_build_failures. |
undo(redo=False) |
Undoes the last change (redo 0) or redoes the last undone one (redo 1), for a host that draws the stage's own undo and redo buttons. Calls sona_editor_undo. |
can_undo(redo=False) |
1 when sona_editor_undo with the same redo would step: use it to grey out the buttons. Calls sona_editor_can_undo. |
zoom(set=0.0) |
The stage's zoom: 1 is the editor's own framing, from 0.6 to 3. Calls sona_editor_zoom. |
turn(degrees) |
Turns the avatar on the stage by degrees, as a drag across the stage does. Calls sona_editor_turn. |
screen() |
The screen shown now. Calls sona_editor_screen_get. |
screens() |
The mode's screens in tab order, by name. Calls sona_editor_screens. |
set_screen(name) |
Moves to a screen of the mode (a deprecated id to the screen that took its place). Calls sona_editor_set_screen. |
set_search(text) |
The search box of the wardrobe and the item screens, for hosts with an on-screen keyboard (UTF-8; NULL clears). Calls sona_editor_set_search. |
set_theme(which="dark", **overrides) |
Changes the colours and sizes from the next frame. Calls sona_editor_set_theme. |
resize(width, height) |
The editor's size in pixels, the size of the target it is drawn into. Calls sona_editor_resize. |
controls() |
Every control on screen, in reading order, and the focused one. Calls sona_editor_control_count, sona_editor_control_get. |
focus() |
SONA_E_NOT_FOUND when nothing has focus (pointer-only use). Calls sona_editor_focus_get. |
announcement() |
What a screen reader should say since the last call ("Wardrobe, tab, 6 of 6"), or None. Calls sona_editor_announcement. |
draw_data() |
(vertices, indices, commands, avatar_rect): vertices as (x, y, u, v, (r, g, b, a)); commands as (texture, first_index, index_count, clip). Calls sona_editor_draw_data_get. |
texture(which) |
(width, height, revision, rgba bytes) of TEXTURE_ATLAS or TEXTURE_THUMBS. Calls sona_editor_texture_get. |
render_ui(width=None, height=None, under=None) |
The UI layer as RGBA bytes; under: RGBA bytes of the same size to draw it over (an avatar snapshot). Calls sona_editor_draw_data_get, sona_editor_render_ui. |
State¶
class State: The C type sona_state_desc.
| Declaration | What it does |
|---|---|
__init__(s) |
Made by the binding when a call returns one; not made by hand. |
Tracker¶
class Tracker: The C type sona_tracker.
| Declaration | What it does |
|---|---|
__init__(mirror=False, no_head=False, no_face=False, no_gaze=False, **options) |
Made by the binding when a call returns one; not made by hand. Calls sona_track_defaults, sona_track_create. |
close() |
Frees the tracker. Calls sona_track_destroy. |
feed(time, scores=None, head=None, layout="mediapipe") |
scores: 52 floats in the layout's order, None when the camera saw no face. Calls sona_track_face_input_defaults, sona_track_face_feed. |
state() |
What the tracker makes of the frames so far: the filtered, calibrated weights in ARKit order (sides swapped under SONA_TRACK_MIRROR, so Left is the avatar's left) and the head. Calls sona_track_face_get. |
calibrate_begin() |
Starts collecting a neutral face: every frame with a face from now on counts. Calls sona_track_calibrate_begin. |
calibrate_end() |
The calibration as bytes, to save and hand back to calibration_set in a later session. Calls sona_track_calibrate_end. |
calibration_set(blob=None) |
A saved calibration, for the next session; NULL clears it. Calls sona_track_calibration_set. |
reset() |
Forgets the filters, the shapes held and the tracking state; keeps the options and the calibration. Calls sona_track_reset. |
apply(avatar) |
Puts the state on a sona.Avatar; False until it is ready and posed. Calls sona_track_apply. |
release(avatar) |
Hands the face and the tracker's joints back to the clip; nothing when a is not the avatar it drives. Calls sona_track_release. |
Types¶
| Declaration | What it does |
|---|---|
class sona_editor_options(Structure) |
The C type sona_editor_options, field for field. |
class sona_editor_theme(Structure) |
Colours are 0xAARRGGBB, straight alpha. The C type sona_editor_theme, field for field. |
class sona_editor_input(Structure) |
The C type sona_editor_input, field for field. |
class sona_editor_control(Structure) |
The C type sona_editor_control, field for field. |
class sona_editor_vertex(Structure) |
The C type sona_editor_vertex, field for field. |
class sona_editor_command(Structure) |
Blend with SRC_ALPHA, ONE_MINUS_SRC_ALPHA (straight alpha), no depth, the scissor at clip. The C type sona_editor_command, field for field. |
class sona_editor_draw_data(Structure) |
The C type sona_editor_draw_data, field for field. |
class sona_editor_texture(Structure) |
The C type sona_editor_texture, field for field. |
class sona_track_options(Structure) |
The C type sona_track_options, field for field. |
class sona_track_face_input(Structure) |
One frame of a face tracker. The C type sona_track_face_input, field for field. |
class sona_track_face_state(Structure) |
What the tracker makes of the frames so far. The C type sona_track_face_state, field for field. |
class sona_track_calibration(Structure) |
Neutral face. The C type sona_track_calibration, field for field. |
This page as Markdown · All the docs as one file (llms-full.txt)