Files
OrcaSlicer/tools/mcp/tests/dialogs_canvas_input.json
T
SoftFever d64e10f4dd Regroup the slicer's MCP commands and let each run from its arguments
Outside the Design tab an agent had 175 commands, 50 of them in the tool
list. There are now 118, named by what they act on (`object_`, `plate_`,
`preset_`, `filament_`, `plugin_` and so on), and 115 are listed. Each takes
its target and values in the call, acts on the selection when it names no
target and says what it acted on; an old name is refused. Printers and
system filaments install and uninstall, preferences read and write, plugins
enable, reload, uninstall and refresh, and objects reorder, with no dialog
to drive.

The Speed Dial keeps its 129 tiles under the same ids. Eight defects in the
rows these commands share with the menus are fixed. For a person: an object
row that cannot run says why instead of "Select an object first.", rows
that failed no longer claim success, Duplicate Plate can be undone, and
Refresh Plugins picked while a refresh runs now runs after it instead of
beside it.
2026-11-18 16:50:32 +08:00

60 lines
4.1 KiB
JSON

// Auto-answered dialogs run their buttons' handlers, a toolbar item reads the state a selection just
// gave it, and model points on a negative part or seen through the bed from below are click targets.
// Run it on a fresh datadir set up with the default printer (Bambu Lab X1 Carbon 0.4):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/dialogs_canvas_input.json --out /tmp/dialogs
// Refusals (a point or an ImGui item under a panel or notification) are unit tests in
// tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot expect an error.
{
"orca_replay_version": "0.2.0",
"name": "auto-answers and canvas input",
"vars": {"standard": "0.20mm Standard @BBL X1C", "fine": "0.16mm High Quality @BBL X1C"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [
{"match": "Uniform scale", "button": "ok"},
{"match": "unsaved changes", "button": "no"},
{"match": "Transfer or discard", "button": "Transfer"}]}},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// ---- An auto-answered Transfer keeps the edit on the newly selected process preset ----
{"tool": "preset_select", "args": {"type": "process", "name": "${vars.standard}"}},
{"tool": "settings_set", "args": {"type": "process", "values": {"wall_loops": 5}}},
{"tool": "preset_select", "args": {"type": "process", "name": "${vars.fine}"}, "expect": {"/selected": {"eq": "0.16mm High Quality @BBL X1C"}}},
{"tool": "settings_get", "args": {"type": "process", "keys": ["wall_loops"]}, "expect": {"/items/0/value": {"eq": "5"}}},
// ---- An auto-answered Discard drops it ----
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Transfer or discard", "button": "Discard"}]}},
{"tool": "preset_select", "args": {"type": "process", "name": "${vars.standard}"}, "expect": {"/selected": {"eq": "0.20mm Standard @BBL X1C"}}},
{"tool": "settings_get", "args": {"type": "process", "keys": ["wall_loops"]}, "expect": {"/items/0/value": {"ne": "5"}}},
{"tool": "app_state", "expect": {"/project/dirty": {"eq": false}}},
// ---- A toolbar item a selection just enabled takes the click at once ----
{"tool": "action_run", "args": {"id": "orca_command:add_primitive_cube:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "widget_list", "args": {"query": "layersediting"}},
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "widget_click", "args": {"target": {"gltoolbar": "layersediting"}}, "expect": {"/pressed": {"eq": true}}},
{"tool": "widget_click", "args": {"target": {"gltoolbar": "layersediting"}}, "expect": {"/pressed": {"eq": false}}},
// ---- A negative part is a surface target (the text lands on the cube's top) ----
{"tool": "view_set", "args": {"camera": "iso"}},
{"tool": "view_set", "args": {"camera": "fit_objects"}},
{"tool": "widget_click", "args": {"target": {"gizmo": "Text"}}, "expect": {"/created": {"eq": true}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "widget_click", "args": {"target": {"imgui": "Cut"}}},
{"tool": "widget_click", "args": {"target": {"imgui": "Done"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}},
// The text's size, and so which of its ends the cube hides, differs between platforms; the step is
// about the part resolving as a target, so it skips the visibility check.
{"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "part": 1, "spot": "right"}, "check": "point"}},
// ---- From below, the bed hides nothing ----
{"tool": "view_set", "args": {"camera": "bottom"}},
{"tool": "view_set", "args": {"camera": "fit_objects"}},
{"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "spot": "bottom"}}},
{"tool": "mouse_gesture", "args": {"action": "move", "at": {"object": 0, "point": [5, 5, -12.8]}}}
]
}