Scripting API

Scripting API

EditorUi

Class in Abyss.Core, from Abyss.Core.

What a plugin's editor window is drawn with (Schedule.EditorWindow): the editor's own rows, buttons, headings and lists, each a line under the last, in the editor's look whatever draws it. Called from the window's draw, once a frame while the window shows; the editor's to make.

public abstract class EditorUi

Remarks

The world is read as the window draws — the same thread, between the editor's panels — and changed with Command, whose work runs once the frame's panels are drawn and is one step of the undo, as a Tools command's is. A change written in the middle of drawing would show in the panels after this one and not those before, and could not be undone.

A row's label is its identity within the window, as a Dear ImGui label is: two rows of the same label in one window are told apart by ## and something after it, which is not shown.

Methods

Fields<T>

public abstract bool Fields<T>(ref T state) where T : unmanaged

Every field of state, each a row as the Inspector shows a component's — a number typed or dragged, a toggle, a color, a slot for an asset — with its tooltip and range: a struct whose fields the world has described, as a WindowStateAttribute's are.

Type parameters

  • T

Parameters

  • state

Returns Whether any of them was changed this frame.

Exceptions

  • InvalidOperationException: The world has no description of T.

Number

public abstract bool Number(string label, ref float value)

A number, as the Inspector's rows show one: typed, or dragged on its label.

Parameters

  • label
  • value

Returns Whether it was changed this frame.

Number

public abstract bool Number(string label, ref int value)

A whole number, as the Inspector's rows show one: typed, or dragged on its label.

Parameters

  • label
  • value

Returns Whether it was changed this frame.

Toggle

public abstract bool Toggle(string label, ref bool value)

A toggle.

Parameters

  • label
  • value

Returns Whether it was changed this frame.

Text

public abstract bool Text(string label, ref string value)

A line of text, typed.

Parameters

  • label
  • value

Returns Whether it was changed this frame.

Button

public abstract bool Button(string label)

A button. Its work changes nothing in the world: Command does that.

Parameters

  • label

Returns Whether it was pressed this frame.

Command

public abstract void Command(string label, Action<World> run)

A button that runs run on the world once the frame's panels are drawn: one step of the undo, named as the button is, whatever it changed; none where it changed nothing. One that throws is said in the logs.

Parameters

  • label
  • run

Heading

public abstract void Heading(string text)

A heading over what follows, with a line above it.

Parameters

  • text

Label

public abstract void Label(string text)

Text, wrapped at the window's edge.

Parameters

  • text

Row

public abstract bool Row(string text, EditorIcon icon = None, ulong pick = 0)

A row of a list, the whole width of the window, highlighted under the pointer as the editor's rows are: icon before text; clicked, it picks pick in the Hierarchy, shown in the Inspector, where it names one.

Parameters

  • text
  • icon
  • pick

Returns Whether it was clicked this frame.

Separator

public abstract void Separator()

A line across the window.