feat(plugin-api): let add-ons ask for a visual style by name

Removing the binary wireframe event left add-ons with no way to set a
visual style except by spelling out a command string. Give them the
intent back, in the vocabulary everything else now speaks.

The name is carried as text rather than the render-mode type: this crate
is dependency-free by default and only pulls acadrust in behind the host
feature, which is not a weight to add to the manifest contract for one
enum. The host resolves it against the same list its ribbon, its picker
and its commands read, so an add-on can offer exactly the styles the
application does and no others. An unknown name says so and lists the
ones that exist, from that same list.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-08-07 14:29:01 +03:00
commit f7590b1aa8
3 changed files with 32 additions and 0 deletions

View file

@ -17,6 +17,15 @@ pub enum ModuleEvent {
/// Remove all loaded models from the scene.
#[allow(dead_code)]
ClearModels,
/// Put the active viewport in a named visual style.
///
/// The name is one of the render modes the viewport can be drawn in:
/// `WIREFRAME2D`, `WIREFRAME3D`, `HIDDENLINE`, `FLATSHADED`,
/// `GOURAUDSHADED`, `FLATSHADEDWITHEDGES`, `GOURAUDSHADEDWITHEDGES`
/// (case-insensitive). The host resolves it against the same list its own
/// ribbon and commands read, so an add-on offers exactly the styles the
/// application does. An unknown name is reported and nothing changes.
SetVisualStyle(String),
/// Toggle the layer manager panel.
ToggleLayers,
/// Ask the host to open a native file picker. On selection the host