Skip to content

Engine reference: Godot

The GDExtension sona.gdextension for Godot 4. Nodes are added from the Add Node dialog; properties are in the Inspector and settable from GDScript.

SonaServer

Inherits Object. The engine singleton: owns the one sona_ctx, ticks it from SceneTree.process_frame, supplies sona_http through HTTPRequest, and keeps the GPU resources avatars share (geometry and textures by key).

Property Type What it does
auto_tick bool Tick from SceneTree.process_frame; off, call tick(dt) yourself. Set with set_auto_tick, read with get_auto_tick.
cull_with_camera bool Cull and pick the level of detail with the camera; off when avatars live in a SubViewport with its own camera. Set with set_cull_with_camera, read with get_cull_with_camera.
credit_enabled bool Show the "Powered by 360sona" badge; off, put the line in your credits instead (Licence S2). Set with set_credit_enabled, read with get_credit_enabled.
Method What it does
open(options: Dictionary = Dictionary()) -> int Sets abi and leaves everything else at its default.
close() -> void Frees the maker.
set_filter(filter: SonaFilter) -> int Puts a copy of a content filter on the context (now, or when it opens); null takes it away. Returns a result code.
set_catalogue(catalogue: SonaCatalogue) -> void The catalogue the editor view and random looks use: set it, or it loads sona/catalogue/file the first time.
get_catalogue() -> SonaCatalogue The catalogue random looks and the editor use, or null.
get_filter() -> SonaFilter The content filter last set, or null.
is_open() -> bool True once the context is open.
tick(dt: float) -> int The web's full-body framing.
set_camera(camera: Camera3D) -> void The camera culling and level of detail use; null goes back to the root viewport's.
get_camera() -> Camera3D The camera culling and level of detail use.
get_last_error() -> String The context's last error message, or empty.
get_stats() -> Dictionary The scene statistics.
get_credit_info() -> Dictionary The badge as it is now: enabled, visible, alpha, rect, corner and url.
get_clips() -> PackedStringArray How many clips the context knows.
get_version() -> String The library's version, "1.1.0".
get_platform() -> String The binary platform id compiled into this library: "windows-x64", "linux-x64", "linux-arm64", "macos-arm64", "macos-x64", "ios-arm64", "android-arm64", "android-x64", "xbox360" or "wasm".
get_scene_time() -> float Seconds of scene time the context has been ticked.
set_lod(options: Dictionary = Dictionary()) -> int Turns on the default LOD steps and sprites (a context opens with no sprites, as 1.0 drew).
get_lod() -> Dictionary Turns on the default LOD steps and sprites (a context opens with no sprites, as 1.0 drew).
get_lod_stats() -> Dictionary The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw.
joint_find(name: String) -> int A joint's number from its name: a humanoid name (Hips, Spine, Chest, Neck, Head, LeftUpperArm, ...
joint_name(joint: int) -> String The name of joints 0 to 70: the humanoid name, or shape_NN.
Signal When
error(code: int, name: String, message: String, fix: String) An error of the context: the result code, its name, the message and what to do.
licence_ok() The licence check passed.

SonaAvatar3D

Inherits Node3D. One avatar. Properties: manifest (base64 AvatarDescription), clip, loop, speed, start_at; placement comes from the node's transform.

