mirror of
https://github.com/storytold/filmcraft.git
synced 2026-11-19 08:53:21 +01:00
Merge pull request #1854 from 00xJS/fix/1540-control-no-dialogs
#1540: engine.execute over the control channel never opens a parameter dialog
This commit is contained in:
8 files changed
+197
-35
No files matched your search
@@ -128,6 +128,7 @@ impl FilmcraftApp {
|
||||
applied_prefs: None,
|
||||
applied_ui_scale: None,
|
||||
workspace_restored: false,
|
||||
engine_call: false,
|
||||
workspaces,
|
||||
menu_workspaces: Default::default(),
|
||||
}
|
||||
|
||||
@@ -496,7 +496,11 @@ pub fn handle(app: &mut FilmcraftApp, ctx: &egui::Context, req: &ControlRequest)
|
||||
let Some(id) = s("command").or(s("id")) else { return err("missing `command`") };
|
||||
let params = p.get("params").cloned().unwrap_or(json!({}));
|
||||
let invoke = if req.method == "engine.execute" { crate::menus::invoke_command } else { crate::menus::invoke };
|
||||
match invoke(app, ctx, id, params) {
|
||||
// `engine.execute` never opens a parameter dialog (#1540); `ui.menu.invoke` is the menu
|
||||
app.engine_call = req.method == "engine.execute";
|
||||
let r = invoke(app, ctx, id, params);
|
||||
app.engine_call = false;
|
||||
match r {
|
||||
Ok(v) => ok(v),
|
||||
Err(e) => err(e),
|
||||
}
|
||||
|
||||
@@ -258,6 +258,10 @@ pub struct FilmcraftApp {
|
||||
pub(crate) pending_panel_raise: Option<PanelKind>,
|
||||
/// Explicit automation mode: native widget input and native menu commands are excluded.
|
||||
pub(crate) control_input_only: bool,
|
||||
/// Set while a control-channel `engine.execute` runs: a command whose menu form opens a
|
||||
/// dialog to ask for parameters runs the engine command instead (an agent cannot see or
|
||||
/// close a dialog; `ui.menu.invoke` keeps the menu behaviour, #1540).
|
||||
pub(crate) engine_call: bool,
|
||||
/// Backend focus before synthetic input changes egui's effective focus for this frame.
|
||||
pub(crate) native_window_focused: Option<bool>,
|
||||
/// Modifiers owned by an in-flight control gesture, carried between its input frames.
|
||||
|
||||
+45
-27
@@ -221,10 +221,21 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
if id == "edit.selectAll" && (crate::panels::graphics::select_all_edited_text(app) || crate::panels::effect_controls::select_all_keyframes(app)) {
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
// Insert / Overwrite of a first clip that doesn't match the empty sequence: the Clip Mismatch Warning asks first
|
||||
if matches!(id, "source.insert" | "source.overwrite") && crate::panels::clip_mismatch::ask(app, id, ¶ms) {
|
||||
// Insert / Overwrite of a first clip that doesn't match the empty sequence: the Clip Mismatch
|
||||
// Warning asks first, from a menu (`engine.execute` keeps the sequence settings, #1540)
|
||||
if !app.engine_call && matches!(id, "source.insert" | "source.overwrite") && crate::panels::clip_mismatch::ask(app, id, ¶ms) {
|
||||
return Ok(json!({"dialog": "clipMismatch"}));
|
||||
}
|
||||
// From a menu, a shortcut or `ui.menu.invoke`, a command without parameters opens the dialog
|
||||
// that asks for them. From the control channel's `engine.execute` it does not (#1540): an agent
|
||||
// can neither see nor close a dialog, so the engine command runs with what was given, and
|
||||
// Sequence Settings… answers the settings it would have shown.
|
||||
let menu = !app.engine_call;
|
||||
if !menu && id == "sequence.settings" && (params.is_null() || params.as_object().is_some_and(|m| m.is_empty())) {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
let seq = app.session.execute("sequence.inspect", json!({})).map_err(|e| e.to_string())?;
|
||||
return Ok(json!({"settings": seq["settings"]}));
|
||||
}
|
||||
// New Item and File ▸ New make their item in the bin the Project panel shows (the dialogs of
|
||||
// Sequence and Color Matte take it when they open); a `bin` of the caller wins, null included
|
||||
// (the engine's root)
|
||||
@@ -306,7 +317,7 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
let source = targets_source(app, ¶ms);
|
||||
params.as_object_mut().ok_or("command parameters must be an object")?.insert("target".into(), json!(if source { "source" } else { "program" }));
|
||||
}
|
||||
if params.get("path").is_none() {
|
||||
if menu && params.get("path").is_none() {
|
||||
return crate::panels::frame_export::open(app, ctx, ¶ms);
|
||||
}
|
||||
}
|
||||
@@ -344,10 +355,13 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
}
|
||||
return r;
|
||||
}
|
||||
if let Some(r) = crate::panels::voiceover::route(app, ctx, id, ¶ms) {
|
||||
if let Some(r) = crate::panels::voiceover::route(app, ctx, id, ¶ms, menu) {
|
||||
return r;
|
||||
}
|
||||
if let Some(r) = crate::panels::clip_dialogs::route(app, id, ¶ms) {
|
||||
// Close Project's and Quit's Save Project prompts are confirmations: `engine.execute` still gets them
|
||||
if (menu || matches!(id, "file.closeProject" | "file.closeAllProjects" | "app.quit"))
|
||||
&& let Some(r) = crate::panels::clip_dialogs::route(app, id, ¶ms)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
if let Some(r) = crate::panels::misc::route_history(app, ctx, id, ¶ms) {
|
||||
@@ -365,13 +379,16 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
}
|
||||
return r;
|
||||
}
|
||||
if let Some(r) = crate::panels::menu_dialogs::route(app, ctx, id, ¶ms) {
|
||||
// The dialogs answer only the menu (#1540): from `engine.execute` the command goes on to the
|
||||
// engine with the parameters given, and answers an error when it needs some. The UI commands
|
||||
// the menu-dialog route also carries (dynamic waveforms, reveal, …) answer either way.
|
||||
if let Some(r) = crate::panels::menu_dialogs::route(app, ctx, id, ¶ms, menu) {
|
||||
if let Err(e) = &r {
|
||||
app.ui.status = e.clone();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
if let Some(r) = crate::panels::media_dialogs::route(app, id, ¶ms) {
|
||||
if menu && let Some(r) = crate::panels::media_dialogs::route(app, id, ¶ms) {
|
||||
if let Err(e) = &r {
|
||||
app.ui.status = e.clone();
|
||||
}
|
||||
@@ -525,24 +542,24 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
// File ▸ Export ▸ AAF… / OMF… open their settings dialogs; with a path they export directly.
|
||||
"file.exportAaf" | "file.exportOmf" if params.get("path").is_none() => {
|
||||
"file.exportAaf" | "file.exportOmf" if menu && params.get("path").is_none() => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
return crate::panels::interchange_export::open(app, ctx, id);
|
||||
}
|
||||
// File ▸ Export ▸ Captions… (and the Text panel's Export captions…) opens the caption export
|
||||
// settings (#3365); with a path it exports directly.
|
||||
"captions.export" if params.get("path").is_none() => {
|
||||
"captions.export" if menu && params.get("path").is_none() => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
return crate::panels::caption_export::open(app, ctx, ¶ms);
|
||||
}
|
||||
// File ▸ Export ▸ Media… opens the Export mode, like ⌘M (#382); with a path it exports directly.
|
||||
"file.exportMedia" if params.get("path").is_none() => {
|
||||
"file.exportMedia" if menu && params.get("path").is_none() => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
app.ui.mode = Mode::Export;
|
||||
return Ok(json!({"mode": "export"}));
|
||||
}
|
||||
// Audio Gain from the menu or G opens the dialog; with params it applies directly.
|
||||
"clip.audioGain" if params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
"clip.audioGain" if menu && params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
filmcraft_engine::find_command("clip.audioGain").map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
if app.ui.audio_gain.mode.is_empty() {
|
||||
app.ui.audio_gain.mode = "adjust".into();
|
||||
@@ -551,19 +568,19 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
return Ok(json!({"dialog": "audioGain"}));
|
||||
}
|
||||
// Colour dialogs from the menus; with params the engine command applies directly.
|
||||
"clip.interpretFootage" if params.get("colorSpace").is_none() && params.get("pixelAspect").is_none() => {
|
||||
"clip.interpretFootage" if menu && params.get("colorSpace").is_none() && params.get("pixelAspect").is_none() => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
crate::panels::color_dialogs::open_interpret(app, ¶ms);
|
||||
return Ok(json!({"dialog": "interpretFootage"}));
|
||||
}
|
||||
// Remix Properties… from the menu opens the dialog; with params it applies directly.
|
||||
"clip.remix.properties" if params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
"clip.remix.properties" if menu && params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
return crate::panels::remix::open(app, ctx);
|
||||
}
|
||||
// Add Tracks… from the menu opens the dialog (new tracks after the last ones, as Premiere
|
||||
// offers); with params it adds the tracks directly.
|
||||
"sequence.addTracks" if params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
"sequence.addTracks" if menu && params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
let seq = app.session.active_sequence();
|
||||
let count = |f: fn(&filmcraft_engine::project::Sequence) -> usize| seq.map_or(0, f);
|
||||
@@ -576,7 +593,7 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
app.dialog = Some(crate::Dialog::AddTracks);
|
||||
return Ok(json!({"dialog": "addTracks"}));
|
||||
}
|
||||
"sequence.deleteTracks" if params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
"sequence.deleteTracks" if menu && params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
app.ui.delete_tracks = Default::default();
|
||||
app.dialog = Some(crate::Dialog::DeleteTracks);
|
||||
@@ -584,18 +601,18 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
}
|
||||
// Sequence Settings… from the menu opens the dialog; with params the engine command applies
|
||||
// them directly.
|
||||
"sequence.settings" if params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
"sequence.settings" if menu && params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
crate::panels::sequence_settings::open(app);
|
||||
return Ok(json!({"dialog": "sequenceSettings"}));
|
||||
}
|
||||
// File ▸ New ▸ Sequence… (Cmd+N) opens New Sequence; with params (a clip, an agent) it
|
||||
// makes the sequence directly
|
||||
"file.newSequence" if params.as_object().is_none_or(|m| m.is_empty()) || crate::panels::project::bin_only(¶ms).is_some() => {
|
||||
"file.newSequence" if menu && (params.as_object().is_none_or(|m| m.is_empty()) || crate::panels::project::bin_only(¶ms).is_some()) => {
|
||||
crate::panels::sequence_settings::open_new(app, crate::panels::project::bin_only(¶ms));
|
||||
return Ok(json!({"dialog": "newSequence"}));
|
||||
}
|
||||
"sequence.colorSettings" if params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
"sequence.colorSettings" if menu && params.as_object().is_none_or(|m| m.is_empty()) => {
|
||||
filmcraft_engine::find_command(id).map_or(Ok(()), |c| (c.enabled)(&app.session))?;
|
||||
crate::panels::color_dialogs::open_sequence(app);
|
||||
return Ok(json!({"dialog": "sequenceColor"}));
|
||||
@@ -659,15 +676,16 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
// File dialogs for commands that need a path.
|
||||
if (id == "file.import" && params.get("paths").is_none() && params.get("path").is_none())
|
||||
|| (id == "file.importImageSequence" && params.get("path").is_none())
|
||||
|| (id == "file.saveAs" && params.get("path").is_none())
|
||||
|| (id == "file.saveCopy" && params.get("path").is_none())
|
||||
|| (id == "file.open" && params.get("path").is_none())
|
||||
|| (id == "file.save" && params.get("path").is_none() && app.session.path.is_none())
|
||||
|| (id == "captions.import" && params.get("path").is_none())
|
||||
|| (id == "graphics.newFromFile" && params.get("path").is_none())
|
||||
|| (crate::EXPORT_SAVE_DIALOGS.iter().any(|(c, ..)| *c == id) && params.get("path").is_none())
|
||||
if menu
|
||||
&& ((id == "file.import" && params.get("paths").is_none() && params.get("path").is_none())
|
||||
|| (id == "file.importImageSequence" && params.get("path").is_none())
|
||||
|| (id == "file.saveAs" && params.get("path").is_none())
|
||||
|| (id == "file.saveCopy" && params.get("path").is_none())
|
||||
|| (id == "file.open" && params.get("path").is_none())
|
||||
|| (id == "file.save" && params.get("path").is_none() && app.session.path.is_none())
|
||||
|| (id == "captions.import" && params.get("path").is_none())
|
||||
|| (id == "graphics.newFromFile" && params.get("path").is_none())
|
||||
|| (crate::EXPORT_SAVE_DIALOGS.iter().any(|(c, ..)| *c == id) && params.get("path").is_none()))
|
||||
{
|
||||
return app.file_dialog(id, ¶ms);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,10 @@ pub fn system_report(app: &FilmcraftApp) -> Value {
|
||||
}
|
||||
|
||||
/// Menu / shortcut entry points. Returns None for ids this module doesn't handle.
|
||||
pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Value) -> Option<Result<Value, String>> {
|
||||
/// `dialogs`: whether a command sent without parameters may open its dialog (a menu, a shortcut,
|
||||
/// `ui.menu.invoke`); from `engine.execute` it may not (#1540), and the command goes on to the
|
||||
/// engine instead. The UI commands above the dialogs answer either way.
|
||||
pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Value, dialogs: bool) -> Option<Result<Value, String>> {
|
||||
// New Item sends the bin it was clicked in (null = root); the Color Matte dialog takes it
|
||||
let carried = if id == "file.newColorMatte" { crate::panels::project::bin_only(params) } else { None };
|
||||
let empty = params.as_object().is_none_or(|m| m.is_empty()) || carried.is_some();
|
||||
@@ -215,7 +218,8 @@ pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Val
|
||||
}
|
||||
return Some(r);
|
||||
}
|
||||
"file.exportSelectionProject" | "file.exportAle" if params.get("path").is_none() => {
|
||||
// the native pickers are dialogs too: not from `engine.execute` (#1540)
|
||||
"file.exportSelectionProject" | "file.exportAle" if params.get("path").is_none() && dialogs => {
|
||||
if let Err(e) = enabled(app, id) {
|
||||
return Some(Err(e));
|
||||
}
|
||||
@@ -236,7 +240,7 @@ pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Val
|
||||
}));
|
||||
}
|
||||
// Color Grading panel menu ▸ Export .cube…: ask where to save the grade, then export it
|
||||
"lumetri.exportCube" if params.get("path").is_none() => {
|
||||
"lumetri.exportCube" if params.get("path").is_none() && dialogs => {
|
||||
if let Err(e) = enabled(app, id) {
|
||||
return Some(Err(e));
|
||||
}
|
||||
@@ -269,7 +273,7 @@ pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Val
|
||||
r
|
||||
}));
|
||||
}
|
||||
"file.mediaPropertiesFile" if params.get("path").is_none() => {
|
||||
"file.mediaPropertiesFile" if params.get("path").is_none() && dialogs => {
|
||||
let exts: Vec<&str> =
|
||||
filmcraft_media::VIDEO_EXTENSIONS.iter().chain(filmcraft_media::AUDIO_EXTENSIONS).chain(filmcraft_media::STILL_EXTENSIONS).copied().collect();
|
||||
let id = id.to_string();
|
||||
@@ -285,7 +289,7 @@ pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, params: &Val
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if !empty {
|
||||
if !empty || !dialogs {
|
||||
return None;
|
||||
}
|
||||
let cmd = dialog_command(id)?;
|
||||
|
||||
@@ -161,8 +161,10 @@ pub fn mix_cues(buf: &mut [f32], ch: usize, cursor: i64, cues: &(Vec<i64>, Vec<f
|
||||
}
|
||||
}
|
||||
|
||||
/// UI commands `voiceover.recordToggle {track?}` and `voiceover.settingsDialog`.
|
||||
pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option<Result<Value, String>> {
|
||||
/// UI commands `voiceover.recordToggle {track?}` and `voiceover.settingsDialog`. The settings
|
||||
/// dialog opens only for the menu (`dialogs`); from `engine.execute` (#1540) the command answers
|
||||
/// the voice-over settings instead, as `audio.voiceover.settings` does.
|
||||
pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, p: &Value, dialogs: bool) -> Option<Result<Value, String>> {
|
||||
match id {
|
||||
"voiceover.recordToggle" => {
|
||||
let track = match p.get("track") {
|
||||
@@ -177,6 +179,7 @@ pub fn route(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, p: &Value) -
|
||||
};
|
||||
Some(toggle(app, track))
|
||||
}
|
||||
"voiceover.settingsDialog" if !dialogs => Some(app.session.execute("audio.voiceover.settings", json!({})).map_err(|e| e.to_string())),
|
||||
"voiceover.settingsDialog" => {
|
||||
open_settings(app, ctx);
|
||||
Some(Ok(Value::Null))
|
||||
|
||||
@@ -609,3 +609,116 @@ fn eyedropper_picks_a_key_color_on_a_selected_clip() {
|
||||
d.wait_until("the eyedropper to fill Key Color", |d| color(d) != before);
|
||||
assert_ne!(color(&mut d), before, "the eyedropper filled Key Color from the Program picture");
|
||||
}
|
||||
|
||||
/// #1540: over the control channel, `engine.execute` of a command whose menu form asks for its
|
||||
/// parameters in a dialog never opens one (an agent cannot see or close it). Sequence Settings…
|
||||
/// answers the settings instead; the other commands run the engine command with what was given.
|
||||
/// `ui.menu.invoke` keeps opening the dialog, as the menu does.
|
||||
#[test]
|
||||
fn engine_execute_never_opens_a_parameter_dialog() {
|
||||
let mut d = Driver::demo();
|
||||
let r = d.exec("sequence.settings", json!({}));
|
||||
assert!(r["settings"]["width"].is_u64() && r["settings"]["frame_rate"].is_object(), "the settings, not a dialog: {r}");
|
||||
assert!(d.inspect()["dialog"].is_null(), "no dialog opened");
|
||||
// malformed parameters are the engine's to refuse, not a request for the settings
|
||||
let v = d.call("engine.execute", json!({"command": "sequence.settings", "params": []}));
|
||||
assert_eq!(v["ok"], json!(false), "{v}");
|
||||
// a command that needs a parameter fails as the engine command, instead of asking in a dialog
|
||||
let v = d.call("engine.execute", json!({"command": "clip.audioGain", "params": {}}));
|
||||
assert_eq!(v["ok"], json!(false), "{v}");
|
||||
assert!(d.inspect()["dialog"].is_null(), "no dialog opened: {v}");
|
||||
// with parameters it applies, as before
|
||||
let r = d.exec("sequence.settings", json!({"maxRenderQuality": true}));
|
||||
assert!(r["scaledClips"].is_u64(), "{r}");
|
||||
assert_eq!(d.sequence()["settings"]["max_render_quality"], json!(true));
|
||||
// the menu form still opens the dialog
|
||||
let r = d.ok("ui.menu.invoke", json!({"id": "sequence.settings"}));
|
||||
assert_eq!(r["dialog"], json!("sequenceSettings"), "{r}");
|
||||
d.frames(2);
|
||||
assert_eq!(d.inspect()["dialog"], json!("SequenceSettings"));
|
||||
}
|
||||
|
||||
/// #1540, every dialog route: each command whose menu form opens a dialog, sent with `{}` through
|
||||
/// `engine.execute`, leaves the UI exactly as it was (no dialog, no draft, only the status line may
|
||||
/// change) and answers the engine command's own result or error. Keeps the guarantee true when a
|
||||
/// dialog command is added to `menu_dialogs::dialog_command` or `media_dialogs::route`.
|
||||
#[test]
|
||||
fn engine_execute_leaves_the_ui_alone_for_every_dialog_command() {
|
||||
let mut d = Driver::demo();
|
||||
let ids = [
|
||||
"file.projectSettings.general",
|
||||
"file.projectSettings.scratchDisks",
|
||||
"project.ingestSettings",
|
||||
"edit.find",
|
||||
"file.newSearchBin",
|
||||
"file.mediaProperties",
|
||||
"clip.editOffline",
|
||||
"clip.sourceSettings",
|
||||
"clip.updateMetadata",
|
||||
"clip.automateToSequence",
|
||||
"clip.sceneEditDetection",
|
||||
"sequence.normalizeMixTrack",
|
||||
"sequence.simplify",
|
||||
"sequence.transcribe",
|
||||
"file.saveAsTemplate",
|
||||
"markers.addFlashCue",
|
||||
"file.newColorMatte",
|
||||
"project.matteColor",
|
||||
"file.projectManager",
|
||||
"file.exportSelectionProject",
|
||||
"file.exportAle",
|
||||
"file.mediaPropertiesFile",
|
||||
"lumetri.exportCube",
|
||||
"media.createProxies",
|
||||
"media.linkMedia",
|
||||
"media.makeOffline",
|
||||
// (not `file.exportFrame`: without a dialog it exports, to a file in the working directory)
|
||||
"file.newOfflineFile",
|
||||
"clip.speedDuration",
|
||||
"clip.rename",
|
||||
"clip.nest",
|
||||
"file.exportAaf",
|
||||
"file.exportOmf",
|
||||
"captions.export",
|
||||
"file.exportMedia",
|
||||
"file.open",
|
||||
"file.import",
|
||||
"file.saveAs",
|
||||
"captions.import",
|
||||
];
|
||||
let snapshot = |d: &mut Driver| {
|
||||
let mut v = d.inspect();
|
||||
v["ui"]["status"] = Value::Null;
|
||||
v["fps"] = Value::Null;
|
||||
v
|
||||
};
|
||||
for id in ids {
|
||||
let before = snapshot(&mut d);
|
||||
let v = d.call("engine.execute", json!({"command": id, "params": {}}));
|
||||
d.frames(2);
|
||||
let after = snapshot(&mut d);
|
||||
assert!(after["dialog"].is_null(), "{id}: a dialog opened: {}", after["dialog"]);
|
||||
assert_eq!(after["ui"], before["ui"], "{id}: the UI changed (answer was {v})");
|
||||
assert!(v.get("ok").is_some(), "{id}: no answer: {v}");
|
||||
}
|
||||
// Voice-Over Record Settings keeps its draft in egui memory, outside `ui`: its window's
|
||||
// elements show whether it opened
|
||||
let vo = |d: &mut Driver| d.ok("ui.elements", json!({"prefix": "voiceover."})).as_array().map_or(0, Vec::len);
|
||||
let r = d.exec("voiceover.settingsDialog", json!({}));
|
||||
assert!(r.is_object(), "the voice-over settings, not a dialog: {r}");
|
||||
d.frames(4);
|
||||
assert_eq!(vo(&mut d), 0, "no Voice-Over Record Settings window");
|
||||
d.ok("ui.menu.invoke", json!({"id": "voiceover.settingsDialog"}));
|
||||
d.frames(4);
|
||||
assert!(vo(&mut d) > 0, "the menu form opens it");
|
||||
d.ok("ui.click", json!({"id": "voiceover.cancel"}));
|
||||
d.frames(2);
|
||||
assert_eq!(vo(&mut d), 0, "Cancel closes it");
|
||||
// the menu form of one of them still opens its dialog
|
||||
let r = d.ok("ui.menu.invoke", json!({"id": "edit.find"}));
|
||||
assert_eq!(r["dialog"], json!("find"), "{r}");
|
||||
// the UI commands the same route carries still answer `engine.execute`
|
||||
let r = d.exec("view.dynamicAudioWaveforms", json!({"on": false}));
|
||||
assert_eq!(r["dynamicAudioWaveforms"], json!(false), "{r}");
|
||||
assert_eq!(d.inspect()["ui"]["extras"]["dynamic_waveforms"], json!(false));
|
||||
}
|
||||
@@ -211,6 +211,21 @@ Annotations, argument checking, errors and export progress / cancellation:
|
||||
|
||||
Time is in ticks (254 016 000 000 per second); commands also accept `seconds`, `frame` or `timecode`.
|
||||
|
||||
## Parameter dialogs
|
||||
|
||||
From a menu, a shortcut or `ui.menu.invoke`, a command sent without parameters opens the dialog
|
||||
that asks for them (Sequence Settings…, Add Tracks…, Audio Gain…, Interpret Footage…, Remix
|
||||
Properties…, New Sequence…, Color Management…, Find…, Media Properties…, Simplify Sequence…, Link
|
||||
Media…, Make Offline…, Create Proxies…, Project Manager… and the other dialog commands).
|
||||
`engine.execute` never does (#1540): an agent can neither see nor close a dialog. The engine command runs with the parameters given (so `sequence.addTracks {}`
|
||||
adds its default one video track, `clip.audioGain {}` answers "need `db`"), and
|
||||
`sequence.settings {}` answers `{"settings"}`, the active sequence's settings as `sequence.inspect`
|
||||
reports them, instead of showing them. The same goes for the Clip Mismatch Warning (the clip goes into
|
||||
the sequence as it is), and for the export settings dialogs and file pickers of commands sent without a
|
||||
`path`: the engine command runs as given, which is an error for most of them, while `file.save` saves a
|
||||
project that already has a path to that path. Confirmations (`file.revert`, `file.recover`, Close
|
||||
Project and Quit with unsaved changes) still ask.
|
||||
|
||||
## Panel docking commands
|
||||
|
||||
`ui.menu.invoke` and `engine.execute` route these frontend commands:
|
||||
|
||||
Reference in new issue
Block a user