editor library

What a plugin tells an editor about the things it brings, without depending on one: the hints an inspector is built from.

A game's plugin should not need the editor to be edited. A plugin that adds a component, an entity kind or a lit model is a dependency of a game, and the editor (flutter3d_editor_core, a Flutter-free package that still pulls in the collision world and the software rasteriser) is not. So the words a plugin describes its fields in live here, over the foundation alone, and the registry it hands them to, EditorHintRegistry, is a slot an engine with no editor simply does not have:

void install(PluginHost host) {
  host.maybeRegistry<EditorHintRegistry>()
    ?..addComponent(const ComponentHints(
        id: 'boats.buoyancy',
        title: 'Buoyancy',
        fields: <FieldHint>[
          FieldHint.number('buoyancy', min: 0, max: 4, defaultValue: 1.0),
          FieldHint.number('drag', min: 0, max: 1, defaultValue: 0.4),
        ],
        entityTypes: <String>{'boat'},
      ))
    ..addEntityKind(const EntityKindHints(type: 'boat', label: 'Boat'));
}

An editor fills the slot (EditorHints in flutter3d_editor_core, which EditorPieces brings along) and builds a section of its inspector from each hint: a slider for a number with ends, a switch for a toggle, a list for a choice. A data plugin says the same in its .f3dplugin's editor: section, read into the same registry; FieldHint.toJson is that shape.

A hint describes a control and never constrains a reader, as a material's hint does: a value outside a number's ends is what the game receives, and the editor says it is outside rather than refusing it. What a hint does refuse is a value of the wrong shape (FieldHint.refusalOf): a word where a number goes.

Classes

ComponentHints
The fields of one component type a plugin registers, as an inspector shows them under one heading.
EditorHintRegistry
The hints an editor builds its inspectors from: the slot a plugin hands its ComponentHints, EntityKindHints and MaterialHints to, host.maybeRegistry<EditorHintRegistry>().
EntityKindHints
What an editor shows for one entity type: its name in the palette, its colour, its own fields, and the components an entity of it carries.
FieldHint
How an inspector shows one field, and what shape its value has.
FieldKind
What kind of control a field is shown with, and what shape its value has.
MaterialHints
The parameters of one lit model a plugin brings, as a material panel shows them for a material that names it.