Property Type What it does
manifest String The avatar as base64 (1,000 bytes). Setting it adds the avatar again with the new look. Set with set_manifest, read with get_manifest.
manifest_bytes PackedByteArray The same manifest as its 1,000 raw bytes. Set with set_manifest_bytes, read with get_manifest_bytes.
clip String A clip key, a raw clip id, "prop", "idle" or "still". Set with set_clip, read with get_clip.
loop bool Loop the clip. It applies at the next play(). Set with set_loop, read with get_loop.
speed float Playback speed; 1 is the clip's own. It applies at the next play(). Set with set_speed, read with get_speed.
start_at float Seconds into the clip; negative: random, to desynchronise a crowd. Set with set_start_at, read with get_start_at.
priority int Higher builds sooner. Set with set_priority, read with get_priority.
crossfade_time float (0, 2, 0.01, suffix:s) Seconds to blend when clip changes; 0 cuts. Set with set_crossfade_time, read with get_crossfade_time.
root_motion int (Off, Extract, Apply) What happens to the clip's travel: Off, Extract (take_root_motion hands it to you) or Apply (the node moves). Set with set_root_motion_mode, read with get_root_motion.
expression_mouth int (-1, 13) A mouth shape held over the clip: 0-6 moods, 7-13 speech. -1: as the clip has it. Set with set_expression_mouth, read with get_expression_mouth.
expression_eyebrows int (-1, 20) An eyebrow shape for both eyebrows. -1: as the clip has it. Set with set_expression_eyebrows, read with get_expression_eyebrows.
expression_eyes int (-1, 20) An eye shape for both eyes. -1: as the clip has it. Set with set_expression_eyes, read with get_expression_eyes.
joint_overrides Dictionary Joints turned after the clip: a joint name (Head, LeftUpperArm, ...) and Euler degrees. Set with set_joint_overrides, read with get_joint_overrides.
override_weight float (0, 1, 0.01) How much of each joint override to use, 0 to 1. Set with set_override_weight, read with get_override_weight.
override_mode int (Replace, Add) How joint_overrides turn their joints: Replace sets the rotation, Add turns on top of the clip's. Set with set_override_mode, read with get_override_mode.
marks PackedFloat32Array Seconds into the clip that raise a Mark clip event (ids 1, 2, ...). Set with set_marks, read with get_marks.
emit_clip_events bool Clip starts, loops, ends, footfalls and marks come as the clip_event signal. Set with set_emit_clip_events, read with get_emit_clip_events.
preview_item String An item id: the node shows that item on the grey stand-in body instead of an avatar. Set with set_preview_item, read with get_preview_item.
preview_options Dictionary The preview's options: gender, slot, flags, skin, colours, priority, time, margin. Set with set_preview_options, read with get_preview_options.
idle bool Breathing, blinks, glances and weight shifts on top of the clip. Set with set_idle, read with get_idle.
foot_ik bool Plant the feet on Godot's physics under them, else on the node's height. Set with set_foot_ik, read with get_foot_ik.
look_target NodePath The head and eyes turn to look at this. Set with set_look_target, read with get_look_target.
sway bool Hair and loose clothes sway as the avatar moves. Set with set_sway, read with get_sway.
upper_body_clip String A clip played on the upper body over the main clip (a wave while walking). Empty: none. Set with set_upper_body_clip, read with get_upper_body_clip.
random_seed int No manifest: a random look from this seed (needs the catalogue on the SonaContext). 0: none. Set with set_random_seed, read with get_random_seed.
Method What it does
play(clip: String, loop: bool = true, speed: float = 1.0, from: float = 0.0) -> int Plays a clip: a key, a raw clip id, "prop", "idle" or "still". Before the avatar is ready it is kept and applied when it appears. Returns a result code (0 is OK).
stop() -> void Holds the current pose.
get_state() -> int The avatar's state.
get_avatar_id() -> int A number unique among the avatars of the context.
get_palette() -> PackedFloat32Array The joint palette of the last tick, 864 floats (72 joints, three float4 rows each), which the meshes' shader reads.
get_view_joints() -> PackedFloat32Array Each joint's position at the last tick, 72 x 3 floats, before the avatar's placement.
get_prop_count() -> int How many props the avatar holds.
get_prop_palette(index: int) -> PackedFloat32Array One held prop's joint palette at the last tick.
get_prop_item(index: int) -> String One held prop's item id.
is_prop_playing(index: int) -> bool True while a held prop plays its own animation.
get_mesh_count() -> int How many MeshInstance3D children the avatar was built into.
get_mesh_items() -> PackedStringArray The item id each mesh came from, in mesh order.
get_mesh_instance(index: int) -> MeshInstance3D One of the avatar's MeshInstance3D children.
get_pose_info() -> Dictionary What the last pose holds: build_version, meshes, materials, textures, props, vertices, triangles, the expression (5 bytes) and the world matrix.
get_filter_report() -> Dictionary What the content filter changed on this avatar: each item replaced or taken off, and why.
get_bounds() -> Dictionary A bounding sphere, in metres.
frame_camera(camera: Camera3D, preset: int = 0) -> int The web's full-body framing.
get_preview_bounds() -> AABB The item's box in world metres, over the whole clip for a playing prop.
frame_preview(camera: Camera3D) -> int The framed camera for a width x height picture: the slot's view preset gives the angle, the item's box the target and the distance.
get_joint_transform(joint: int) -> Transform3D The joint's world matrix at the last sona_update: row-vector, metres, with the avatar's placement applied.
get_joint_matrix(joint: int) -> PackedFloat32Array The joint's world matrix at the last sona_update: row-vector, metres, with the avatar's placement applied.
set_joint_override(joint: int, rotation: Quaternion, weight: float = 1.0, mode: int = 0) -> int A rotation applied after the clip each frame, for look-at and aiming.
clear_joint_override(joint: int) -> int A rotation applied after the clip each frame, for look-at and aiming.
clear_overrides() -> void Clears every override of the avatar.
crossfade(clip: String, seconds: float = 0.25, loop: bool = true, speed: float = 1.0, from: float = 0.0) -> int Play, blending from the current pose over seconds (0: a cut).
queue_clip(clip: String, fade_seconds: float = 0.0, loop: bool = false, speed: float = 1.0, from: float = 0.0) -> int Plays clip when the current one ends, blending over fade_seconds (0: a cut).
get_queued() -> int How many clips are waiting in the queue.
get_capsule() -> Dictionary A vertical capsule around the posed body, in world space, for collisions: the segment a..b and its radius, scaled with the avatar.
set_expression(values: PackedByteArray) -> int Each a shape index (0 neutral) or SonaMouth.Clip (255) to leave that part as the clip has it.
clear_expression() -> int Hands the whole face back to the clip.
get_expression_counts() -> PackedInt32Array How many shapes this face has: counts[0] mouth, counts[1] eyebrows, counts[2] eyes.
get_clip_events() -> Array The clip events since the last call, oldest first, each a Dictionary of kind, mark, clip and time. Poll it each frame.
add_mark(seconds: float, id: int) -> int A MARK event with this id each time the current clip passes seconds.
clear_marks() -> void Removes the avatar's marks.
set_root_motion(mode: int) -> int What happens to the clip's sideways travel of the hips.
take_root_motion() -> Vector3 The travel collected since the last call, in world metres; clears it.
get_lod() -> Dictionary The LOD step at the last Update, and how far from mesh (0) to sprite (1).
get_feature_state() -> Dictionary The channels the idle gave the avatar's last pose (before amount); all 0 before one or when off.
Signal When
avatar_ready() The avatar is built and on screen.
clip_event(kind: int, mark: int, time: float) A clip started, looped or ended, a foot came down or a mark passed (with emit_clip_events on).
avatar_failed(code: int, message: String) The avatar could not be built: the result code and the message.

