mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-27 15:49:52 -05:00
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.
122 lines
8.0 KiB
JSON
122 lines
8.0 KiB
JSON
// Records what a model import, project_import with paths, does: it adds the files' geometry as one undo step and
|
|
// loads no settings. The cases: an STL into an empty project and into one with a cylinder and an unsaved process
|
|
// change, a project .3mf saved here from a cube with wall_loops 5 into a project with a cylinder and
|
|
// top_shell_layers 7, and imports that load nothing (a path that does not exist, a PNG, a preset .json, each of
|
|
// the last two opening a warning and an error, which it answers). After each it reads the objects, the project's
|
|
// name and file, the selected presets and their unsaved keys, the recent projects (action_search) and the
|
|
// dialogs, then the undo snapshots taken since the last read (fixtures/ops_undo.py), and runs undo once to show
|
|
// what that step takes back. Last, File > Import (the import_file tile) with a rule that answers its picker with
|
|
// a path: the picker is multi-select, which takes no path, so it is cancelled. Every call it records is optional.
|
|
// Run it with
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_import_models.json --out <dir>
|
|
{
|
|
"orca_replay_version": "0.2.0",
|
|
"name": "ops import_models",
|
|
"vars": {
|
|
"stl": "${replay_dir}/../../../tests/data/test_stl/ASCII/20mmbox-LF.stl",
|
|
"png": "${replay_dir}/fixtures/heightmap.png",
|
|
"preset_json": "${replay_dir}/fixtures/mcp_import_pla.json",
|
|
"undo": "${replay_dir}/fixtures/ops_undo.py"
|
|
},
|
|
"steps": [
|
|
{"tool": "app_wait", "args": {"for": "ready"}},
|
|
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
|
|
{"tool": "view_set", "args": {"tab": "prepare"}},
|
|
|
|
// ---- The source project: a cube with wall_loops 5, saved ----
|
|
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
|
|
{"tool": "settings_set", "args": {"values": {"wall_loops": 5}}},
|
|
{"tool": "project_save", "args": {"path": "${out_dir}/src_project.3mf", "overwrite": true}},
|
|
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "action_search", "args": {"group": "Recent Projects"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
// ---- An STL into an empty project ----
|
|
{"tool": "project_import", "args": {"paths": ["${vars.stl}"]}, "optional": true},
|
|
{"tool": "app_state"},
|
|
{"tool": "object_list"},
|
|
{"tool": "action_search", "args": {"group": "Recent Projects"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
|
|
{"tool": "object_list"},
|
|
|
|
// ---- An STL into a project with a cylinder and an unsaved process change ----
|
|
{"tool": "project_new", "args": {"discard_changes": true}},
|
|
{"tool": "object_add_primitive", "args": {"shape": "cylinder", "size": [20, 10]}},
|
|
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "object_list", "expect": {"/total": {"eq": 1}}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "project_import", "args": {"paths": ["${vars.stl}"]}, "optional": true},
|
|
{"tool": "app_state"},
|
|
{"tool": "object_list"},
|
|
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
|
|
{"tool": "object_list"},
|
|
|
|
// ---- The project .3mf into a project with a cylinder and top_shell_layers 7 ----
|
|
// A dialog it opens is listed by app_state and cancelled.
|
|
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
|
|
{"tool": "object_add_primitive", "args": {"shape": "cylinder", "size": [20, 10]}},
|
|
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "app_state"},
|
|
{"tool": "action_search", "args": {"group": "Recent Projects"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "project_import", "args": {"paths": ["${out_dir}/src_project.3mf"]}, "await": false, "save_as": "project_3mf", "optional": true},
|
|
{"tool": "app_state"},
|
|
{"tool": "dialog_answer", "args": {"button": "cancel"}, "optional": true},
|
|
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.project_3mf}"}, "optional": true},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "app_state"},
|
|
{"tool": "object_list"},
|
|
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
|
|
{"tool": "settings_get", "args": {"type": "filament", "compare": ":saved"}},
|
|
{"tool": "settings_get", "args": {"type": "printer", "compare": ":saved"}},
|
|
{"tool": "settings_get", "args": {"keys": ["wall_loops", "top_shell_layers"]}},
|
|
{"tool": "action_search", "args": {"group": "Recent Projects"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
|
|
{"tool": "object_list"},
|
|
{"tool": "settings_get", "args": {"keys": ["wall_loops", "top_shell_layers"]}},
|
|
|
|
// ---- Imports that load nothing, on a project with a cube ----
|
|
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
|
|
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "project_import", "args": {"paths": ["${out_dir}/missing.stl"]}, "optional": true},
|
|
{"tool": "project_import", "args": {"paths": ["${vars.png}"]}, "await": false, "save_as": "png", "optional": true},
|
|
{"tool": "app_state"},
|
|
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
|
|
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
|
|
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.png}"}, "optional": true},
|
|
{"tool": "project_import", "args": {"paths": ["${vars.preset_json}"]}, "await": false, "save_as": "preset_json", "optional": true},
|
|
{"tool": "app_state"},
|
|
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
|
|
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
|
|
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.preset_json}"}, "optional": true},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "object_list"},
|
|
{"tool": "app_state"},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
|
|
{"tool": "object_list"},
|
|
|
|
// ---- File > Import: the multi-select picker takes no path, so the rule cancels it ----
|
|
{"tool": "project_new", "args": {"discard_changes": true}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Choose one or more files", "button": "ok", "path": "${vars.stl}"}]}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:import_file:orca"}, "optional": true},
|
|
{"tool": "app_state"},
|
|
{"tool": "object_list"},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.log_lines('multi-select', 1)"}},
|
|
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
|
|
|
|
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}}
|
|
]
|
|
}
|