feat(plugin): object-pick acquisition for interactive commands

Extend InteractiveCommand with needs_object_pick / on_object_pick so a
plugin tool can prompt the user to pick an existing entity (handle + point)
rather than a free point — the structure-pick path Storm Sewer's SS_PIPE
needs to connect existing structures. The host adapter delegates to the
internal entity-pick flow; over --serve the pick is fed as a hex handle.
Stays API v2 (no released plugin implements InteractiveCommand yet).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-18 01:43:38 +03:00
commit 707c143212
4 changed files with 114 additions and 2 deletions

View file

@ -45,6 +45,19 @@ pub trait InteractiveCommand: Send {
fn on_enter(&mut self) -> CommandStep {
CommandStep::Cancel
}
/// When `true`, the next input picks an existing **entity** (the user clicks
/// on it; over `--serve`, a handle is supplied) rather than a free point —
/// the host then calls [`on_object_pick`](Self::on_object_pick). Use this to
/// reference existing geometry (e.g. connect a pipe between two structures).
fn needs_object_pick(&self) -> bool {
false
}
/// An existing entity was picked: its `handle` and the pick point. Read the
/// entity's data (XDATA / geometry) via `HostApi`, keyed by the handle.
fn on_object_pick(&mut self, _handle: Handle, _pt: [f64; 3]) -> CommandStep {
CommandStep::Cancel
}
}
/// The outcome of an [`InteractiveCommand`] step.