Port the MCP verb surface: run_verb / list_verbs / sketch_set_value

Carries snaporca 39fac9b725. Parity re-verified: 17 files identical, 8 diverging by their
expected counts, DesignPanel.cpp still at 32 — the mirrored files were copied and the two
divergent ones patched hunk by hunk, so the counts returning to their expected values is the
proof each landed on the right side.

All 90 offer verbs are now firable by name over the socket, which matters because a deck key
can only send a keystroke and 49 of them have no shortcut at all. sketch_set_value calls the
same apply_dimension the in-canvas value field calls, so a typed dimension can be asserted with
no window manager in the way.

Three guards came with it, each confirmed against the source: on_mass_properties bounds-checks
m_sel_solid_body (it defaults to -1, and run_verb bypasses the menu grey-out that used to hide
that); sketch_set_value validates its value at the boundary because apply_dimension records a
driving constraint even for values it refused to apply; and run_verb refuses btn:/fly: verbs
that do not apply to the selection while leaving key: verbs alone, so the socket offers exactly
what the GUI offers. Dispatch is deferred through CallAfter so no modal verb can wedge the
socket thread.

GUI target builds and links against the rebuilt deps image.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tommaso Bianchi
2026-08-22 09:53:09 +02:00
co-authored by Claude Opus 5
parent 5d7fc8c545
commit fbf858ba47
4 changed files with 230 additions and 0 deletions
+9
View File
@@ -73,6 +73,15 @@ public:
set_ui_mode(on ? UiMode::Sketch : UiMode::Feature);
update_action_bar();
}
// The offer-table vocabulary without a right-click: the external controller asks which verbs
// exist (and which apply to the current selection) and fires one by id, so a deck key names a
// verb instead of spending a letter and every verb is reachable — including the rows with no
// keyboard shortcut, which are otherwise invisible to anything that parses key tables.
int mcp_offer_selection_kind() const { return offer_selection_kind(); } // OfferSel as int
void mcp_run_action(const char* action) { run_offer_action(action); } // dispatch an action string
// Defined out of line in DesignPanel.cpp: it needs kOfferVerbs, which this header deliberately
// does not include (the table is generated and belongs to the offer-menu code).
bool mcp_run_verb(const char* verb_id);
private:
enum class Tool { None, Sketch, Extrude, Dressup, Hole, Thread, Shell, Revolve, Sweep, Pattern, Plane, Loft, Draft, Boolean, Cut, Insert, Axis, CoordSys, SurfaceExtrude, SurfaceRevolve, SurfaceLoft, SurfaceFill, SurfaceOffset, ThickenSurface, Transform, Mirror, Thicken, Rib, Project, DeleteFace, Helix, Mate };