mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-06 03:38:01 -05:00
78 lines
5.8 KiB
JSON
78 lines
5.8 KiB
JSON
// Recordings: one while the GUI is driven (clicks on the 3D view, a setting typed, a dialog opened and
|
|
// answered, a slice), stopped and encoded; then one a nested replay starts and never stops, which ends
|
|
// with that replay and is encoded by a step after it. Run with
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/recording.json --out /tmp/recording
|
|
// The encode steps need an ffmpeg with libx265 (ORCA_FFMPEG or on PATH), so they are optional.
|
|
{
|
|
"orca_replay": 1,
|
|
"name": "recording",
|
|
"vars": {"model": "${replay_dir}/../../../resources/handy_models/OrcaCube_v2.drc"},
|
|
"steps": [
|
|
{"tool": "wait", "args": {"for": "ready"}},
|
|
{"tool": "auto_answer_dialogs", "args": {"rules": [{"match": "unsaved changes", "button": "no"},
|
|
{"match": "restore", "button": "no"}]}},
|
|
{"tool": "new_project"},
|
|
{"tool": "set_window", "args": {"size": [1600, 1000]}},
|
|
{"tool": "set_view", "args": {"tab": "prepare"}},
|
|
{"tool": "start_recording", "args": {"save_path": "${out_dir}/session.mkv", "overwrite": true, "captions": true,
|
|
"pointer": true},
|
|
"expect": {"/width": {"ge": 320}, "/fps": {"eq": 10}, "/captions": {"eq": true}, "/pointer": {"eq": true}}},
|
|
{"tool": "get_app_state", "expect": {"/recording/path": {"regex": "session\\.mkv$"}}},
|
|
{"tool": "open_files", "args": {"paths": ["${vars.model}"]}, "expect": {"/added": {"eq": 1}}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "x": 300, "y": 200}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "at": {"object": 0, "spot": "top"}}},
|
|
// The global settings, whatever an earlier replay left the Process panel's Global/Objects switch on.
|
|
{"tool": "set_widget_value", "args": {"target": {"label": "Process"}, "value": false}},
|
|
{"tool": "set_widget_value", "args": {"target": {"option": "layer_height"}, "value": "0.16"}},
|
|
{"tool": "press_keys", "args": {"target": {"option": "initial_layer_print_height"}, "keys": "ctrl+a", "text": "0.24"}},
|
|
|
|
// The action blocks in the dialog it opens, so it is not awaited until the dialog is answered.
|
|
{"tool": "run_action", "args": {"id": "orca_command:open_preferences:orca"}, "await": false, "save_as": "prefs"},
|
|
{"tool": "wait", "args": {"for": "dialog", "timeout_s": 10}, "expect": {"/satisfied": {"eq": true}}},
|
|
{"tool": "answer_dialog", "args": {"dialog": {"title": "Preferences"}, "button": "close"}},
|
|
{"tool": "wait", "args": {"for": "job", "job": "${jobs.prefs}"}},
|
|
|
|
{"tool": "slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
|
|
{"tool": "wait", "args": {"for": "idle"}},
|
|
{"tool": "stop_recording",
|
|
"expect": {"/ended": {"eq": "stopped"}, "/frames": {"ge": 5}, "/written": {"ge": 5}, "/seconds": {"gt": 1}, "/size_bytes": {"gt": 0},
|
|
"/capture_ms": {"gt": 0}}},
|
|
{"tool": "get_app_state", "expect": {"/recording": {"exists": false}}},
|
|
{"tool": "encode_recording", "args": {"save_path": "${out_dir}/session.mp4", "overwrite": true}, "optional": true,
|
|
"expect": {"/codec": {"eq": "h265"}, "/encoder": {"eq": "libx265"}, "/seconds": {"gt": 1}}},
|
|
|
|
// A recording a replay starts ends with that replay, its file closed when the replay's call returns.
|
|
{"tool": "run_replay", "args": {"replay": {"orca_replay": 1, "name": "inner", "steps": [
|
|
{"tool": "start_recording", "args": {"target": "canvas", "fps": 5, "save_path": "${out_dir}/inner.mkv", "overwrite": true}},
|
|
{"tool": "set_view", "args": {"camera": "iso"}},
|
|
{"tool": "mouse_gesture", "args": {"action": "drag", "x": 400, "y": 300, "to": [500, 340]}}]}},
|
|
"expect": {"/passed": {"eq": true}, "/unfinished_recording": {"exists": false}}},
|
|
{"tool": "stop_recording", "expect": {"/ended": {"eq": "run_ended"}, "/path": {"regex": "inner\\.mkv$"}}},
|
|
{"tool": "encode_recording", "args": {"overwrite": true, "codec": "h264"}, "optional": true,
|
|
"expect": {"/path": {"regex": "inner\\.mp4$"}, "/encoder": {"eq": "libx264"}}},
|
|
// The replay's end released the file: recording to it again starts at once, with no overlays by default.
|
|
{"tool": "start_recording", "args": {"save_path": "${out_dir}/inner.mkv", "overwrite": true},
|
|
"expect": {"/captions": {"eq": false}, "/pointer": {"eq": false}}},
|
|
{"tool": "stop_recording", "expect": {"/ended": {"eq": "stopped"}}},
|
|
|
|
// captions and pointer each turn on one.
|
|
{"tool": "start_recording", "args": {"save_path": "${out_dir}/plain.mkv", "overwrite": true, "pointer": true},
|
|
"expect": {"/captions": {"eq": false}, "/pointer": {"eq": true}}},
|
|
{"tool": "stop_recording", "expect": {"/ended": {"eq": "stopped"}}},
|
|
{"tool": "start_recording", "args": {"save_path": "${out_dir}/plain.mkv", "overwrite": true, "captions": true},
|
|
"expect": {"/captions": {"eq": true}, "/pointer": {"eq": false}}},
|
|
{"tool": "stop_recording", "expect": {"/ended": {"eq": "stopped"}}},
|
|
|
|
// Encoding asked for up front (an ffmpeg with libx264): the stop that reports the recording starts the encode
|
|
// as a job of its own, which wait idle waits for.
|
|
{"tool": "start_recording", "args": {"save_path": "${out_dir}/encoded.mkv", "overwrite": true, "encode": true,
|
|
"encode_preset": "compatible", "crf": 30}, "optional": true,
|
|
"expect": {"/encode/codec": {"eq": "h264"}, "/encode/crf": {"eq": 30}, "/encode/profile": {"eq": "high"}}},
|
|
{"tool": "stop_recording", "optional": true,
|
|
"expect": {"/path": {"regex": "encoded\\.mkv$"}, "/encode/status": {"eq": "running"}, "/encode/job": {"exists": true}}},
|
|
{"tool": "wait", "args": {"for": "idle", "timeout_s": 50}, "optional": true, "expect": {"/satisfied": {"eq": true}}},
|
|
{"tool": "get_app_state", "optional": true,
|
|
"expect": {"/jobs/0/tool": {"eq": "encode_recording"}, "/jobs/0/state": {"eq": "done"}}}
|
|
]
|
|
}
|