cad-editor/docs/plugin-template/README.md
Michael Flynn e46701456f Add plugin host architecture and Storm Sewer add-on package
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.
2026-06-09 13:41:21 -04:00

1.1 KiB

Add-on plugin template

Copy this folder to src/modules/<your_module>/ and rename placeholders.

Quick start

  1. Copy files into src/modules/my_plugin/.
  2. Replace MY_PLUGIN, my_plugin, opencad.my_plugin, MP_ throughout.
  3. Add pub mod my_plugin; to src/modules/mod.rs.
  4. 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.