Constants: SonaAvatar3D.STATE_NONE = -1, SonaAvatar3D.STATE_QUEUED = 0, SonaAvatar3D.STATE_LOADING = 1, SonaAvatar3D.STATE_READY = 2, SonaAvatar3D.STATE_FAILED = 3, SonaAvatar3D.STATE_REMOVED = 4, SonaAvatar3D.PRESET_FULL = 0, SonaAvatar3D.PRESET_UPPER = 1, SonaAvatar3D.PRESET_BUST = 2, SonaAvatar3D.PRESET_FACE = 3, SonaAvatar3D.OVERRIDE_REPLACE = SONA_OVERRIDE_REPLACE, SonaAvatar3D.OVERRIDE_ADD = SONA_OVERRIDE_ADD, SonaAvatar3D.ROOT_MOTION_OFF = 0, SonaAvatar3D.ROOT_MOTION_EXTRACT = 1, SonaAvatar3D.ROOT_MOTION_APPLY = 2, SonaAvatar3D.LOD_FULL = SONA_LOD_FULL, SonaAvatar3D.LOD_SAMPLED = SONA_LOD_SAMPLED, SonaAvatar3D.LOD_QUARTER = SONA_LOD_QUARTER, SonaAvatar3D.LOD_SPRITE = SONA_LOD_SPRITE, SonaAvatar3D.CLIP_STARTED = 1, SonaAvatar3D.CLIP_LOOPED = 2, SonaAvatar3D.CLIP_ENDED = 3, SonaAvatar3D.CLIP_FOOT_LEFT = 4, SonaAvatar3D.CLIP_FOOT_RIGHT = 5, SonaAvatar3D.CLIP_MARK = 6, SonaAvatar3D.MOUTH_NEUTRAL = 0, SonaAvatar3D.MOUTH_O = 7, SonaAvatar3D.MOUTH_AI = 8, SonaAvatar3D.MOUTH_EE = 9, SonaAvatar3D.MOUTH_FV = 10, SonaAvatar3D.MOUTH_W = 11, SonaAvatar3D.MOUTH_L = 12, SonaAvatar3D.MOUTH_DTH = 13.

