Skip to content

Slots

Slots: the places in Wraith’s UI a plugin can add to, like a Workbench tab, its Settings page, or a part of the scene window, and plugins’ own. What goes in one is an object of the slot’s trait, added with Ui.contributeTo, and Wraith describes each one in Ui.slots. Wraith’s own parts go through the same slots.

Part of the plugin’s page in Settings: Ui.contributeTo("settings", section). On the render thread.

describe(): Wraith.SettingsSection.Info
draw(): void

Asked once, as it’s added

Uses SettingsSection.Info.

Part of the scene window (Photo Mode), like a button in scene.toolbar. Render thread.

describe(): Wraith.ScenePart.Info
draw(target: import("salamander").Given<Wraith.Slot.Target>): void

Asked once, as it’s added

Uses ScenePart.Info.

For what’s picked, or a bone, inside its part of the window

Uses Slot.Target.

A tile on the overlay’s bar, after Wraith’s own: Ui.contributeTo("hub", button). Render thread.

describe(): Wraith.HubButton.Info
isOpen(): boolean
click(): void

Asked once, as it’s added

Uses HubButton.Info.

Lit with a dot under it, like an open window’s

A slot a plugin defined with Ui.defineSlot, for other plugins to add objects of its trait to.

contributions(): Array<object | null>
remove(): void

What’s in it now, in the order added, each an object of its trait. Kept till the next call; one thread at a time. Views of them, like salamander.as in a script, work while they’re there

Takes it away. What’s in it stays, for when one by its id comes again, like when its plugin reloads. Gone with the plugin anyway

Something a plugin added to a slot.

isOpen(): boolean
focus(): void
remove(): void
open(id: string): void
close(id: string): void

Shown last frame: its tab in front, its foldout open, or its node picked

Brings its tab to the front, opens its foldout, or picks its node

Waits for a draw under way, except from inside a draw or a script. Fine to call twice.

For a Workbench tab of many: opens the one with this id, or brings it to the front

For a Workbench tab of many: closes the one with this id, without asking. For one, closes it

What can go wrong, besides Cancelled, Unsupported and Gone.

Code Error
1 UnknownSlot No slot by that id, see Ui.slots
2 NotTaken The slot doesn’t take that presentation or a kind
3 InvalidId Not letters, digits, _, - and .
4 AlreadyAdded The plugin has one by that id in that slot already, or a slot by that id’s defined already
5 Failed
6 WrongTrait The object isn’t the slot’s trait

How a contribution shows in its slot.

An enum of u8.

Value Name
0 default The slot’s first in presentations
1 inline Drawn in place, without a frame
2 foldout Under a header that folds
3 tab A tab beside the slot’s others
4 node A row in the slot’s tree, which can have children and be picked. Its draw shows once it’s picked

Which thread a slot draws on.

An enum of u8.

Value Name
0 render
1 workbench The Workbench’s own. Read what game-thread code left rather than calling into the game
2 any A plugin’s own slot, used wherever that plugin says

What a slot takes, from Wraith.

A struct, 0x80 bytes, aligned to 8.

Offset Field Type
0x0 id string Like “scene.inspector”
0x10 title string
0x20 help string
0x30 trait string What goes in it implements, like Wraith.ScenePart
0x40 thread Slot.Thread
0x48 presentations []Slot.Presentation What it takes, the default first
0x58 hierarchy bool Nodes, and parents to put things under
0x59 kinds bool Contributions can show only for nodes of a kind, like “actor”
0x60 parents []string Wraith’s own parents, like “world/actors”
0x70 known_kinds []string Wraith’s own kinds, like “actor”
id: string
title: string
help: string
trait: string
thread: Wraith.Slot.Thread | Wraith.Slot.ThreadName
presentations: Array<Wraith.Slot.Presentation | Wraith.Slot.PresentationName>
hierarchy: boolean
kinds: boolean
parents: Array<string>
known_kinds: Array<string>

A slot of a plugin’s own, from Ui.defineSlot.

A struct, 0x40 bytes, aligned to 8.

Offset Field Type
0x0 id string Letters, digits, _, - and .. Others name it as plugin.id, like ffxiv.viewers
0x10 title string
0x20 help string What goes in it, and where it shows
0x30 trait string What’s added implements, by its full name, like Ffxiv.Viewer
id: string
title: string
help: string
trait: string

What it’s drawn for: the picked node, or nothing.

A struct, 0x30 bytes, aligned to 8.

Offset Field Type
0x0 kind string
0x10 id u64
0x18 parent u64 For part of a node, like a bone: the node’s id, like its actor’s. Else 0
0x20 name string What it’s called, like a bone’s name, which its edits go by. Can be empty
kind: string
id: bigint
parent: bigint
name: string

A struct, 0x30 bytes, aligned to 8.

Offset Field Type
0x0 title string Its header. Defaults to the plugin’s name
0x10 id string Unique for the plugin in Settings. Can be empty
0x20 presentation Slot.Presentation foldout, the default, or inline after the plugin’s settings
0x24 order i32 Lower comes first. Wraith’s own are 100 apart, from 100
0x28 open bool A foldout starts open
title: string
id: string
presentation: Wraith.Slot.Presentation | Wraith.Slot.PresentationName
order: number
open: boolean

A struct, 0x68 bytes, aligned to 8.

Offset Field Type
0x0 id string Unique for the plugin in the slot, so its other parts can name it as parent. Can be empty
0x10 title string Its header or row. Defaults to the plugin’s name
0x20 icon string A glyph from Wraith’s icon font before the title, as UTF-8. Can be empty
0x30 parent string With a hierarchy: one of its parents, or one of the plugin’s own node ids. Empty for the top
0x40 kind string What a node is, or what a part shows for, like camera. Empty for everything
0x50 node u64 For a node, its id among its kind, handed to whatever shows for it
0x58 presentation Slot.Presentation How it shows, from the slot’s presentations. default is its first
0x5c order i32 Lower comes first. Wraith’s own are 100 apart, from 100
0x60 open bool Foldouts and nodes start open
id: string
title: string
icon: string
parent: string
kind: string
node: bigint
presentation: Wraith.Slot.Presentation | Wraith.Slot.PresentationName
order: number
open: boolean

A struct, 0x38 bytes, aligned to 8.

Offset Field Type
0x0 id string Unique for the plugin on the hub, which remembers where it was dragged by it. Can be empty
0x10 title string Its tooltip. Defaults to the plugin’s name
0x20 icon string A Lucide icon’s name, like “user” (see lucide.dev/icons), or its glyph from Wraith’s icon font. Empty shows the title’s first letter
0x30 order i32 Lower comes first, after Wraith’s own tiles
id: string
title: string
icon: string
order: number

Made with ♥ by Asgard