Generic plugin runtime (src/plugin/, HostSession, per-tab plugin_state, command router). QGIS-style add-on layout with plugin.toml and single PluginRegistration. Storm Sewer refactored as reference consumer with dispatch.rs, catchments, LandXML, headless tests (43 passing). Core update.rs decoupled from storm_sewer via CadCommand object-pick hooks. Docs: plugin-architecture.md, plugin-template, PR and issue-78 reply drafts.
1.1 KiB
1.1 KiB
Add-on plugin template
Copy this folder to src/modules/<your_module>/ and rename placeholders.
Quick start
- Copy files into
src/modules/my_plugin/. - Replace
MY_PLUGIN,my_plugin,opencad.my_plugin,MP_throughout. - Add
pub mod my_plugin;tosrc/modules/mod.rs. cargo build— ribbon tab and commands register automatically.
Required files
| File | Purpose |
|---|---|
plugin.toml |
Metadata (QGIS-style); excludes dir from build.rs ribbon scan |
manifest.rs |
Compile-time PluginManifest — keep in sync with plugin.toml |
register.rs |
inventory::submit!(PluginRegistration { … }) only |
plugin.rs |
Thin BuiltinPlugin impl |
dispatch.rs |
All command handlers |
mod.rs |
CadModule ribbon + CommandRegistration for autocomplete |
PLUGIN.md |
XDATA schemas and command reference |
Optional
| File | Purpose |
|---|---|
state.rs |
Per-document tab state via host.ensure_plugin_state(PLUGIN_ID, …) |
crates/my_engine/ |
Headless domain logic (no iced/acadrust) |
See docs/plugin-architecture.md for the full spec.