feat(plugin): ModuleEvent::PluginFileDialog for native file import

Add-ons had no way to request a file picker — only the host's own Open
dialog. PluginFileDialog lets a plugin tool ask the host to open a native
picker; on selection the host dispatches "<command> <path>" back to the
plugin with original case preserved (bypassing the command-line
upper-casing that mangles case-sensitive paths on Linux/macOS). The demo
plugin gains an Import tool exercising it.

Part of the #100 extensibility epic (surfaced in #106).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-17 10:22:08 +03:00
commit 50825b6346
8 changed files with 107 additions and 7 deletions

View file

@ -17,6 +17,21 @@ pub enum ModuleEvent {
SetWireframe(bool),
/// Toggle the layer manager panel.
ToggleLayers,
/// Ask the host to open a native file picker. On selection the host
/// dispatches `"<command> <path>"` back to the plugin (full original case,
/// bypassing the command line so case-sensitive paths/args survive); on
/// cancel nothing happens. Lets an add-on import files without owning any
/// dialog UI.
PluginFileDialog {
/// Plugin command to dispatch with the chosen path appended.
command: String,
/// Dialog window title.
title: String,
/// Human label for the file-type filter (e.g. "PNEZD Points").
filter_name: String,
/// Accepted extensions, without the dot (e.g. `["csv", "txt"]`).
extensions: Vec<String>,
},
}
// ── Data types ────────────────────────────────────────────────────────────