# Engine reference

Every public component, node, class and struct of the Unity package, the Godot extension and the Unreal plugin, read from their sources: its fields or properties with their types and defaults, its methods, events and signals, and what each does. The [C reference](../reference.md) has the calls they make; the tutorials for [Unity](../tutorials/unity.md), [Godot](../tutorials/godot.md) and [Unreal](../tutorials/unreal.md) put them to use.

## Unity

The package `com.360sona.renderer`, namespace `Sona.Unity`. Components are added from the 360sona menu; their fields are in the Inspector.

### SonaContext

A component. One 360sona context per scene.

| Field | Type | Default | What it does |
|---|---|---|---|
| `licence` | `TextAsset` | `null` | sona-licence.json from your download. |
| `appId` | `string` | `""` | Empty: the app id stamped into the library. |
| `dumpFolder` | `string` | `""` | An asset folder the user owns. Relative paths are under Application.persistentDataPath. Empty: none. |
| `consoleFolder` | `string` | `""` | An Xbox 360 Content root, or a PC copy of one. Empty: none. |
| `useGate` | `bool` | `true` | Read from 360sona over the network after the local sources. |
| `gateUrl` | `string` | `""` | Empty: https://360sona.com/g. |
| `workerThreads` | `int` | `-1` | -1: cores - 1 (default); 0: none, work runs inside sona_update. |
| `seed` | `uint` | `0` | 0: from the clock. |
| `faceSize` | `uint` | `0` | 0: auto (512, 256 or 128 by avatar count). |
| `maxAvatars` | `uint` | `256` | Default 256, at most 16384. |
| `buildBudgetMs` | `float` | `6` | Owner-thread loading work per sona_update (steps, commits; builds run on the workers); default 6. Avatars shown per update are also paced by the draw work they add. |
| `stillFaces` | `bool` | `false` | One face per avatar instead of faces that follow each clip's expressions. |
| `crowdLod` | `bool` | `false` | Pose far avatars less often (the core's crowd LOD steps). Sprites stay off: Unity draws the meshes itself. |
| `catalogue` | `TextAsset` | `null` | sona-catalogue.bin, renamed to .bytes so Unity imports it. Empty: no catalogue. |
| `viewCamera` | `Camera` | `null` | Empty: Camera.main. |
| `avatarShader` | `Shader` | `null` | Sona/Avatar. Reference it here so builds include it. |
| `logInfo` | `bool` | `false` | Write the core's information messages to the Unity log, not only its warnings and errors. |

| Member | What it does |
|---|---|
| `static SonaContext Current` | The SonaContext in the loaded scenes, or null. |
| `Core.SonaContext Native` | The C# binding's context, for a call the component does not wrap; null until it opens. |
| `Core.SonaCatalogue Catalogue` | The offline catalogue from the catalogue field; null when there is none. |
| `Core.SonaMaker Maker` | Random looks and outfit rules over the catalogue (SonaAvatar.randomSeed); null without a catalogue. |
| `void SetCatalogue(Core.SonaCatalogue cat)` | Uses a catalogue loaded elsewhere (a file the game downloads, or a test). |
| `float FirstReadyTime` | Time.realtimeSinceStartup when the first avatar became ready; negative before. |
| `event Action<Core.SonaResult, string> Error` | Event. Fires on an error of the context, with its result code and message. |
| `Core.SonaAvatar AddItemPreview(string itemId, Core.SonaPreviewOptions options = null)` | One item worn alone on a grey stand-in body, for wardrobes and pickers. This package does not draw previews: draw one with a Core.SonaRenderer (DrawPreview, SnapshotPreview), or read its pose. |
| `Core.Native.sona_lod_stats LodStats()` | The level-of-detail statistics: avatars in view at each step, those fading, the baked looks and the bakes of the last draw. |
| `static Core.SonaView ViewOf(Camera cam)` | A Unity camera as the core's view: eye, target, field of view, near, far and size. |

### SonaAvatar

A component. One avatar.

| Field | Type | Default | What it does |
|---|---|---|---|
| `manifestBase64` | `string` | `""` | An AvatarDescription (1000 bytes) as base64. |
| `manifestAsset` | `TextAsset` | `null` | The same as a file: 1000 raw bytes, or base64 text. Used when the field above is empty. |
| `clip` | `string` | `"idle"` | A clip key, a raw clip id, "prop", "idle" or "still". |
| `loop` | `bool` | `true` | Loop the clip. Used when the avatar is added and at each change of clip. |
| `speed` | `float` | `1` | Playback speed; 1 is the clip's own. |
| `startAt` | `float` | `0` | Seconds into the clip; negative: random, to desynchronise a crowd. |
| `priority` | `int` | `0` | Higher builds sooner. |
| `crossfadeSeconds` | `float` | `0` | Seconds to blend into the new clip when the clip field changes while it plays. 0: a cut. |
| `applyRootMotion` | `bool` | `false` | Move this Transform by the clip's travel; the hips stay where the clip starts. |
| `expressionMouth` | `int` | `-1` | A mouth shape held over the clip: 0-6 moods, 7-13 speech. -1: as the clip has it. |
| `expressionEyebrows` | `int` | `-1` | An eyebrow shape for both eyebrows. -1: as the clip has it. |
| `expressionEyes` | `int` | `-1` | An eye shape for both eyes. -1: as the clip has it. |
| `jointOverrides` | `JointOverride[]` | `new JointOverride[0]` | Joints turned after the clip: a joint name (Head, LeftUpperArm, ...) and Euler degrees. |
| `overrideWeight` | `float` | `1`, 0 to 1 | How much of each joint override to use, 0 to 1. |
| `overridesAdd` | `bool` | `false` | Turn on top of the clip's rotation instead of replacing it. |
| `marks` | `float[]` | `new float[0]` | Seconds into the clip that raise a Mark clip event (ids 1, 2, ...). |
| `randomSeed` | `uint` | `0` | No manifest: a random look from this seed (needs the catalogue on the SonaContext). 0: none. |
| `proceduralIdle` | `bool` | `false` | Breathing, blinks, glances and weight shifts on top of the clip. |
| `footIk` | `bool` | `false` | Plant the feet on the colliders under them (a ray down), else on this Transform's height. |
| `lookTarget` | `Transform` | `null` | The head and eyes turn to look at this. |
| `sway` | `bool` | `false` | Hair and loose clothes sway as the avatar moves. |
| `upperBodyClip` | `string` | `""` | A clip played on the upper body over the main clip (a wave while walking). Empty: none. |

| Member | What it does |
|---|---|
| `Core.SonaAvatar Native` | The C# binding's avatar under this component, for a call the component does not wrap; null until it is added. |
| `byte[] Manifest` | The manifest the avatar was added with (the random look when randomSeed made it). |
| `Core.SonaAvatarState State` | The avatar's state. |
| `event Action<SonaAvatar> Ready` | Event. Fires once when the avatar is built and on screen. |
| `event Action<SonaAvatar, Core.SonaResult, string> Failed` | Event. Fires when the avatar cannot be built, with the result code and the message. |
| `event Action<SonaAvatar, Core.SonaClipEvent> ClipEvent` | Event. Clip events (started, looped, ended, footfalls, marks), once a frame while the avatar is ready. |
| `void SetManifest(byte[] manifest)` | Wears another manifest: the avatar is added again with it, keeping its clip and settings. |
| `static Core.SonaPlacement PlacementOf(Transform t)` | A Transform's position, yaw and uniform scale as a core placement. |
| `void Play(string clipName, bool loopClip = true, float clipSpeed = 1, float from = 0)` | Plays a clip. Called before the avatar is ready, it is applied when the avatar appears. |
| `void Stop()` | Holds the current pose. |
| `void Crossfade(string clipName, float seconds, bool loopClip = true, float clipSpeed = 1, float from = 0)` | Play, blending from the current pose over seconds. |
| `void Queue(string clipName, float fadeSeconds = 0, bool loopClip = true, float clipSpeed = 1, float from = 0)` | Plays clipName when the current clip ends (queue after a clip that does not loop). |
| `int QueuedCount` | How many clips are waiting in the queue. |
| `void SetOverride(int joint, Quaternion rotation, float weight = 1, Core.SonaOverrideMode mode = Core.SonaOverrideMode.Replace)` | A rotation after the clip, in the core's joint space. joint: a number or SonaJoints.Find("Head"). |
| `void SetOverride(string joint, Quaternion rotation, float weight = 1, Core.SonaOverrideMode mode = Core.SonaOverrideMode.Replace)` | A unit quaternion applied after the clip. |
| `void ClearOverride(int joint)` | A rotation applied after the clip each frame, for look-at and aiming. |
| `void ClearOverrides()` | Clears every override of the avatar. |
| `void SetExpression(byte mouth, byte leftEyebrow = Core.SonaMouth.Clip, byte rightEyebrow = Core.SonaMouth.Clip, byte leftEye = Core.SonaMouth.Clip, byte rightEye = Core.SonaMouth.Clip)` | Shape indexes, or Core.SonaMouth.Clip to leave a part as the clip has it. Speech mouths are 7-13. |
| `void ClearExpression()` | Hands the whole face back to the clip. |
| `void Mark(float seconds, uint id)` | A Mark event with this id each time the current clip passes seconds; marks go when another clip starts. |
| `void ClearMarks()` | Removes the avatar's marks. |
| `bool TryGetJointPosition(int joint, out Vector3 position)` | A joint's world position at the last update, by number or by name ("Head"); false before the avatar is ready and posed. |
| `bool TryGetJointPosition(string joint, out Vector3 position)` | A joint's world position at the last update, by number or by name ("Head"); false before the avatar is ready and posed. |
| `bool TryGetJointWorld(int joint, float[] out16)` | The row-vector world matrix, 16 floats. |
| `bool TryGetCapsule(out Vector3 bottom, out Vector3 top, out float radius)` | A vertical capsule around the posed body, for collisions. |
| `Core.SonaLodStep LodStep` | The level of detail it was drawn at last (sona_avatar_lod). |
| `void RefreshFeatures()` | Applies the 1.2 fields again (call after changing them from code). |

### SonaAvatar.JointOverride

A struct. One entry of jointOverrides.

| Field | Type | Default | What it does |
|---|---|---|---|
| `joint` | `string` | `""` | A joint name: Head, Neck, LeftUpperArm, ... |
| `rotation` | `Vector3` | `Vector3.zero` | Euler degrees, turned after the clip. |

### SonaCredit

A component. The small "Powered by 360sona" badge from sona_credit_get as a screen-space overlay, on by default.

| Field | Type | Default | What it does |
|---|---|---|---|
| `Text` | `string` | `"Powered by 360sona"` | The badge's words. |
| `Opacity` | `float` | `0.75` | The badge's opacity once an avatar is ready. |
| `Margin` | `int` | `6` | Pixels between the badge and the screen's edges. |
| `showBadge` | `bool` | `true` | Off: credit 360sona in your credits screen, about page or store page instead (the SDK Licence). |
| `corner` | `Core.SonaCorner` | `Core.SonaCorner.BottomRight` | Where the badge sits. |

| Member | What it does |
|---|---|
| `static float AlphaAt(float secondsSinceFirstReady)` | The badge's opacity a given number of seconds after the first avatar was ready; a negative time (no avatar ready) gives 0. |
| `static Rect Place(Core.SonaCorner c, float screenW, float screenH, float w, float h)` | The badge rectangle in GUI coordinates (top-left origin) for a screen of the given size. |

### SonaAnimatorBridge

A component. The Mecanim bridge.

| Field | Type | Default | What it does |
|---|---|---|---|
| `mode` | `BridgeMode` | `BridgeMode.Drive` | Drive: the Animator poses the avatar. Follow: the rig follows the avatar's clip. |
| `controller` | `RuntimeAnimatorController` | `null` | The Animator Controller with your humanoid clips (Drive). |

| Member | What it does |
|---|---|
| `Transform Rig` | The Humanoid rig's root Transform, built under the avatar once it is ready. |
| `Animator Animator` | The Animator on the rig, holding the controller. |
| `Avatar HumanAvatar` | The Humanoid Avatar built for the rig. |
| `bool IsBuilt` | True once the rig, its Avatar and the Animator are built. |
| `event Action<SonaAnimatorBridge> Built` | Event. Fires once the rig and its Avatar are built (the avatar is ready and posed). |
| `Transform Bone(string humanBodyBone)` | The rig's Transform for a HumanBodyBones name ("LeftHand"), or null before the rig is built. |
| `void Step()` | One step now: build once the avatar is ready, then follow or drive. LateUpdate calls it. |

### SonaAnimatorBridge.BridgeMode

An enum. Which way the pose goes between the Animator and the avatar.

Values: `Follow`, `Drive`.

### SonaAvatarEditor

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

| Field | Type | Default | What it does |
|---|---|---|---|
| `mode` | `EditorMode` | `EditorMode.Full` | Full: Body, Appearance and Wardrobe, as 360sona.com's editor. Quick creator: eight looks, one change. Wardrobe picker: clothes only. |
| `target` | `SonaAvatar` | `null` | The avatar it edits, which wears the result. Empty: start from a blank figure (the wardrobe picker needs one). |
| `garmentColours` | `bool` | `true` | A worn garment's colourways over its Wardrobe category. |
| `lightTheme` | `bool` | `true` | The editor's light colours; off, the dark ones. |
| `thumbnails` | `bool` | `true` | Rendered pictures in the look and item cells (a headless Vulkan device of the core). Off: names only. |
| `noCancel` | `bool` | `false` | The player must finish: no Cancel. |
| `openOnStart` | `bool` | `false` | Open the editor when the scene starts. |
| `seed` | `uint` | `1` | The eight generated looks. |
| `title` | `string` | `""` | The heading. Empty: "Create your avatar" or "Choose an outfit". |
| `stageLayer` | `int` | `31` | The layer the editor's avatar and camera use; keep it out of your cameras' culling masks. |
| `stage` | `Vector3` | `new Vector3(0, -1000, 0)` | Where the editor's avatar stands, away from the game. |

| Member | What it does |
|---|---|
| `event Action<byte[]> Finished` | Event. Fires with the finished manifest (1,000 bytes) when the player is done; the target wears it. |
| `event Action Cancelled` | Event. Fires when the player cancels; nothing changes. |
| `event Action<string> Announced` | Event. What a screen reader should say (pass it to your accessibility layer). |
| `event Action<uint> Sound` | Event. A sound to play: SONA_EDITOR_SOUND_* (move 1, select 2, back 3, tab 4, page 5, done 6, cancel 7, error 8, random 9). |
| `bool IsOpen` | True while the editor is open. |
| `Core.SonaEditorStatus Status` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned. |
| `bool Busy` | True while an avatar is still building (the shown one or a change on its way); thumbnails do not count. |
| `Core.SonaEditorScreen Screen` | The screen shown now. |
| `SonaAvatar ShownAvatar` | The avatar on the editor's stage, or null while none is shown. |
| `Camera StageCamera` | The camera that draws the editor's stage. |
| `Texture2D UiTexture` | The editor's UI as a texture, drawn over the screen. |
| `byte[] UiPixels` | The UI layer as last drawn: straight RGBA8, UiWidth x UiHeight, row 0 at the top. |
| `int UiWidth` | The UI texture's width in pixels. |
| `int UiHeight` | The UI texture's height in pixels. |
| `bool HasThumbnails` | True while open with cell pictures (a headless device opened, or will once the shading data is in). |
| `bool Open()` | Opens the editor; false (with the reason in the log) when the context or its catalogue is missing. |
| `void Close()` | Closes the editor without an event and removes its avatars. |
| `void Button(Pad b, bool down)` | A gamepad button pressed or let go (sona_editor_input). |
| `void Press(Pad b)` | A button pressed and let go, with an update between. |
| `void Key(Core.SonaEditorKey k, bool shift = false, bool ctrl = false)` | A key pressed, with shift and ctrl (sona_editor_input). |
| `void Axis(Core.SonaEditorAxis a, float v)` | A gamepad axis moved, -1 to 1 (sona_editor_input). |
| `void Pointer(Vector2 at, bool? down, uint id = 0)` | A pointer in editor pixels (top-left origin). down: true pressed, false released, null moved. |
| `bool SetScreen(Core.SonaEditorScreen s)` | Moves to a screen of the mode (a deprecated id to the screen that took its place). |
| `byte[] Result()` | The avatar as it stands (at any time): SONA_MANIFEST_BYTES. |
| `List<Core.SonaEditorControl> Controls()` | Every control on screen for a screen reader: label, role, value and whether it has focus. |
| `Core.SonaEditorStatus Step(float dt)` | One frame of the editor: dt seconds, then the avatar, the camera and the UI layer. |

### SonaAvatarEditor.EditorMode

An enum. The editor's three screens.

Values: `Full`, `QuickCreator`, `WardrobePicker`.

### SonaAvatarEditor.Pad

An enum. The gamepad buttons Button and Press take.

Values: `A`, `B`, `X`, `Y`, `LB`, `RB`, `LT`, `RT`, `Up`, `Down`, `Left`, `Right`, `Start`, `Back`.

### SonaHumanoid

A class. The avatar rig under Unity Humanoid names, and the maths SonaAnimatorBridge uses.

| Member | What it does |
|---|---|
| `static int JointParent(int joint)` | The rig's parent of a joint (from sona_mask_branch), -1 for the hips. |
| `static string HumanName(string bone)` | "Left Thumb Proximal" for "LeftThumbProximal"; the body bones keep their names. |
| `static IReadOnlyList<Bone> Bones` | Every joint with a Unity Humanoid bone, parents first. |
| `static Quaternion RotationOf(float[] m)` | The rotation of a row-vector matrix (the core's, 16 floats), scale taken off. |
| `static Vector3 PositionOf(float[] m)` | The position of a row-vector matrix (16 floats). |
| `static Quaternion Normalize(Quaternion q)` | The quaternion at length 1. |
| `static Quaternion ToRig(Quaternion q)` | A rotation or position from the avatar's axes to the Humanoid rig's (turned 180 degrees about Y). |
| `static Quaternion FromRig(Quaternion q)` | A rotation or position from the Humanoid rig's axes to the avatar's. |
| `static Vector3 ToRig(Vector3 p)` | A rotation or position from the avatar's axes to the Humanoid rig's (turned 180 degrees about Y). |
| `static Vector3 FromRig(Vector3 p)` | A rotation or position from the Humanoid rig's axes to the avatar's. |

### SonaHumanoid.Bone

A class. One joint of the rig with its Humanoid bone.

| Field | Type | Default | What it does |
|---|---|---|---|
| `Joint` | `int` | `0` | The core's joint number. |
| `Parent` | `int` | `0` | index into Bones, -1 for the hips. |
| `Name` | `string` | `""` | HumanBodyBones name: "LeftUpperArm", "LeftThumbProximal". |
| `HumanName` | `string` | `""` | HumanTrait name: "LeftUpperArm", "Left Thumb Proximal". |

### SonaMeshBuilder

A class. The data API's meshes, textures and materials as Unity objects.

| Field | Type | Default | What it does |
|---|---|---|---|
| `Stride` | `int` | `76` | Bytes in one runtime vertex. |
| `ColorTexId` | `int` | `Shader.PropertyToID("_ColorTex")` | The shader property id of the colour texture. |
| `IntensityTexId` | `int` | `Shader.PropertyToID("_IntensityTex")` | The shader property id of the intensity texture. |
| `DecalTexId` | `int` | `Shader.PropertyToID("_DecalTex")` | The shader property id of the decal texture (the matcap of a reflective material). |
| `RimId` | `int` | `Shader.PropertyToID("_SonaRim")` | The shader property id of the rim colour and power. |
| `TransparencyId` | `int` | `Shader.PropertyToID("_SonaTransparency")` | The shader property id of the transparency. |
| `SkinId` | `int` | `Shader.PropertyToID("_SonaSkin")` | The shader property id of the skin flag. |
| `ReflectiveId` | `int` | `Shader.PropertyToID("_SonaReflective")` | The shader property id of the reflective flag. |
| `PaletteId` | `int` | `Shader.PropertyToID("_SonaPalette")` | The shader property id of the joint palette buffer. |
| `IrradianceId` | `int` | `Shader.PropertyToID("_SonaIrradiance")` | The shader property id of the environment's irradiance. |
| `IrradianceGainId` | `int` | `Shader.PropertyToID("_SonaIrradianceGain")` | The shader property id of the irradiance gain. |

| Member | What it does |
|---|---|
| `static VertexAttributeDescriptor[] Layout` | The Unity vertex layout (a copy). |
| `static unsafe void Repack(byte* src, byte* dst, int count)` | Copies count vertices from the runtime layout into Unity's attribute order. |
| `static unsafe void Repack(ReadOnlySpan<byte> src, Span<byte> dst, int count)` | Copies count vertices from the runtime layout into Unity's attribute order. |
| `static Bounds SkinnedBounds` | Avatar-space bounds wide enough for any clip: the shader moves vertices away from the bind pose. |
| `static unsafe Mesh BuildMesh(in SonaMeshData m, ref byte[] scratch)` | A Unity Mesh from a mesh of the data API; scratch is reused between calls. |
| `static Texture2D BuildTexture(in SonaTextureData t, int addr)` | RGBA32 sRGB. Row 0 of the data lands at v = 0, as on the web. |
| `static void UpdateTexture(Texture2D tex, in SonaTextureData t)` | Uploads a texture's pixels from the data API again. |
| `static Texture2D Solid(byte r, byte g, byte b, byte a)` | A 1 x 1 texture of one colour, for a material that has no texture. |
| `static Cubemap BuildIrradiance(SonaShadingData s)` | The 16x16 RGBA16F irradiance cube, faces +X -X +Y -Y +Z -Z (Unity's CubemapFace order). |
| `static Texture2D BuildBadge(SonaCreditImage c)` | Our credit badge (straight RGBA, row 0 at the top) flipped into Unity's bottom-up rows. |
| `static Material BuildMaterial(Shader shader, in SonaMaterialData m, Texture color, Texture intensity, Texture decal, int order)` | One material per draw: the program (skin, reflective), RimLightColorAndReflectivity (params 36..39), transparency and the web's two pass states. order keeps the web's list order inside a pass. |
| `static void UploadPalette(GraphicsBuffer buffer, IntPtr palette, float[] staging)` | Copies 864 palette floats from the core into a staging array, then into the GPU buffer. |
| `static GraphicsBuffer NewPaletteBuffer()` | A GraphicsBuffer for one avatar's joint palette (216 float4: 72 joints, three rows each). |

## 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](../guides/filters.md)): {"preset": [...], "allow": {...}, "deny": {...}, "tags": {...}, "untag": {...}}. |
| `load(path: String) -> int` | Rules from JSON ([Content filters](../guides/filters.md)); 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.

## Unreal

The plugin `Sona360` for Unreal Engine 5. Everything below is reachable from Blueprints; C++ calls the same functions.

### USonaAvatarComponent

A `USceneComponent`. One 360sona avatar. It faces the component's +X; its placement is the component's transform.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Manifest` | `FString` | `""` | The avatar's manifest (AvatarDescription) as base64, at most 4096 characters, as the web's add() takes. Read only. |
| `Clip` | `FString` | `TEXT("idle")` | A clip key ("GenericWave"), a raw clip id, "prop", "idle" or "still". Read only. |
| `bLoop` | `bool` | `true` | Default 1. Read only. |
| `Speed` | `float` | `1.0f` | Default 1. Read only. |
| `StartAt` | `float` | `0.0f` | Seconds into the clip at the start; negative picks a random time, to desynchronise a crowd. Read only. |
| `Priority` | `int32` | `0` | Higher builds sooner. Read only. |
| `bCastShadow` | `bool` | `true` | The avatar's meshes cast shadows. Read only. |
| `OnReady` | `FSonaAvatarReady` | (an event) | Fires once when the avatar is built and on screen. |
| `OnFailed` | `FSonaAvatarFailed` | (an event) | Fires when the avatar cannot be built, with the result code and the message. |
| `PreviewItem` | `FString` | `""` | An item id: the component shows that item alone on a grey stand-in body instead of Manifest. Read only. |
| `PreviewOptions` | `FSonaPreviewOptions` | (its own defaults) | The options of an item preview (SetPreviewItem). Read only. |
| `OnClipEvent` | `FSonaClipEventDelegate` | (an event) | Clip events as they happen, when bound. Unbound, they wait for TakeClipEvents. |

| Function | What it does |
|---|---|
| `void SetPreviewItem(const FString& ItemId, const FSonaPreviewOptions& Options)` | Replaces the avatar with a preview of one item; the old one is removed. |
| `bool GetPreviewBounds(FBox& OutBox)` | The previewed item's box in the world. False before ready or for an avatar that is not a preview. |
| `bool GetPreviewView(int32 Width, int32 Height, FVector& OutEye, FVector& OutTarget, float& OutVerticalFovDeg)` | The framed camera for a Width x Height picture: eye, target and the vertical field of view. |
| `static int32 FindJoint(const FString& Name)` | A joint by name ("Hips", "Head", "PropRight", "shape_04", "joint_33"); -1 when unknown. Pure. |
| `static FString GetJointName(int32 Joint)` | The name of joints 0 to 70: the humanoid name, or shape_NN. Pure. |
| `bool GetJointTransform(int32 Joint, FTransform& OutTransform) const` | A joint's world transform at the last tick. False before the avatar is ready and posed. |
| `bool SetJointOverride(int32 Joint, FRotator Rotation, float Weight = 1.0f, ESonaOverrideMode Mode = ESonaOverrideMode::Replace)` | A rotation applied after the clip each tick, in the joint's own space (Unreal axes); Weight 0 to 1 blends from the clip. False before the avatar is ready. |
| `bool ClearJointOverride(int32 Joint)` | A rotation applied after the clip each frame, for look-at and aiming. |
| `void ClearOverrides()` | Clears every override of the avatar. |
| `bool Crossfade(const FString& InClip, float Seconds = 0.25f, bool bInLoop = true, float InSpeed = 1.0f, float From = 0.0f)` | Play, blending from the current pose over Seconds. Clears the queue. |
| `bool QueueClip(const FString& InClip, float FadeSeconds = 0.0f, bool bInLoop = false, float InSpeed = 1.0f, float From = 0.0f)` | Plays InClip when the current one ends (queue after a clip that does not loop). At most 8. |
| `int32 GetQueued() const` | How many clips are waiting in the queue. Pure. |
| `bool GetFilterReport(int32& OutCount, TArray<FSonaContentChange>& OutChanges) const` | What the context's content filter changed on this avatar. False before it is read, or when no filter was set then. |
| `bool GetCapsule(FVector& OutA, FVector& OutB, float& OutRadius) const` | A vertical capsule around the posed body, in the world: the segment A..B and its radius (centimetres). |
| `bool SetExpression(int32 Mouth = 255, int32 LeftEyebrow = 255, int32 RightEyebrow = 255, int32 LeftEye = 255, int32 RightEye = 255)` | Shape indexes; 255 leaves that part to the clip. Mouth 7-13 are speech shapes (O, AI, EE, FV, W, L, DTH). |
| `bool ClearExpression()` | Hands the whole face back to the clip. |
| `bool GetExpressionCounts(int32& OutMouths, int32& OutEyebrows, int32& OutEyes) const` | How many shapes this face has: counts[0] mouth, counts[1] eyebrows, counts[2] eyes. |
| `TArray<FSonaClipEvent> TakeClipEvents()` | What happened on the clip since the last call, oldest first. |
| `bool AddMark(float Seconds, int32 Id)` | A Mark event with this id each time the current clip passes Seconds. At most 16; gone when another clip starts. |
| `void ClearMarks()` | Removes the avatar's marks. |
| `bool SetRootMotion(ESonaRootMotion Mode)` | What happens to the clip's sideways travel of the hips. |
| `FVector TakeRootMotion()` | The travel collected since the last call (Extract), in centimetres. Zero with Apply. |
| `ESonaLod GetLod(float& OutFade) const` | The level-of-detail step at the last tick, and in OutFade how far from mesh (0) to sprite (1). Pure. |
| `bool SetLimbTarget(ESonaLimb Limb, FVector Location, float Weight = 1.0f, bool bUsePole = false, FVector Pole = FVector::ZeroVector, bool bWrist = false, float FadeSeconds = 0.2f)` | Two-bone IK: a hand's palm (bWrist: the wrist joint) or a foot's ankle at Location (world). The elbow or knee bends towards Pole when bUsePole, else as the clip bends it. Call each tick for a moving target. |
| `bool ClearLimbTarget(ESonaLimb Limb)` | Hands the limb back to the clip at once. |
| `bool SetFeetPlanting(bool bEnable, float GroundZ = 0.0f, float Weight = 1.0f)` | Feet planted on a flat ground at height GroundZ (world); the hips lower or rise so both reach. |
| `bool SetLookAt(FVector Target, float Weight = 1.0f)` | The head (and eyes) turn towards Target within the core's limits. |
| `bool ClearLookAt()` | Turns the chest, neck and head towards the world point target inside the limits, eased; the eyes take the rest through the face's look shapes when it has them. |
| `void ClearIK()` | Every target, planting and look-at off at once. |
| `static int32 GetJointParent(int32 Joint)` | The joint above Joint in the rig (Hips is the root: -1). Pure. |
| `static int32 GetJointCount()` | Joints in the rig (71). Pure. |
| `FString GetManifest() const` | The avatar's manifest as it was given (base64), or empty for an item preview. Pure. |
| `void GetDrawnCounts(int32& OutSections, int32& OutVertices) const` | Mesh sections and vertices drawn at the last pose. Pure. |
| `TArray<FString> GetDrawnItems() const` | The items whose meshes were built (ids as the manifest's GUIDs, 8-4-4-4-12). An item whose file is missing from every source draws nothing and is not listed. Pure. |
| `void SetManifest(const FString& Base64)` | Replaces the avatar; the old one is removed. |
| `bool Play(const FString& InClip, bool bInLoop = true, float InSpeed = 1.0f, float From = 0.0f)` | Plays a clip. |
| `void Stop()` | Holds the current pose. |
| `ESonaAvatarState GetState() const` | The avatar's state. Pure. |
| `bool IsReady() const` | True once the avatar is built and on screen. Pure. |

### USonaSubsystem

A `UGameInstanceSubsystem`. Owns the 360sona context for a game instance and ticks it with the player camera's view.

| Property | Type | Default | What it does |
|---|---|---|---|
| `OnError` | `FSonaErrorEvent` | (an event) | Context-wide errors: licence, app, platform, build, limit, gate. |

| Function | What it does |
|---|---|
| `bool IsOpen() const` | True once the context is open. Pure. |
| `FString GetLastError() const` | The context's last error message, or empty. Pure. |
| `TArray<FString> GetClipKeys() const` | Clip keys usable with USonaAvatarComponent::Play, plus "idle", "still" and "prop". |
| `bool SetLod(const FSonaLodOptions& Options)` | Sets the level-of-detail options, from the next tick. A context opens with every avatar in view posed every frame. |
| `bool GetLod(FSonaLodOptions& OutOptions) const` | Copies the current options: before any sona_lod_set, thresholds 120 and 40 and no sprites (sprite_px 0). |
| `FSonaLodStats GetLodStats() const` | The level-of-detail counts at the last tick. |
| `bool SetContentFilter(USonaFilter* Filter, USonaCatalogue* Catalogue = nullptr)` | A copy of Filter goes on the context: every avatar read from then on is filtered (USonaAvatarComponent:: GetFilterReport says what changed). Catalogue, when given, lists through Filter too. Null takes it away. |

### USonaSettings

A `UDeveloperSettings`. The plugin's project settings (Project Settings, 360sona).

| Property | Type | Default | What it does |
|---|---|---|---|
| `LicenceFile` | `FString` | `TEXT("Sona360/sona-licence.json")` | sona-licence.json from your download. Relative paths are taken from the project's Content folder; add that folder to "Additional Non-Asset Directories to Package". |
| `Sources` | `TArray<FSonaSourceSetting>` | empty | Asked in order; the first that has an asset wins. At most 4. Empty: the gate alone. |
| `AppId` | `FString` | `""` | Your app's id from 360sona.com/devs. Empty: the id stamped into the library you downloaded. |
| `CheckHost` | `FString` | `""` | Empty: the devs site, https://test.360sona.com. |
| `WorkerThreads` | `int32` | `-1` | -1: cores - 1. 0: no worker threads; work runs inside the tick. |
| `MaxAvatars` | `int32` | `256` | Default 256, at most 16384. |
| `BuildBudgetMs` | `float` | `6.0f` | Owner-thread loading work per sona_update (steps, commits; builds run on the workers); default 6. Avatars shown per update are also paced by the draw work they add. |
| `FaceSize` | `int32` | `0` | 0: auto. Otherwise 128, 256 or 512. |
| `bStillFaces` | `bool` | `false` | One face per avatar instead of faces that follow each clip's expressions. |
| `bAppBehaviour` | `bool` | `false` | The app-faithful idle player with crossfades instead of the web SDK's idle chooser. |
| `Seed` | `int32` | `0` | 0: from the clock. Fix it for repeatable idles. |
| `bShowCredit` | `bool` | `true` | The SDK Licence asks for a small "Powered by 360sona" badge (linking to https://360sona.com). Off is allowed: credit 360sona in your credits screen, about page or store page instead. |
| `CreditCorner` | `ESonaCreditCorner` | `ESonaCreditCorner::BottomRight` | Where the "Powered by 360sona" badge sits. |
| `Material` | `TSoftObjectPtr<UMaterialInterface>` | null | The avatars' material; the plugin ships M_SonaAvatar. Empty: plain vertex colours. The plugin sets its parameters per material: SonaColor, SonaIntensity and SonaDecal (textures on UV channels 0, 1 and 2), SonaRimReflectivity, SonaTransparency, SonaReflective, SonaSkin and SonaShaderId; a material of your own needs the same parameters. |
| `TranslucentMaterial` | `TSoftObjectPtr<UMaterialInterface>` | null | The material for the avatars' see-through parts; the plugin ships M_SonaAvatarTranslucent, with the same parameters. |
| `bReverseWinding` | `bool` | `false` | On Unreal Engine 5.8.4 with Vulkan the plaza starter needs this on, or the avatars draw inside out (black when lit from the front); the default is left off until the other projects are checked with it. |

### ESonaAvatarState

A Blueprint enum. Where an avatar is in its life.

Values: `None`, `Queued`, `Loading`, `Ready`, `Failed`, `Removed`.

### ESonaOverrideMode

A Blueprint enum. How a joint override turns its joint.

| Value | Meaning |
|---|---|
| `Replace` | The joint's rotation from its rest orientation. |
| `Add` | Rotated on top of the clip's. |

### ESonaRootMotion

A Blueprint enum. What happens to the clip's travel.

| Value | Meaning |
|---|---|
| `Off` | The clip's travel stays in the pose: the hips move away from the actor as the clip moves them. |
| `Extract` | The core holds the hips where the clip starts; TakeRootMotion hands you the travel. |
| `Apply` | The component moves by the travel each tick. |

### ESonaLimb

A Blueprint enum. sona_avatar_ik_target's limbs.

Values: `LeftHand`, `RightHand`, `LeftFoot`, `RightFoot`.

### ESonaLod

A Blueprint enum. The level-of-detail steps: posed every tick, posed less often, posed a quarter as often, a sprite.

Values: `Full`, `Sampled`, `Quarter`, `Sprite`.

### ESonaClipEventKind

A Blueprint enum. What a clip event reports.

Values: `None`, `Started`, `Looped`, `Ended`, `FootLeft`, `FootRight`, `Mark`.

### FSonaClipEvent

A Blueprint struct. One clip event, as OnClipEvent reports it.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Kind` | `ESonaClipEventKind` | `ESonaClipEventKind::None` | What happened. |
| `Mark` | `int32` | `0` | The mark's id for Mark events. |
| `Clip` | `int32` | `-1` | The clip's index in USonaSubsystem::GetClipKeys order; -1 for a prop or raw clip. |
| `Time` | `float` | `0.0f` | Seconds into the clip. |

### FSonaPreviewOptions

A Blueprint struct. sona_preview_options. Zero fields take the core's defaults.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Gender` | `int32` | `0` | 1 male, 2 female; 0: the body the item was made for. |
| `Slot` | `int32` | `0` | The category mask to frame by (0x40 hat, ...); 0: from the item. |
| `bUseColours` | `bool` | `false` | Wear the colours below instead of the item's own. |
| `Colours` | `TArray<FColor>` | empty | 0xAARRGGBB primary, secondary, tertiary, with SONA_PREVIEW_COLOURS. |
| `Skin` | `FColor` | `FColor(0, 0, 0, 0)` | The stand-in's skin; transparent: the core's grey. |
| `Time` | `float` | `-1.0f` | Props: seconds into the clip to hold; negative: its fullest frame. |
| `Margin` | `float` | `0.0f` | Room around the item; 0: the core's 1.36. |

### FSonaItemInfo

A Blueprint struct. One item of the offline catalogue. Flags are the SONA_ITEM_* bits: 1 offered, 2 named, 4 stock, 8 award, 16 marketplace, 32 hidden, 64 not pickable, 128 has a model, 256 a glTF exists, 512 colourable, 1024 colourways, 2048 more than one slot.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Id` | `FString` | `""` | Lowercase text form. Read only. |
| `Guid` | `TArray<uint8>` | empty | Wire byte order, as a manifest stores it. Read only. |
| `Name` | `FString` | `""` | The item's name. Read only. |
| `Game` | `FString` | `""` | The game or source it comes from. Read only. |
| `Type` | `FString` | `""` | "Shirt/Hoodie". Read only. |
| `Family` | `FString` | `""` | "Shirt". Read only. |
| `Description` | `FString` | `""` | How an award is earned. Read only. |
| `Section` | `FString` | `""` | "shirt", "facialHair", ... Read only. |
| `SectionIndex` | `int32` | `0` | The editor section the item is offered in, by number (USonaCatalogue::GetSectionName names it). Read only. |
| `Kind` | `int32` | `0` | 1 model, 2 texture, 3 shape override, 4 animation; 0 unknown. Read only. |
| `Gender` | `int32` | `0` | 1 male, 2 female, 3 both, 0 not stated. Read only. |
| `Mask` | `int64` | `0` | The AssetMask slot bits. Read only. |
| `Flags` | `int64` | `0` | SONA_ITEM_*. Read only. |
| `ColourSet` | `int32` | `0` | The palette it tints from; 0 when not SONA_ITEM_COLOURABLE. Read only. |
| `ColourChoices` | `int32` | `0` | Colourways in its own colour table; 0 when not stated. Read only. |

### FSonaCatalogueQuery

A Blueprint struct. What USonaCatalogue::Search matches. Empty fields match anything.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Text` | `FString` | `""` | Words that must all be in the name, game or type; "in quotes" matches the whole name. |
| `Game` | `FString` | `""` | That game only (ASCII case folded); NULL: any. |
| `Slots` | `int64` | `0` | AssetMask bits: items with any of them; 0: any. |
| `Section` | `int32` | `0` | Sona_section; 0: any. |
| `Gender` | `int32` | `0` | 1 or 2: what the editor offers that body. |
| `Require` | `int64` | `0` | SONA_ITEM_* that must all be set. |
| `Exclude` | `int64` | `0` | SONA_ITEM_* that must all be clear. |
| `Offset` | `int32` | `0` | Skip this many matches, for paging. |

### USonaCatalogue

A `UObject`. The offline catalogue (sona-catalogue.bin from the download): names, slots, games and sources of every item id, with no web call. It never changes once loaded.

| Function | What it does |
|---|---|
| `static USonaCatalogue* LoadCatalogue(const FString& Path)` | Relative paths are taken from the project's Content folder. Null when the file is missing or bad. |
| `int32 Num() const` | Items, sorted by id. Pure. |
| `bool GetItem(int32 Index, FSonaItemInfo& OutItem) const` | One item. |
| `int32 Find(const FString& Id) const` | The index of an item id (any case, dashes or not), or -1. Pure. |
| `int32 FindGuid(const TArray<uint8>& Guid) const` | The same by the 16 wire-order bytes of an item's guid (FSonaItemInfo::Guid). Pure. |
| `TArray<int32> Search(const FSonaCatalogueQuery& Query, int32 Max, int32& OutTotal) const` | Up to Max matching indexes in id order, after Query.Offset; OutTotal counts every match. With a content filter (SetFilter, or USonaSubsystem::SetContentFilter) only allowed items match. |
| `void GetGames(TArray<FString>& OutNames, TArray<int32>& OutItems) const` | The games items come from, sorted by name, with their item counts. |
| `FString GetGenerated() const` | When its data was made, ISO 8601. Pure. |
| `static FString SectionName(int32 Section)` | A sona_section as the editor spells it; NULL past the last. Pure. |
| `void SetFilter(USonaFilter* InFilter)` | The content filter Search lists through; null lists every item. |
| `USonaFilter* GetFilter() const` | The content filter on this catalogue, or none. Pure. |

### ESonaEditorMode

A Blueprint enum. The editor's three screens: the full creator, the quick creator and the wardrobe picker.

| Value | Meaning |
|---|---|
| `Full` | 360sona.com's editor: Body, Appearance and Wardrobe. |
| `Quick` | Eight generated looks, one screen of quick changes, done. |
| `Wardrobe` | The clothes only, on the start manifest. |

### ESonaEditorStatus

A Blueprint enum. Where an editor session is.

Values: `Closed`, `Running`, `Done`, `Cancelled`.

### ESonaEditorScreen

A Blueprint enum. A screen of the editor. Full: Body, Appearance, Wardrobe.

| Value | Meaning |
|---|---|
| `Looks` | The quick creator's eight generated looks. |
| `Body` | The body card: the two figures, the build triangle, height, weight and the skin. |
| `Face` | Deprecated in 1.1, kept until 2.0: use Appearance. |
| `Hair` | Deprecated in 1.1, kept until 2.0: use Appearance (it opens on Hair). |
| `Colours` | Deprecated in 1.1, kept until 2.0: use Body (the Wardrobe in the wardrobe picker). |
| `Wardrobe` | The clothes, in the site's order. |
| `Quick` | The quick creator's four quick changes. |
| `Appearance` | Hair and the face, each part with its colour. |

### FSonaEditorControl

A Blueprint struct. One control on screen, as a screen reader gets it (sona_editor_control).

| Property | Type | Default | What it does |
|---|---|---|---|
| `Id` | `int32` | `0` | Stable while the control exists. Read only. |
| `Role` | `int32` | `0` | SONA_EDITOR_ROLE_*: 1 button, 2 tab, 3 list item, 4 option (a look, an item or a colour), 5 slider, 6 spin, 7 search. Read only. |
| `bFocused` | `bool` | `false` | The control has the focus. Read only. |
| `bSelected` | `bool` | `false` | The control is the one picked (a worn item, the current tab). Read only. |
| `bDisabled` | `bool` | `false` | The control cannot be used now. Read only. |
| `Rect` | `FVector4` | `FVector4(0, 0, 0, 0)` | Pixels of the editor's picture: X, Y, width, height from the top left. Read only. |
| `Index` | `int32` | `0` | "index + 1 of count" in its group (0, 0 when none) Read only. |
| `Count` | `int32` | `0` | "index + 1 of count" in its group (0, 0 when none) Read only. |
| `Label` | `FString` | `""` | UTF-8, NUL-terminated: "Blue Hoodie". Read only. |
| `Value` | `FString` | `""` | Sliders and spins. Read only. |
| `Hint` | `FString` | `""` | What pressing it does: "Wear it". Read only. |

### USonaEditorSession

A `UObject`. The drop-in avatar editor (sona_editor) in a context of its own. It draws the whole editor, avatar and UI, on the library's own headless device into Texture each tick; USonaEditorWidget shows it and feeds it input.

| Property | Type | Default | What it does |
|---|---|---|---|
| `OnDone` | `FSonaEditorFinished` | (an event) | Fires with the finished manifest when the player is done. |
| `OnCancelled` | `FSonaEditorFinished` | (an event) | Fires when the player cancels. |

| Function | What it does |
|---|---|
| `static USonaEditorSession* OpenEditor(UObject* WorldContextObject, USonaCatalogue* Catalogue, ESonaEditorMode Mode = ESonaEditorMode::Full, const FString& StartManifest = TEXT(""), int32 Width = 1280, int32 Height = 720, bool bDarkTheme = false)` | Catalogue: required (names, sections and what can be worn). StartManifest: base64; empty starts a blank figure. |
| `FString GetError() const` | Why OpenEditor gave a session that is not running. Pure. |
| `ESonaEditorStatus GetStatus() const` | SONA_EDITOR_RUNNING, _DONE or _CANCELLED, as the last sona_editor_update returned. Pure. |
| `bool IsBusy() const` | True while an avatar is still building (the shown one or a change on its way). Pure. |
| `UTexture2D* GetTexture() const` | The editor as drawn at the last tick: sRGB, Width x Height. Pure. |
| `FString GetManifest() const` | The avatar as it stands now (base64). After Cancelled it is the start manifest. |
| `void PressButton(ESonaEditorButton Button, bool bDown)` | A gamepad button down or up. |
| `void SetAxis(int32 Axis, float Value)` | Left stick (0, 1) and right stick (2, 3), -1..1 with +Y down; triggers 4 and 5, 0..1. |
| `void Pointer(float X, float Y, int32 Down, int32 Id = 0)` | Pixels in the editor's own size, top-left origin. Down: 1 pressed, 0 released, -1 moved. |
| `void Wheel(float X, float Y, float Lines)` | A mouse wheel or trackpad scroll over the editor. |
| `void Close()` | Closes the editor without an event and removes its avatars. |
| `TArray<FSonaEditorControl> GetControls() const` | Every control on screen in reading order, for screen readers, tests and your own input. Pure. |
| `bool GetFocus(FSonaEditorControl& Out) const` | The focused control; false when nothing has focus. Pure. |
| `ESonaEditorScreen GetScreen() const` | The screen shown now. Pure. |
| `bool SetScreen(ESonaEditorScreen Screen)` | False for a screen the mode does not have. |
| `FVector4 GetAvatarRect() const` | Where the avatar shows through the UI: X, Y, width, height. Pure. |
| `int32 GetBuildFailures() const` | Avatar builds that failed since the editor opened. Pure. |
| `bool SavePicture(const FString& Path) const` | The last picture as a PNG file. |

### USonaEditorWidget

A `UWidget`. The drop-in avatar editor as a UMG widget: add it to a widget, call Open, and On Done hands back the finished manifest. Gamepad, keyboard, mouse and touch reach the editor while the widget has focus.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Mode` | `ESonaEditorMode` | `ESonaEditorMode::Full` | The screen the editor opens on. |
| `StartManifest` | `FString` | `""` | Base64; empty starts a blank figure (Wardrobe needs one). |
| `CataloguePath` | `FString` | `TEXT("Sona360/sona-catalogue.bin")` | sona-catalogue.bin; relative paths are taken from the project's Content folder. |
| `bDarkTheme` | `bool` | `false` | The editor's dark colours; off, the light ones. |
| `Resolution` | `FIntPoint` | `FIntPoint(1280, 720)` | The editor's own pixel size; the widget scales its picture to fit. |
| `OnDone` | `FSonaEditorFinished` | (an event) | Fires with the finished manifest when the player is done. |
| `OnCancelled` | `FSonaEditorFinished` | (an event) | Fires when the player cancels. |

| Function | What it does |
|---|---|
| `bool Open()` | Opens the editor (closing one already open). False with the reason in GetError. |
| `void Close()` | Closes the editor without an event. |
| `USonaEditorSession* GetSession() const` | The editor session the widget shows, or none while closed. Pure. |
| `FString GetError() const` | Why the last Open failed, or empty. Pure. |

### ESonaContentMode

A Blueprint enum. Whether a filter rule allows or denies.

Values: `Allow`, `Deny`.

### ESonaContentPreset

A Blueprint enum. Ready-made filters: family, no logos, no licensed characters.

| Value | Meaning |
|---|---|
| `Family` | No weapons, horror or alcohol. |
| `NoLogos` | No logos (the man's default tee included; a plain tee stands in). |
| `NoLicensed` | No items from a licensed franchise. |

### FSonaContentVerdict

A Blueprint struct. Why an item is denied, as SONA_CONTENT_BY_*: 0 allowed, 1 id, 2 source, 3 section, 4 slot, 5 game, 6 tag, 7 not allowed.

| Property | Type | Default | What it does |
|---|---|---|---|
| `bAllowed` | `bool` | `true` | True when the filter allows the item. Read only. |
| `Reason` | `int32` | `0` | Why it is denied: 0 allowed, 1 id, 2 source, 3 section, 4 slot, 5 game, 6 tag, 7 not allowed. Read only. |
| `Tag` | `FString` | `""` | The tag that denied it, or empty. Read only. |
| `Section` | `int32` | `0` | The item's editor section. Read only. |

### FSonaContentChange

A Blueprint struct. One item a filter changed on an avatar.

| Property | Type | Default | What it does |
|---|---|---|---|
| `From` | `FString` | `""` | The item id the avatar wore. Read only. |
| `To` | `FString` | `""` | What took its place; empty when it was taken off, or for the head's own shape. Read only. |
| `bReplaced` | `bool` | `false` | True when another item took its place; false when the slot was emptied. Read only. |
| `Reason` | `int32` | `0` | Why it was denied, as FSonaContentVerdict.Reason. Read only. |
| `Section` | `int32` | `0` | The item's editor section. Read only. |

### USonaFilter

A `UObject`. USonaSubsystem::SetContentFilter puts a copy on the context (every avatar is filtered when it is read) and on a catalogue, whose Search then lists allowed items only. Set it again after changing the rules.

| Function | What it does |
|---|---|
| `static USonaFilter* CreateFilter(USonaCatalogue* Catalogue)` | Made from the catalogue's items, names and games; Catalogue may be null (id, slot, section and source rules only). |
| `bool Reset()` | Every rule goes; tags stay. |
| `bool Preset(ESonaContentPreset Which)` | Adds a preset's rules (SONA_FILTER_PRESET_*, listed in [Content filters](../guides/filters.md)). |
| `bool Sections(ESonaContentMode Mode, int64 Bits)` | Bits (1 << section index). |
| `bool Slots(ESonaContentMode Mode, int64 Bits)` | AssetMask slot bits. |
| `bool Sources(ESonaContentMode Mode, int64 Bits)` | 1 stock, 2 award, 4 marketplace, 8 custom, 16 unlisted. |
| `bool Game(ESonaContentMode Mode, const FString& Name)` | A game as sona_catalogue_game names it (ASCII case folded). |
| `bool Tag(ESonaContentMode Mode, const FString& Name)` | A tag by name ("weapon", "logo", or one the host defined). |
| `bool Item(ESonaContentMode Mode, const FString& Id)` | Adds a rule on one item by id. |
| `bool LoadRules(const FString& Path, FString& OutError)` | A rules file (JSON); relative paths are taken from the project's Content folder. All or nothing. |
| `bool LoadRulesText(const FString& Json, FString& OutError)` | Rules from JSON ([Content filters](../guides/filters.md)): {"preset": [...], "allow": {...}, "deny": {...}, "tags": {...}, "untag": {...}}. |
| `bool SetTag(const FString& Id, const FString& TagName, bool bOn = true)` | -1 when unknown. |
| `TArray<FString> GetTags() const` | How many tags the filter knows, built-in and host-defined. Pure. |
| `bool Allows(const FString& Id) const` | True when the item is allowed; a NULL filter allows everything. Pure. |
| `FSonaContentVerdict Check(const FString& Id) const` | Whether the item is allowed, and if not, which rule denied it (SONA_CONTENT_BY_*) and the item's tags. |
| `int32 AllowedCount() const` | Catalogue items allowed. Pure. |

### USonaLoadAvatarAction

A `UBlueprintAsyncActionBase`. The "Load 360sona Avatar" Blueprint node: spawns an actor holding one avatar and fires On Ready or On Failed.

| Property | Type | Default | What it does |
|---|---|---|---|
| `OnReady` | `FSonaLoadAvatarPin` | (an event) | The avatar is built: its component, code 0. |
| `OnFailed` | `FSonaLoadAvatarPin` | (an event) | The avatar could not be built: the result code and the message. |

| Function | What it does |
|---|---|
| `AActor* GetActor() const` | The spawned actor, set once Activate ran. Pure. |

### ESonaSourceKind

A Blueprint enum. Where the context reads avatars from.

| Value | Meaning |
|---|---|
| `Gate` | The 360sona gate. Location empty: https://360sona.com/g. Needs the native licence check. |
| `Directory` | A folder of item files laid out as the gate serves them, which the player owns. Works offline with the licence file alone. |
| `Console` | An Xbox 360 Content root (a PC path to a copied Content tree). |

### FSonaSourceSetting

A Blueprint struct. One source in the project settings.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Kind` | `ESonaSourceKind` | `ESonaSourceKind::Gate` | The kind of source. |
| `Location` | `FString` | `""` | Relative paths are taken from the project directory. |

### ESonaCreditCorner

A Blueprint enum. Where the badge sits.

Values: `BottomRight`, `BottomLeft`, `TopRight`, `TopLeft`.

### FSonaLodOptions

A Blueprint struct. sona_lod_options: how far avatars are posed less often. Unreal draws meshes, not our sprites, so SpritePx stays 0 unless you set it (a SPRITE avatar is not posed).

| Property | Type | Default | What it does |
|---|---|---|---|
| `FullPx` | `float` | `120.0f` | At or above this height on screen in pixels: posed every frame. |
| `QuarterPx` | `float` | `40.0f` | Below: posed at most every 4th frame. |
| `SpritePx` | `float` | `0.0f` | Below: SPRITE. Default 48; 0: never. |
| `FadeSeconds` | `float` | `0.25f` | Mesh-to-sprite crossfade. Default 0.25; 0: a cut. |
| `SpriteAngles` | `int32` | `8` | Turns baked per look, 4 to 32. Default 8. |
| `SpriteHeight` | `int32` | `96` | Pixels per baked picture, 32 to 512; half as wide. Default 64. |
| `MaxLooks` | `int32` | `512` | Looks with baked sprites per renderer; more stay meshes. Default 16384. |
| `BakeMs` | `float` | `4.0f` | Baking time per sona_draw; at least one look per draw. Default 4. |

### FSonaLodStats

A Blueprint struct. Avatars in view per step at the last tick.

| Property | Type | Default | What it does |
|---|---|---|---|
| `Full` | `int32` | `0` | Avatars in view per step at the last sona_update. Read only. |
| `Sampled` | `int32` | `0` | Avatars in view per step at the last sona_update. Read only. |
| `Quarter` | `int32` | `0` | Avatars in view per step at the last sona_update. Read only. |
| `Sprite` | `int32` | `0` | Avatars in view per step at the last sona_update. Read only. |
| `Fading` | `int32` | `0` | Of those, crossing between a mesh and a sprite. Read only. |

### USonaControlRigComponent

A `UActorComponent`. Control Rig IK for the USonaAvatarComponent on the same actor. Each tick the rig's bones take the avatar's pose (avatar space, centimetres), the rig runs its Forwards Solve, and its five controls (ik_hand_l, ik_hand_r, ik_foot_l, ik_foot_r, look) become the avatar's IK targets, which the 360sona core solves within its joint limits.

| Property | Type | Default | What it does |
|---|---|---|---|
| `ControlRigClass` | `TSubclassOf<UControlRig>` | null | Empty: USonaIKControlRig. Your own rig's graph can set the five controls (from the bones, which carry the avatar's joint names); the controls and bones are added when its hierarchy lacks them. Read only. |
| `Weight` | `float` | `1.0f` | How much of the rig's pose the avatar takes, 0 to 1. |
| `bLeftHand` | `bool` | `false` | Which controls drive the avatar. Off, the clip has that limb. |
| `bRightHand` | `bool` | `false` | The right-hand control drives the avatar; off, the clip has that hand. |
| `bLeftFoot` | `bool` | `false` | The left-foot control drives the avatar. |
| `bRightFoot` | `bool` | `false` | The right-foot control drives the avatar. |
| `bLook` | `bool` | `false` | The look control turns the head and eyes. |

| Function | What it does |
|---|---|
| `UControlRig* GetControlRig() const` | The Control Rig instance, or none before the avatar's first ready tick. Pure. |
| `bool SetControlWorldLocation(FName Control, FVector Location)` | A control's place in the world. False before the rig is made (the avatar's first ready tick). |
| `bool GetControlWorldLocation(FName Control, FVector& OutLocation) const` | A control's place in the world; false before the rig is made. |
| `int32 GetBoneCount() const` | How many bones the rig has. Pure. |
| `int32 GetControlCount() const` | How many controls the rig has. Pure. |