SonaCredit

Inherits CanvasLayer. The "Powered by 360sona" badge from sona_credit_get, on a CanvasLayer in a corner, shown at a set 75% opacity once an avatar is ready.

Property Type What it does
corner int (Bottom right, Bottom left, Top right, Top left) Where the badge sits. Set with set_corner, read with get_corner.
Method What it does
is_badge_visible() -> bool True while the badge shows (once an avatar is ready).
get_badge_alpha() -> float The badge's opacity now, 0 to 1.
get_badge_rect() -> Rect2 The badge's rectangle on screen, in pixels.

SonaCatalogue

Inherits RefCounted. The offline catalogue (sona-catalogue.bin): names, slots, games and sources of every item id, with no web call.

Method What it does
load(path: String) -> int Loads sona-catalogue.bin from a path (res:// works). Returns a result code (0 is OK).
load_bytes(bytes: PackedByteArray) -> int The same from bytes in memory.
unload() -> void Frees it and every string it handed out.
is_loaded() -> bool True once a catalogue is loaded.
get_count() -> int Items, sorted by id.
get_item(index: int) -> Dictionary One item.
find(id: String) -> int 32 hex digits, with or without dashes, braces or spaces, any case.
find_guid(guid: PackedByteArray) -> int The same from a parsed GUID.
search(query: Dictionary, max: int = 100) -> Dictionary Matching indexes in id order, up to max, after query.Offset; total is every match.
get_games() -> Array How many distinct games items come from.
get_generated() -> String When its data was made, ISO 8601.

Constants: SonaCatalogue.ITEM_OFFERED = SONA_ITEM_OFFERED, SonaCatalogue.ITEM_NAMED = SONA_ITEM_NAMED, SonaCatalogue.ITEM_STOCK = SONA_ITEM_STOCK, SonaCatalogue.ITEM_AWARD = SONA_ITEM_AWARD, SonaCatalogue.ITEM_MARKETPLACE = SONA_ITEM_MARKETPLACE, SonaCatalogue.ITEM_HIDDEN = SONA_ITEM_HIDDEN, SonaCatalogue.ITEM_NOT_PICKABLE = SONA_ITEM_NOT_PICKABLE, SonaCatalogue.ITEM_HAS_MODEL = SONA_ITEM_HAS_MODEL, SonaCatalogue.ITEM_GLB = SONA_ITEM_GLB, SonaCatalogue.ITEM_COLOURABLE = SONA_ITEM_COLOURABLE, SonaCatalogue.ITEM_COLOURWAYS = SONA_ITEM_COLOURWAYS, SonaCatalogue.ITEM_MULTI_SLOT = SONA_ITEM_MULTI_SLOT.

SonaEditorView

Inherits Control. The drop-in avatar editor (sona_editor) as a Control: the full creator, the quick creator or the wardrobe picker.

Property Type What it does
mode int (Full, Quick creator, Wardrobe picker) Full: Body, Appearance and Wardrobe, as 360sona.com's editor. Quick creator: eight looks, one change. Wardrobe picker: clothes only. Set with set_mode, read with get_mode.
garment_colours bool A worn garment's colourways over its Wardrobe category. Set with set_garment_colours, read with get_garment_colours.
light_theme bool The editor's light colours; off, the dark ones. Set with set_light_theme, read with get_light_theme.
thumbnails bool Rendered pictures in the look and item cells (a headless Vulkan device of the core); off: names only. Set with set_thumbnails, read with get_thumbnails.
no_cancel bool The player must finish: no Cancel. Set with set_no_cancel, read with get_no_cancel.
open_on_ready bool Open the editor when the node enters the tree. Set with set_open_on_ready, read with get_open_on_ready.
seed int The eight generated looks. Set with set_seed, read with get_seed.
title String The heading. Empty: "Create your avatar" or "Choose an outfit". Set with set_title, read with get_title.
start_manifest PackedByteArray The manifest the editor starts from (1,000 bytes); empty starts a new avatar. Set with set_start_manifest, read with get_start_manifest.
catalogue_path String The catalogue to read; empty takes SonaServer's. Set with set_catalogue_path, read with get_catalogue_path.
Method What it does
has_thumbnails() -> bool True while the cells show pictures (a headless device opened).
get_ui_image() -> Image The UI layer as last drawn (straight RGBA8, the editor's size).
set_catalogue(catalogue: SonaCatalogue) -> void Required: names, sections and what can be worn; must outlive the editor.
get_catalogue() -> SonaCatalogue Required: names, sections and what can be worn; must outlive the editor.
open() -> int size set, 1280 x 720 (sona_editor_resize changes it), seed 1, everything else zero.
close() -> void Closes the editor without a signal and removes its avatars.
is_open() -> bool True while the editor is open.
get_status() -> int SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned.
get_result() -> PackedByteArray The avatar as it stands (at any time): SONA_MANIFEST_BYTES.
get_screen() -> int The screen shown now.
set_screen(screen: int) -> int Moves to a screen of the mode (a deprecated id to the screen that took its place).
is_busy() -> bool True while an avatar is still building (the shown one or a change on its way); thumbnails do not count.
set_search(text: String) -> int The search box of the wardrobe and the item screens, for hosts with an on-screen keyboard.
button(pad: int, down: bool) -> void Input for hosts and tests: one gamepad button down or up, one key, a pointer.
press(pad: int) -> void A button pressed and let go, with an update between.
key(key: int, shift: bool = false, ctrl: bool = false) -> void A key pressed, with shift and ctrl (sona_editor_input).
pointer(at: Vector2, down: int, id: int = 0) -> void down: true pressed, false released, null moved.
get_controls() -> Array Every control on screen, in reading order, and the focused one.
get_focus() -> Dictionary SONA_E_NOT_FOUND when nothing has focus (pointer-only use).
get_avatar() -> SonaAvatar3D The SonaAvatar3D on the editor's stage, or null.
get_camera() -> Camera3D The camera in the editor's SubViewport.
get_ui_texture() -> ImageTexture The editor's UI as a texture.
step(dt: float) -> int One frame by hand (the node also does it in _process): dt seconds.
Signal When
finished(manifest: PackedByteArray) The player is done: the finished manifest.
cancelled() The player cancelled.
announced(text: String) What a screen reader should say now.

Constants: SonaEditorView.MODE_FULL = 0, SonaEditorView.MODE_QUICK = 1, SonaEditorView.MODE_WARDROBE = 2, SonaEditorView.STATUS_CLOSED = -1, SonaEditorView.STATUS_RUNNING = 0, SonaEditorView.STATUS_DONE = 1, SonaEditorView.STATUS_CANCELLED = 2, SonaEditorView.PAD_A = 0, SonaEditorView.PAD_B = 1, SonaEditorView.PAD_X = 2, SonaEditorView.PAD_Y = 3, SonaEditorView.PAD_LB = 4, SonaEditorView.PAD_RB = 5, SonaEditorView.PAD_LT = 6, SonaEditorView.PAD_RT = 7, SonaEditorView.PAD_UP = 8, SonaEditorView.PAD_DOWN = 9, SonaEditorView.PAD_LEFT = 10, SonaEditorView.PAD_RIGHT = 11, SonaEditorView.PAD_START = 12, SonaEditorView.PAD_BACK = 13.

SonaFilter

Inherits RefCounted. A content filter (sona_filter): which items a game allows. SonaServer.set_filter puts a copy on the ctx, so every avatar is filtered when it is read, and SonaCatalogue.search lists allowed items only.

Method What it does
create(catalogue: SonaCatalogue) -> int cat may be null: then only id, slot, section and source rules can match.
is_created() -> bool True once create() or a rules file made the filter.
reset() -> int Every rule goes; tags stay.
preset(which: int) -> int Adds a preset's rules (SONA_FILTER_PRESET_*).
sections(mode: int, bits: int) -> int Adds a rule on sections: bits (1u << sona_section).
slots(mode: int, bits: int) -> int Adds a rule on slots (AssetMask bits): an item matches when it covers any of them.
sources(mode: int, bits: int) -> int Adds a rule on where items come from (SONA_CONTENT_STOCK and the other source bits).
game(mode: int, name: String) -> int A game as sona_catalogue_game names it (ASCII case folded).
tag(mode: int, name: String) -> int A tag by name ("weapon", "logo", or one the host defined).
item(mode: int, id: String) -> int Adds a rule on one item by id.
load_json(json: String) -> int Rules from JSON (Content filters): {"preset": [...], "allow": {...}, "deny": {...}, "tags": {...}, "untag": {...}}.
load(path: String) -> int Rules from JSON (Content filters); all or nothing.
get_load_error() -> String Why load() or load_json() refused the rules, or empty.
tag_define(name: String) -> int 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.
tag_set(id: String, tag: String, on: bool = true) -> int Puts a tag on an item (on 1) or takes it off (0), for ids in the catalogue or not.
get_tags() -> PackedStringArray How many tags the filter knows, built-in and host-defined.
tag_items(tag: String) -> int How many catalogue items carry a tag.
allows(id: String) -> bool True when the item is allowed; a NULL filter allows everything.
check(id: String) -> Dictionary Whether the item is allowed, and if not, which rule denied it (SONA_CONTENT_BY_*) and the item's tags.
get_allowed_count() -> int Catalogue items allowed.
filter_manifest(bytes: PackedByteArray) -> Dictionary The 1000 manifest bytes through the filter, in place; the changes it made.

Constants: SonaFilter.ALLOW = SONA_CONTENT_ALLOW, SonaFilter.DENY = SONA_CONTENT_DENY, SonaFilter.PRESET_FAMILY = SONA_CONTENT_FAMILY, SonaFilter.PRESET_NO_LOGOS = SONA_CONTENT_NO_LOGOS, SonaFilter.PRESET_NO_LICENSED = SONA_CONTENT_NO_LICENSED, SonaFilter.SOURCE_STOCK = SONA_CONTENT_STOCK, SonaFilter.SOURCE_AWARD = SONA_CONTENT_AWARD, SonaFilter.SOURCE_MARKETPLACE = SONA_CONTENT_MARKETPLACE, SonaFilter.SOURCE_CUSTOM = SONA_CONTENT_CUSTOM, SonaFilter.SOURCE_UNLISTED = SONA_CONTENT_UNLISTED.

SonaSkeletonBridge

Inherits Node3D. The AnimationTree bridge: a Skeleton3D named as Godot's humanoid profile (SkeletonProfileHumanoid) over the parent SonaAvatar3D. FOLLOW poses the skeleton from the avatar every frame, so BoneAttachment3D, Godot's IK and physics can read it.

Property Type What it does
mode int (Follow, Drive) FOLLOW poses the skeleton from the avatar; DRIVE hands the skeleton's pose to the avatar. Set with set_mode, read with get_mode.
weight float (0, 1, 0.01) How much of the driven pose the avatar takes, 0 to 1. Set with set_weight, read with get_weight.
profile_rest bool Build the skeleton with SkeletonProfileHumanoid's rest axes, as Godot's retarget import makes clips. Set with set_profile_rest, read with get_profile_rest.
Method What it does
get_skeleton() -> Skeleton3D The Skeleton3D, or null before it is built.
is_built() -> bool True once the skeleton is built.
get_bone_joint(bone: int) -> int The avatar's joint for a bone of the skeleton, or -1.
get_joint_bone(joint: int) -> int The skeleton's bone for a joint of the avatar, or -1.
update_now() -> void One step now: build when the avatar is ready, then follow or drive. Runs by itself every frame.
Signal When
skeleton_built() The skeleton is built and named; attach things to it now.

Constants: SonaSkeletonBridge.MODE_FOLLOW = 0, SonaSkeletonBridge.MODE_DRIVE = 1.

This page as Markdown · All the docs as one file (llms-full.txt)