mirror of
https://github.com/storytold/filmcraft.git
synced 2026-12-02 20:19:02 -05:00
#2726: sync with main and label the menu Lined Script
This commit is contained in:
commit
1343ffa127
37 files changed
+999
-151
No files matched your search
@@ -4368,6 +4368,15 @@ fn keyframe_op(s: &mut Session, p: &Value, op: &str) -> Result<Value> {
|
||||
_ => None,
|
||||
}
|
||||
.ok_or_else(|| bad("keyframe", "no such effect"))?;
|
||||
// the parameter's hard range, as `effects.setParam` checks it (a mask's own parameters have no definition)
|
||||
let range = if p.get("mask").is_none_or(Value::is_null) {
|
||||
e.def().and_then(|d| d.param(&pid)).and_then(|d| match d.kind {
|
||||
filmcraft_project::ParamKind::Float { min, max, .. } => Some((min, max)),
|
||||
_ => None,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let prm = crate::masks::target_param(e, p, &pid).ok_or_else(|| bad("keyframe", "no such param"))?;
|
||||
match op {
|
||||
"add" => {
|
||||
@@ -4375,6 +4384,17 @@ fn keyframe_op(s: &mut Session, p: &Value, op: &str) -> Result<Value> {
|
||||
let added = !prm.remove_keyframe_at(mt_now);
|
||||
if added {
|
||||
prm.add_keyframe(mt_now);
|
||||
if let Some(v) = p.get("value")
|
||||
&& let Some(k) = prm.keyframes.iter_mut().find(|k| k.time == mt_now)
|
||||
{
|
||||
let value = json_to_param(&k.value, v).ok_or_else(|| bad("keyframe", "value has the wrong type"))?;
|
||||
if let (Some((min, max)), ParamValue::Float(x)) = (range, &value)
|
||||
&& !(min..=max).contains(x)
|
||||
{
|
||||
return Err(bad("keyframe", format!("`{pid}` must be between {min} and {max}, got {x}")));
|
||||
}
|
||||
k.value = value;
|
||||
}
|
||||
}
|
||||
reply = json!({"added": added, "mediaTime": mt_now.0});
|
||||
}
|
||||
|
||||
@@ -373,6 +373,35 @@ fn add_keyframe_toggles_the_keyframe_at_the_playhead() {
|
||||
assert_eq!(scale(&s), (2, 50.0));
|
||||
s.redo();
|
||||
assert_eq!(scale(&s), (1, 100.0));
|
||||
// A value graph double-click sends the sampled value with the timeline time (#1277).
|
||||
let at = filmcraft_time::Tick::from_seconds_f64(1.0);
|
||||
s.execute("effects.addKeyframe", json!({"clip": c, "effect": "motion", "param": "scale", "time": at.0, "value": 40.0})).unwrap();
|
||||
let it = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(c)).unwrap().1;
|
||||
let p = &it.effect("motion").unwrap().params["scale"];
|
||||
let kf = p.keyframes.iter().find(|k| k.time == it.source_time_at(at)).expect("keyframe at 1s");
|
||||
assert_eq!(kf.value, filmcraft_project::ParamValue::Float(40.0));
|
||||
// The diamond still removes a keyframe that is already there, and ignores a value on that click.
|
||||
s.execute("effects.addKeyframe", json!({"clip": c, "effect": "motion", "param": "scale", "time": at.0, "value": 10.0})).unwrap();
|
||||
let it = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(c)).unwrap().1;
|
||||
let p = &it.effect("motion").unwrap().params["scale"];
|
||||
assert!(p.keyframes.iter().all(|k| k.time != it.source_time_at(at)));
|
||||
// Position is a point: the graph sends [x, y]. A single number is the wrong type and adds nothing.
|
||||
let at = filmcraft_time::Tick::from_seconds_f64(1.5);
|
||||
s.execute("effects.addKeyframe", json!({"clip": c, "effect": "motion", "param": "position", "time": at.0, "value": [120.0, 80.0]})).unwrap();
|
||||
let it = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(c)).unwrap().1;
|
||||
let p = &it.effect("motion").unwrap().params["position"];
|
||||
let kf = p.keyframes.iter().find(|k| k.time == it.source_time_at(at)).expect("position keyframe");
|
||||
assert_eq!(kf.value, filmcraft_project::ParamValue::Vec2(filmcraft_geom::Vec2::new(120.0, 80.0)));
|
||||
// A value outside the parameter's hard range is refused, as `effects.setParam` refuses it.
|
||||
let out = filmcraft_time::Tick::from_seconds_f64(0.5);
|
||||
assert!(s.execute("effects.addKeyframe", json!({"clip": c, "effect": "motion", "param": "scale", "time": out.0, "value": 10001.0})).is_err());
|
||||
let it = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(c)).unwrap().1;
|
||||
assert!(it.effect("motion").unwrap().params["scale"].keyframes.iter().all(|k| k.time != it.source_time_at(out)));
|
||||
let bad = filmcraft_time::Tick::from_seconds_f64(2.0);
|
||||
assert!(s.execute("effects.addKeyframe", json!({"clip": c, "effect": "motion", "param": "position", "time": bad.0, "value": 40.0})).is_err());
|
||||
let it = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(c)).unwrap().1;
|
||||
let p = &it.effect("motion").unwrap().params["position"];
|
||||
assert!(p.keyframes.iter().all(|k| k.time != it.source_time_at(bad)));
|
||||
// parameters that name nothing are errors and change nothing
|
||||
for bad in [
|
||||
json!({}),
|
||||
|
||||
@@ -290,3 +290,36 @@ than one clip is selected, matching the existing Speed control.
|
||||
|
||||
`clip_dialogs_ui::duration_text_edits_speed_and_rejects_invalid_input` exercises real
|
||||
text input, validation, application, Cancel, and Undo/Redo.
|
||||
|
||||
## Export preview (#1388)
|
||||
|
||||
Export includes a seek bar, sequence timecode / last selected frame, Play/Stop, previous/next
|
||||
frame and start/end buttons. Space, Left/Right and Shift+I/Shift+O address the sequence while
|
||||
Export is open, even if Source previously had focus. Export-preview automation commands require
|
||||
Export mode. Dragging the seek bar pauses playback and follows the existing scrub-audio preference
|
||||
through the shared per-frame scrub handler. Playback uses the existing sequence audio clock,
|
||||
prefetch and preroll; cached pictures remain visible while the next frame renders.
|
||||
|
||||
The seek bar and playback respect Entire Source, Source In/Out (inclusive Out), Work Area and
|
||||
Custom. Playback stops on the last selected frame; Play there restarts at the range start.
|
||||
If a range change excludes the playing frame, playback stops at the nearest new boundary,
|
||||
including during preroll. Playback and in-range seeks do not show cached pictures outside
|
||||
the selected range; explicitly positioned paused-frame inspection is preserved.
|
||||
Export does not loop even if Program looping is enabled; the Program preference is preserved.
|
||||
Navigation changes the shared sequence playhead without altering clips, marks, export settings,
|
||||
dirty state or undo history. Audio-only formats keep audition and navigation controls.
|
||||
Entering Export finishes any active editing/recording transport. Preview playback never starts
|
||||
mixer automation, multicamera recording or voice-over capture, including with a mixer strip in Write mode.
|
||||
The details below the picture scroll on smaller windows, leaving the Export buttons accessible.
|
||||
|
||||
The picture previews sequence composition at reduced resolution with output dimensions/aspect
|
||||
and Fit/Fill/Stretch framing. It does not simulate encoder compression, output frame-rate
|
||||
conversion, export-only overlays, colour conversion or audio encoding/processing. It auditions
|
||||
the sequence mix; the Export Audio checkbox does not mute audition. Rendered-frame monitoring
|
||||
during an export job is separate and is not added here.
|
||||
|
||||
Automation: `export.preview.seek {frame: i64}`, `.toggle`, `.first`, `.last`, `.stepBack` and
|
||||
`.stepForward` are UI commands (`ui.menu.invoke`); the seek widget is `export.preview.scrub`,
|
||||
the readout is `export.preview.timecode`. Invalid seek arguments fail without changing state.
|
||||
Unit and headless UI regressions cover range boundaries, hostile values, keyboard routing,
|
||||
play/stop, stepping, pointer scrubbing, and preservation of project/export state.
|
||||
@@ -1,12 +1,22 @@
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use super::play_ahead;
|
||||
use super::{AUDIO_RETRY_S, AUDIO_STALL_S, FilmcraftApp, Tick, frames, json, panels, shuttle};
|
||||
use crate::state;
|
||||
#[cfg(test)]
|
||||
use filmcraft_engine::Session;
|
||||
|
||||
impl FilmcraftApp {
|
||||
// ---------------------------------------------------------------- playback
|
||||
|
||||
/// Finish editing/recording transport before entering read-only Export preview.
|
||||
pub(crate) fn set_mode(&mut self, mode: state::Mode) {
|
||||
if mode == state::Mode::Export && self.ui.mode != mode {
|
||||
self.stop();
|
||||
self.stop_source();
|
||||
}
|
||||
self.ui.mode = mode;
|
||||
}
|
||||
|
||||
pub fn toggle_play(&mut self, speed: f64) {
|
||||
if self.playback.playing {
|
||||
self.stop();
|
||||
@@ -56,15 +66,18 @@ impl FilmcraftApp {
|
||||
self.playback.anchor_tick = self.session.playhead();
|
||||
self.playback.audio_seen = (0, now);
|
||||
self.start_audio(now);
|
||||
// Audio Track Mixer: an automation pass runs while playing forward in real time
|
||||
if (self.playback.speed - 1.0).abs() < 1e-9 && !self.session.mixrec.active() {
|
||||
let t = self.session.playhead();
|
||||
let _ = self.session.execute("mixer.recordStart", json!({"time": t.0}));
|
||||
// Export preview is read-only: never arm editing/recording passes from its transport.
|
||||
if self.ui.mode != state::Mode::Export {
|
||||
// Audio Track Mixer: an automation pass runs while playing forward in real time
|
||||
if (self.playback.speed - 1.0).abs() < 1e-9 && !self.session.mixrec.active() {
|
||||
let t = self.session.playhead();
|
||||
let _ = self.session.execute("mixer.recordStart", json!({"time": t.0}));
|
||||
}
|
||||
// Multi-Camera view: playing records live cuts (keys 1–9 / clicking angles)
|
||||
panels::multicam::on_play(self);
|
||||
// voice-over: the capture starts with the audio clock
|
||||
panels::voiceover::on_play(self);
|
||||
}
|
||||
// Multi-Camera view: playing records live cuts (keys 1–9 / clicking angles)
|
||||
panels::multicam::on_play(self);
|
||||
// voice-over: the capture starts with the audio clock
|
||||
panels::voiceover::on_play(self);
|
||||
}
|
||||
|
||||
/// Play the last Text to Speech preview (`Session::tts_preview`) on the audio output, stopping
|
||||
@@ -230,11 +243,27 @@ impl FilmcraftApp {
|
||||
|
||||
/// Advance the Program playhead only while playing; owns preroll completion, audio-clock anchoring, output retry and the fallback to wall time when audio
|
||||
/// is lost or stalls.
|
||||
pub(super) fn advance_playback(&mut self, ctx: &egui::Context) {
|
||||
pub(crate) fn advance_playback(&mut self, ctx: &egui::Context) {
|
||||
if !self.playback.playing {
|
||||
self.playback.smooth_playhead = None;
|
||||
return;
|
||||
}
|
||||
// Range edits can exclude the current frame in either playback direction, even
|
||||
// while preroll is waiting. Stop before the old clock or buffered audio advances.
|
||||
if self.ui.mode == state::Mode::Export
|
||||
&& let Some((first, last)) = panels::export_mode::preview_bounds(self)
|
||||
{
|
||||
let rate = self.session.sequence_rate();
|
||||
let frame = rate.frame_at(self.session.playhead());
|
||||
let bounded = frame.clamp(first, last);
|
||||
if frame != bounded {
|
||||
self.stop();
|
||||
self.session.set_playhead(rate.tick_of(bounded));
|
||||
self.playback.smooth_playhead = None;
|
||||
ctx.request_repaint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
let now = self.now();
|
||||
if let Some(since) = self.playback.preroll {
|
||||
let since = if since < 0.0 { now } else { since };
|
||||
@@ -302,25 +331,32 @@ impl FilmcraftApp {
|
||||
let t = self.playback.anchor_tick + Tick::from_seconds_f64(elapsed * self.playback.speed);
|
||||
let seq = self.session.active_sequence();
|
||||
let dur = seq.map(|q| q.duration()).unwrap_or_default();
|
||||
let (lo, hi) = if self.playback.looping {
|
||||
let exporting = self.ui.mode == state::Mode::Export;
|
||||
let looping = self.playback.looping && !exporting;
|
||||
let (lo, hi) = if exporting {
|
||||
panels::export_mode::preview_bounds(self)
|
||||
.map(|(first, last)| (rate.tick_of(first), rate.tick_of(last.saturating_add(1))))
|
||||
.unwrap_or((Tick::ZERO, dur))
|
||||
} else if looping {
|
||||
(seq.and_then(|q| q.mark_in).unwrap_or(Tick::ZERO), seq.and_then(|q| q.mark_out).map(|o| o + rate.frame_duration()).unwrap_or(dur))
|
||||
} else {
|
||||
(Tick::ZERO, dur)
|
||||
};
|
||||
if let Some(end) = self.playback.stop_at.filter(|e| t >= *e && self.playback.speed > 0.0 && !self.playback.looping) {
|
||||
let reverse_end = if exporting { lo } else { Tick::ZERO };
|
||||
if let Some(end) = self.playback.stop_at.filter(|e| !exporting && t >= *e && self.playback.speed > 0.0 && !looping) {
|
||||
self.session.set_playhead(self.playback.rest_at.unwrap_or(end));
|
||||
self.stop();
|
||||
} else if t >= hi && self.playback.speed > 0.0 && (self.playback.looping || !self.session.voiceover.recording()) {
|
||||
} else if t >= hi && self.playback.speed > 0.0 && (exporting || looping || !self.session.voiceover.recording()) {
|
||||
// a voice-over take keeps playing (and recording) into the empty timeline past the end
|
||||
if self.playback.looping {
|
||||
if looping {
|
||||
self.session.set_playhead(lo);
|
||||
self.play(self.playback.speed);
|
||||
} else {
|
||||
self.session.set_playhead(hi - rate.frame_duration());
|
||||
self.stop();
|
||||
}
|
||||
} else if t <= Tick::ZERO && self.playback.speed < 0.0 {
|
||||
self.session.set_playhead(Tick::ZERO);
|
||||
} else if t <= reverse_end && self.playback.speed < 0.0 {
|
||||
self.session.set_playhead(reverse_end);
|
||||
self.stop();
|
||||
} else {
|
||||
self.session.set_playhead(t);
|
||||
@@ -330,6 +366,57 @@ impl FilmcraftApp {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod export_recording_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn export_preview_never_arms_or_writes_mixer_automation() {
|
||||
let mut session = Session::default();
|
||||
session.execute("file.openDemoProject", json!({})).unwrap();
|
||||
session.execute("mixer.setStrip", json!({"strip": "A1", "mode": "Write"})).unwrap();
|
||||
let mut app = FilmcraftApp::new(session);
|
||||
app.audio = None;
|
||||
app.set_mode(state::Mode::Export);
|
||||
app.ui.export.range = "custom".into();
|
||||
app.ui.export.custom_end = 1.0;
|
||||
let before = serde_json::to_value(&app.session.project).unwrap();
|
||||
let undo = app.session.undo_mark();
|
||||
let revision = app.session.revision;
|
||||
let ctx = egui::Context::default();
|
||||
panels::export_mode::preview_command(&mut app, "export.preview.toggle", &json!({})).unwrap();
|
||||
app.end_preroll(0.0);
|
||||
assert!(!app.session.mixrec.active(), "Export must not start a Write automation pass");
|
||||
app.set_now_for_test(2.0);
|
||||
let mut output = ctx.run_ui(egui::RawInput::default(), |ui| app.advance_playback(ui.ctx()));
|
||||
output.textures_delta.clear();
|
||||
assert!(!app.playback.playing);
|
||||
assert_eq!(serde_json::to_value(&app.session.project).unwrap(), before);
|
||||
assert_eq!(app.session.undo_mark(), undo);
|
||||
assert_eq!(app.session.revision, revision);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn entering_export_finishes_an_existing_voiceover_take_and_editing_pass() {
|
||||
let mut session = Session::default();
|
||||
session.execute("file.openDemoProject", json!({})).unwrap();
|
||||
session.execute("audio.voiceover.settings", json!({"prerollSeconds": 0.0})).unwrap();
|
||||
let mut app = FilmcraftApp::new(session);
|
||||
app.audio = None;
|
||||
app.ui.mode = state::Mode::Edit;
|
||||
panels::voiceover::toggle(&mut app, None).unwrap();
|
||||
app.end_preroll(0.0);
|
||||
assert!(app.playback.playing && app.session.voiceover.recording());
|
||||
assert!(app.session.mixrec.active(), "normal Edit playback still records automation");
|
||||
let ctx = egui::Context::default();
|
||||
crate::menus::invoke(&mut app, &ctx, "mode.export", json!({})).unwrap();
|
||||
assert_eq!(app.ui.mode, state::Mode::Export);
|
||||
assert!(!app.playback.playing);
|
||||
assert!(!app.session.voiceover.recording());
|
||||
assert!(!app.session.mixrec.active());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod clock_tests {
|
||||
use super::*;
|
||||
|
||||
@@ -141,11 +141,12 @@ fn handle_ui_set(app: &mut FilmcraftApp, ctx: &egui::Context, p: &Value) -> Outc
|
||||
}
|
||||
}
|
||||
if let Some(m) = s("mode") {
|
||||
app.ui.mode = match m.to_ascii_lowercase().as_str() {
|
||||
let mode = match m.to_ascii_lowercase().as_str() {
|
||||
"import" => Mode::Import,
|
||||
"export" => Mode::Export,
|
||||
_ => Mode::Edit,
|
||||
};
|
||||
app.set_mode(mode);
|
||||
}
|
||||
if let Some(th) = s("theme") {
|
||||
match crate::theme::ThemeKind::from_name(th) {
|
||||
|
||||
@@ -56,7 +56,7 @@ pub fn show(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
p.line_segment([pos2(x, rect.min.y + 29.0), pos2(x + gw, rect.min.y + 29.0)], Stroke::new(2.0, t.tab_text_active));
|
||||
}
|
||||
if resp.clicked() {
|
||||
app.ui.mode = m;
|
||||
app.set_mode(m);
|
||||
}
|
||||
x += gw + 24.0;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ pub fn show(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
app.show_panel(crate::dock::PanelKind::Effects);
|
||||
}
|
||||
if btn(ui, Icon::Bell, "notifications", tl!("Progress"), app).clicked() {
|
||||
app.ui.mode = Mode::Export;
|
||||
app.set_mode(Mode::Export);
|
||||
}
|
||||
// Quick Export: a popup with File Name & Location, a preset list and Export (Premiere 26)
|
||||
let qx = rect.max.x - 14.0 - 4.0 * 38.0; // the fifth button from the right
|
||||
|
||||
@@ -3616,6 +3616,7 @@
|
||||
Open a sequence to search its graphics Otvorite sekvencu da pretražite njene grafike
|
||||
No text graphics in this sequence. Add text with the Type tool. U ovoj sekvenci nema tekstualnih grafika. Dodajte tekst alatom za tekst.
|
||||
No matching text. Nema odgovarajućeg teksta.
|
||||
Set Playhead Postavi glavu za reprodukciju
|
||||
H.265 (HEVC) needs a hardware encoder (NVENC on NVIDIA GPUs, VideoToolbox on macOS); none was found on this machine, and FilmCraft has no software H.265 encoder yet. Choose H.264 or ProRes instead. H.265 (HEVC) zahtijeva hardverski enkoder (NVENC na NVIDIA GPU-ovima, VideoToolbox na macOS-u); na ovom računaru nije pronađen nijedan, a FilmCraft još nema softverski H.265 enkoder. Umjesto toga odaberite H.264 ili ProRes.
|
||||
AV1 needs a hardware encoder; none was found on this machine, and FilmCraft has no software AV1 encoder yet. AV1 zahtijeva hardverski enkoder; na ovom računaru nije pronađen nijedan, a FilmCraft još nema softverski AV1 enkoder.
|
||||
Hardware decoding: Auto uses the system's video decoder (VideoToolbox on macOS, Media Foundation on Windows, VA-API for H.264 and HEVC on Linux) for the streams it supports, and FilmCraft's own decoder for everything else or if the hardware fails. Media that is already open keeps its decoder until it is reopened. Hardversko dekodiranje: Automatski koristi video dekoder sistema (VideoToolbox na macOS-u, Media Foundation na Windowsu, VA-API za H.264 i HEVC na Linuxu) za tokove koje podržava, a FilmCraftov vlastiti dekoder za sve ostalo ili ako hardver zakaže. Mediji koji su već otvoreni zadržavaju svoj dekoder dok se ponovo ne otvore.
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2391 and column 7.
|
@@ -3610,6 +3610,7 @@
|
||||
no Korean font is installed on this system; the interface stays in English v systému není nainstalováno korejské písmo; rozhraní zůstává v angličtině
|
||||
Animate zoom, scrolling and menus Animovat přibližování, posouvání a nabídky
|
||||
No matching text. Žádný odpovídající text.
|
||||
Set Playhead Nastavit přehrávací hlavu
|
||||
No text graphics in this sequence. Add text with the Type tool. V této sekvenci nejsou žádné textové grafiky. Přidejte text nástrojem Text.
|
||||
Open a sequence to search its graphics Pro hledání v grafikách otevřete sekvenci
|
||||
Reset Interface Zoom Obnovit měřítko rozhraní
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2377 and column 7.
|
@@ -3620,6 +3620,7 @@
|
||||
Shows the version, community links and credits in a FilmCraft window. Zeigt Version, Community-Links und Credits in einem FilmCraft-Fenster.
|
||||
Couldn't open your web browser Dein Webbrowser konnte nicht geöffnet werden
|
||||
Open this address in your browser yourself: Öffne diese Adresse selbst in deinem Browser:
|
||||
Set Playhead Abspielposition setzen
|
||||
|
||||
# Control server: the status-bar notice when --control cannot serve.
|
||||
The control server is disabled: FILMCRAFT_CONTROL_TOKEN must contain 64 random hex characters (see docs/control-protocol.md) Der Kontrollserver ist deaktiviert: FILMCRAFT_CONTROL_TOKEN muss 64 zufällige Hexzeichen enthalten (siehe docs/control-protocol.md)
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 45.
|
@@ -3641,6 +3641,7 @@
|
||||
Open a sequence to search its graphics Abre una secuencia para buscar en sus gráficos
|
||||
No text graphics in this sequence. Add text with the Type tool. Esta secuencia no tiene gráficos con texto. Añade texto con la herramienta Texto.
|
||||
No matching text. Ningún texto coincide.
|
||||
Set Playhead Establecer cabezal
|
||||
# Markers: the Edit Marker dialog (#2416).
|
||||
Edit Marker… Editar marcador…
|
||||
In: Entrada:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 3 and column 95.
|
@@ -3601,6 +3601,7 @@
|
||||
Open a sequence to search its graphics Ouvrez une séquence pour rechercher dans ses graphiques
|
||||
No text graphics in this sequence. Add text with the Type tool. Aucun graphique avec du texte dans cette séquence. Ajoutez du texte avec l'outil Texte.
|
||||
No matching text. Aucun texte ne correspond.
|
||||
Set Playhead Positionner la tête de lecture
|
||||
|
||||
# Marker editing and shared custom colors
|
||||
A range marker needs a positive duration Un marqueur de plage doit avoir une durée positive
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 83.
|
@@ -3595,6 +3595,7 @@
|
||||
Open a sequence to search its graphics Buka sekuens untuk mencari di grafisnya
|
||||
No text graphics in this sequence. Add text with the Type tool. Tidak ada grafis teks di sekuens ini. Tambahkan teks dengan alat Teks.
|
||||
No matching text. Tidak ada teks yang cocok.
|
||||
Set Playhead Atur kepala putar
|
||||
Enter a positive duration within the supported speed range. Masukkan durasi positif dalam rentang kecepatan yang didukung.
|
||||
Show Video Names Tampilkan Nama Video
|
||||
Show Audio Names Tampilkan Nama Audio
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 14.
|
@@ -3621,6 +3621,7 @@
|
||||
Open a sequence to search its graphics Apri una sequenza per cercare nelle sue grafiche
|
||||
No text graphics in this sequence. Add text with the Type tool. Nessuna grafica con testo in questa sequenza. Aggiungi testo con lo strumento Testo.
|
||||
No matching text. Nessun testo corrispondente.
|
||||
Set Playhead Imposta indicatore di riproduzione
|
||||
Enter a positive duration within the supported speed range. Inserisci una durata positiva nell’intervallo di velocità supportato.
|
||||
Show Video Names Mostra nomi video
|
||||
Show Audio Names Mostra nomi audio
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 3 and column 95.
|
@@ -3649,6 +3649,7 @@
|
||||
Open a sequence to search its graphics シーケンスを開くとグラフィックスを検索できます
|
||||
No text graphics in this sequence. Add text with the Type tool. このシーケンスにはテキストのグラフィックスがありません。文字ツールでテキストを追加してください。
|
||||
No matching text. 一致するテキストはありません。
|
||||
Set Playhead 再生ヘッドを設定
|
||||
# Markers: the Edit Marker dialog (#2416).
|
||||
Edit Marker… マーカーを編集…
|
||||
In: イン:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 59.
|
@@ -3616,6 +3616,7 @@
|
||||
Open a sequence to search its graphics 그래픽을 검색하려면 시퀀스를 여세요
|
||||
No text graphics in this sequence. Add text with the Type tool. 이 시퀀스에는 텍스트 그래픽이 없습니다. 문자 도구로 텍스트를 추가하세요.
|
||||
No matching text. 일치하는 텍스트가 없습니다.
|
||||
Set Playhead 재생 헤드 설정
|
||||
Enter a positive duration within the supported speed range. 지원되는 속도 범위 내에서 양수인 길이를 입력하세요.
|
||||
Show Video Names 비디오 이름 표시
|
||||
Show Audio Names 오디오 이름 표시
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2827 and column 7.
|
@@ -3620,6 +3620,7 @@
|
||||
Open a sequence to search its graphics Otwórz sekwencję, aby przeszukać jej grafiki
|
||||
No text graphics in this sequence. Add text with the Type tool. Ta sekwencja nie zawiera grafik z tekstem. Dodaj tekst narzędziem Tekst.
|
||||
No matching text. Brak pasującego tekstu.
|
||||
Set Playhead Ustaw głowicę
|
||||
H.265 (HEVC) needs a hardware encoder (NVENC on NVIDIA GPUs, VideoToolbox on macOS); none was found on this machine, and FilmCraft has no software H.265 encoder yet. Choose H.264 or ProRes instead. H.265 (HEVC) wymaga sprzętowego kodera (NVENC na kartach NVIDIA, VideoToolbox w macOS); na tym komputerze nie znaleziono żadnego, a FilmCraft nie ma jeszcze programowego kodera H.265. Wybierz H.264 lub ProRes.
|
||||
AV1 needs a hardware encoder; none was found on this machine, and FilmCraft has no software AV1 encoder yet. AV1 wymaga sprzętowego kodera; na tym komputerze nie znaleziono żadnego, a FilmCraft nie ma jeszcze programowego kodera AV1.
|
||||
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 50.
|
@@ -3598,6 +3598,7 @@
|
||||
Open a sequence to search its graphics Abra uma sequência para pesquisar nos gráficos dela
|
||||
No text graphics in this sequence. Add text with the Type tool. Esta sequência não tem gráficos com texto. Adicione texto com a ferramenta Texto.
|
||||
No matching text. Nenhum texto corresponde.
|
||||
Set Playhead Definir cursor de reprodução
|
||||
Enter a positive duration within the supported speed range. Insira uma duração positiva dentro do intervalo de velocidade compatível.
|
||||
Show Video Names Mostrar nomes de vídeo
|
||||
Show Audio Names Mostrar nomes de áudio
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 4.
|
@@ -3571,6 +3571,8 @@
|
||||
Docking Action Действие пристыковки
|
||||
Resize floating panel Изменить размер плавающей панели
|
||||
Project Notes Заметки проекта
|
||||
|
||||
Set Playhead Установить курсор воспроизведения
|
||||
Get Project Notes Получить заметки проекта
|
||||
Edit Project Notes Редактировать заметки проекта
|
||||
Notes for this project: to-dos, instructions, frame numbers… Saved with the project. Заметки для этого проекта: задачи, инструкции, номера кадров… Сохраняются вместе с проектом.
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2378 and column 7.
|
@@ -3621,6 +3621,7 @@
|
||||
Open a sequence to search its graphics Öppna en sekvens för att söka i dess grafik
|
||||
No text graphics in this sequence. Add text with the Type tool. Det finns ingen textgrafik i den här sekvensen. Lägg till text med textverktyget.
|
||||
No matching text. Ingen text matchar.
|
||||
Set Playhead Ställ in spelmarkören
|
||||
H.265 (HEVC) needs a hardware encoder (NVENC on NVIDIA GPUs, VideoToolbox on macOS); none was found on this machine, and FilmCraft has no software H.265 encoder yet. Choose H.264 or ProRes instead. H.265 (HEVC) kräver en hårdvarukodare (NVENC på NVIDIA-grafikkort, VideoToolbox på macOS). Ingen hittades på den här datorn, och FilmCraft har ännu ingen programvarukodare för H.265. Välj H.264 eller ProRes i stället.
|
||||
AV1 needs a hardware encoder; none was found on this machine, and FilmCraft has no software AV1 encoder yet. AV1 kräver en hårdvarukodare. Ingen hittades på den här datorn, och FilmCraft har ännu ingen programvarukodare för AV1.
|
||||
Checking for updates… Söker efter uppdateringar…
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 3 and column 95.
|
@@ -3623,6 +3623,7 @@
|
||||
Open a sequence to search its graphics Grafiklerinde arama yapmak için bir sekans açın
|
||||
No text graphics in this sequence. Add text with the Type tool. Bu sekansta metin grafiği yok. Yazım aracıyla metin ekleyin.
|
||||
No matching text. Eşleşen metin yok.
|
||||
Set Playhead Oynatma Kafasını Ayarla
|
||||
H.265 (HEVC) needs a hardware encoder (NVENC on NVIDIA GPUs, VideoToolbox on macOS); none was found on this machine, and FilmCraft has no software H.265 encoder yet. Choose H.264 or ProRes instead. H.265 (HEVC) bir donanım kodlayıcısı gerektirir (NVIDIA GPU'larda NVENC, macOS'ta VideoToolbox); bu makinede hiçbiri bulunamadı ve FilmCraft henüz yazılımsal H.265 kodlayıcıya sahip değil. Bunun yerine H.264 veya ProRes seçin.
|
||||
AV1 needs a hardware encoder; none was found on this machine, and FilmCraft has no software AV1 encoder yet. AV1 bir donanım kodlayıcısı gerektirir; bu makinede hiçbiri bulunamadı ve FilmCraft henüz yazılımsal AV1 kodlayıcıya sahip değil.
|
||||
Hardware decoding: Auto uses the system's video decoder (VideoToolbox on macOS, Media Foundation on Windows, VA-API for H.264 and HEVC on Linux) for the streams it supports, and FilmCraft's own decoder for everything else or if the hardware fails. Media that is already open keeps its decoder until it is reopened. Donanım kod çözme: Otomatik, desteklediği akışlar için sistemin video kod çözücüsünü (macOS'ta VideoToolbox, Windows'ta Media Foundation, Linux'ta H.264 ve HEVC için VA-API), diğer her şey veya donanım başarısız olduğunda ise FilmCraft'ın kendi kod çözücüsünü kullanır. Zaten açık olan medya yeniden açılana kadar kod çözücüsünü korur.
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 3 and column 95.
|
@@ -362,6 +362,7 @@
|
||||
Zoom to Sequence Умістити секвенцію
|
||||
Project Notes Нотатки проєкту
|
||||
|
||||
Set Playhead Установити курсор відтворення
|
||||
# Marker editing and shared custom colors
|
||||
A range marker needs a positive duration Тривалість маркера діапазону має бути додатною
|
||||
Add Custom Color Додати власний колір
|
||||
|
||||
|
@@ -3616,6 +3616,7 @@
|
||||
Open a sequence to search its graphics 打开序列以搜索其中的图形
|
||||
No text graphics in this sequence. Add text with the Type tool. 此序列中没有文本图形。请用文字工具添加文本。
|
||||
No matching text. 没有匹配的文本。
|
||||
Set Playhead 设置播放头
|
||||
# Markers: the Edit Marker dialog (#2416).
|
||||
Edit Marker… 编辑标记…
|
||||
In: 入点:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 3 and column 95.
|
+21
-14
@@ -344,23 +344,12 @@ pub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32) {
|
||||
pen.fill(&[(3.5, 3.5), (10.0, 8.0), (3.5, 12.5)]);
|
||||
}
|
||||
GoToIn => {
|
||||
pen.line(&[(5.0, 3.0), (4.0, 3.0), (3.5, 3.5), (3.5, 6.0), (3.0, 7.0), (2.0, 8.0), (3.0, 9.0), (3.5, 10.0), (3.5, 12.5), (4.0, 13.0), (5.0, 13.0)]);
|
||||
// Keep a pronounced waist: a shallow bend collapses to a square bracket at small sizes.
|
||||
pen.line(&[(6.0, 2.0), (4.0, 2.0), (4.0, 6.0), (1.5, 8.0), (4.0, 10.0), (4.0, 14.0), (6.0, 14.0)]);
|
||||
pen.fill(&[(13.0, 3.5), (6.0, 8.0), (13.0, 12.5)]);
|
||||
}
|
||||
GoToOut => {
|
||||
pen.line(&[
|
||||
(11.0, 3.0),
|
||||
(12.0, 3.0),
|
||||
(12.5, 3.5),
|
||||
(12.5, 6.0),
|
||||
(13.0, 7.0),
|
||||
(14.0, 8.0),
|
||||
(13.0, 9.0),
|
||||
(12.5, 10.0),
|
||||
(12.5, 12.5),
|
||||
(12.0, 13.0),
|
||||
(11.0, 13.0),
|
||||
]);
|
||||
pen.line(&[(10.0, 2.0), (12.0, 2.0), (12.0, 6.0), (14.5, 8.0), (12.0, 10.0), (12.0, 14.0), (10.0, 14.0)]);
|
||||
pen.fill(&[(3.0, 3.5), (10.0, 8.0), (3.0, 12.5)]);
|
||||
}
|
||||
PrevEdit => {
|
||||
@@ -991,6 +980,24 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// The transport braces must retain their waist after device-pixel snapping.
|
||||
#[test]
|
||||
fn go_to_braces_keep_a_visible_waist_at_transport_sizes() {
|
||||
for ppp in [1.0, 1.25, 1.5, 2.0] {
|
||||
for size in [9.6, 13.0, 16.8] {
|
||||
for icon in [Icon::GoToIn, Icon::GoToOut] {
|
||||
let shapes = drawn(icon, ppp, size);
|
||||
let Shape::Path(brace) = &shapes[0] else { panic!("missing brace path") };
|
||||
let center_y = 7.7 + size / 2.0;
|
||||
let middle = brace.points.iter().min_by(|a, b| (a.y - center_y).abs().total_cmp(&(b.y - center_y).abs())).unwrap();
|
||||
let stem =
|
||||
brace.points.iter().filter(|p| p.y < center_y - 1.0).min_by(|a, b| (a.y - center_y).abs().total_cmp(&(b.y - center_y).abs())).unwrap();
|
||||
assert!((middle.x - stem.x).abs() * ppp >= 1.0 - 1e-3, "{icon:?}, {ppp}x, {size}: brace collapsed to a square bracket");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The panel menu mark (≡): three lines, the same two gaps, at every scale.
|
||||
#[test]
|
||||
fn menu_mark_lines_are_evenly_spaced() {
|
||||
|
||||
@@ -48,6 +48,12 @@ pub const UI_COMMANDS: &[UiCommand] = &[
|
||||
uic!("source.playback.toggle", "Source Play/Stop", [], None),
|
||||
uic!("source.playback.play", "Play Source", [], None),
|
||||
uic!("source.playback.stop", "Stop Source", [], None),
|
||||
uic!("export.preview.toggle", "Play/Stop", [], None),
|
||||
uic!("export.preview.seek", "Set Playhead", [], None),
|
||||
uic!("export.preview.first", "Go to In", [], None),
|
||||
uic!("export.preview.last", "Go to Out", [], None),
|
||||
uic!("export.preview.stepBack", "Step Back 1 Frame", [], None),
|
||||
uic!("export.preview.stepForward", "Step Forward 1 Frame", [], None),
|
||||
uic!("playback.toggle", "Play/Stop", [], Some("Space")),
|
||||
uic!("playback.forward", "Shuttle Right", [], Some("L")),
|
||||
uic!("playback.stop", "Shuttle Stop", [], Some("K")),
|
||||
@@ -123,7 +129,7 @@ pub const UI_COMMANDS: &[UiCommand] = &[
|
||||
uic!("window.workspace.effects", "Effects", ["Window", "Workspaces"], Some("Alt+Shift+4")),
|
||||
uic!("window.workspace.audio", "Audio", ["Window", "Workspaces"], Some("Alt+Shift+5")),
|
||||
uic!("window.workspace.captionsandgraphics", "Captions and Graphics", ["Window", "Workspaces"], Some("Alt+Shift+6")),
|
||||
uic!("window.workspace.script", "Script", ["Window", "Workspaces"], None),
|
||||
uic!("window.workspace.script", "Lined Script", ["Window", "Workspaces"], None),
|
||||
uic!("script.openPanel", "Open Script", [], None),
|
||||
uic!("script.findInScript", "Find in Script", [], None),
|
||||
uic!("script.addMarkAtSelection", "Add Script Mark", [], None),
|
||||
@@ -182,6 +188,13 @@ pub const UI_COMMANDS: &[UiCommand] = &[
|
||||
uic!("app.settings.trim", "Trim…", ["Edit", "Preferences"], None),
|
||||
];
|
||||
|
||||
fn panel_menu_label(panel: PanelKind) -> &'static str {
|
||||
match panel {
|
||||
PanelKind::Script => "Lined Script",
|
||||
_ => panel.title(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn panel_command_id(p: PanelKind) -> String {
|
||||
format!("window.panel.{}", p.id())
|
||||
}
|
||||
@@ -191,7 +204,7 @@ pub fn targets_source(app: &FilmcraftApp, params: &Value) -> bool {
|
||||
match params.get("monitor").and_then(Value::as_str) {
|
||||
Some("source") => true,
|
||||
Some(_) => false,
|
||||
None => app.ui.focused == PanelKind::Source,
|
||||
None => app.ui.mode != Mode::Export && app.ui.focused == PanelKind::Source,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,9 +226,30 @@ pub(crate) fn menu_items_with_focus(app: &FilmcraftApp, ctx: &egui::Context) ->
|
||||
items
|
||||
}
|
||||
|
||||
/// Export owns the transport even if Source had focus before changing workspaces.
|
||||
fn export_preview_command<'a>(app: &FilmcraftApp, id: &'a str, params: &Value) -> Option<&'a str> {
|
||||
if id.starts_with("export.preview.") {
|
||||
return Some(id);
|
||||
}
|
||||
if app.ui.mode != Mode::Export || params.get("monitor").is_some_and(|monitor| !monitor.is_null()) {
|
||||
return None;
|
||||
}
|
||||
match id {
|
||||
"playback.toggle" => Some("export.preview.toggle"),
|
||||
"playhead.stepBack" => Some("export.preview.stepBack"),
|
||||
"playhead.stepForward" => Some("export.preview.stepForward"),
|
||||
"markers.goToIn" => Some("export.preview.first"),
|
||||
"markers.goToOut" => Some("export.preview.last"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute a UI or engine command by id.
|
||||
pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut params: Value) -> Result<Value, String> {
|
||||
app.ui.script.sync_project(&app.session.project_instance);
|
||||
if let Some(command) = export_preview_command(app, id, ¶ms) {
|
||||
return crate::panels::export_mode::preview_command(app, command, ¶ms);
|
||||
}
|
||||
// Select All / Deselect All act on the Project panel's items when it has focus (#168), only
|
||||
// what the shown bin lists (#456). Here and not in the key handling: on macOS the native menu
|
||||
// takes Cmd+A once Select All is enabled (a sequence is open) and sends the id here (#1752).
|
||||
@@ -587,7 +621,7 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
"mode.export" => {
|
||||
app.ui.mode = Mode::Export;
|
||||
app.set_mode(Mode::Export);
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
"app.checkForUpdates" => {
|
||||
@@ -622,7 +656,7 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
// File ▸ Export ▸ Media… opens the Export mode, like ⌘M (#382); with a path it exports directly.
|
||||
"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;
|
||||
app.set_mode(Mode::Export);
|
||||
return Ok(json!({"mode": "export"}));
|
||||
}
|
||||
// Audio Gain from the menu or G opens the dialog; with params it applies directly.
|
||||
@@ -756,6 +790,13 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
{
|
||||
return app.file_dialog(id, ¶ms);
|
||||
}
|
||||
// Stepping a frame or jumping to an edit point parks the playhead: playback stops, then the
|
||||
// step lands on its frame, as in Premiere Pro (#4655). Left running, the playback clock would
|
||||
// carry the playhead on from its anchor on the next pass and overwrite the step. Stopping
|
||||
// first ends an automation pass where playback actually was, not where the step lands.
|
||||
if parks_playhead(id) && app.playback.playing {
|
||||
app.stop();
|
||||
}
|
||||
let save_path = params.get("path").and_then(Value::as_str).map(str::to_string);
|
||||
let r = app.session.execute(id, params).map_err(|e| e.to_string());
|
||||
if let Err(e) = &r {
|
||||
@@ -783,6 +824,22 @@ pub fn invoke_command(app: &mut FilmcraftApp, ctx: &egui::Context, id: &str, mut
|
||||
r
|
||||
}
|
||||
|
||||
/// Commands that move the playhead a frame or to an edit point: playback stops where they land,
|
||||
/// as Premiere Pro's Step and Go to Edit Point keys do (#4655).
|
||||
fn parks_playhead(id: &str) -> bool {
|
||||
matches!(
|
||||
id,
|
||||
"playhead.stepBack"
|
||||
| "playhead.stepForward"
|
||||
| "playhead.stepBack5"
|
||||
| "playhead.stepForward5"
|
||||
| "playhead.prevEdit"
|
||||
| "playhead.nextEdit"
|
||||
| "playhead.prevEditAnyTrack"
|
||||
| "playhead.nextEditAnyTrack"
|
||||
)
|
||||
}
|
||||
|
||||
/// Tell the status bar where a project save went (File ▸ Save, Save As, Save a Copy).
|
||||
pub(crate) fn saved_status(app: &mut FilmcraftApp, id: &str, path: &str) {
|
||||
match id {
|
||||
@@ -1147,7 +1204,7 @@ pub fn menu_items_for(session: &filmcraft_engine::Session) -> Vec<MenuItem> {
|
||||
for p in PanelKind::ALL {
|
||||
out.push(MenuItem {
|
||||
id: panel_command_id(p),
|
||||
label: p.title().into(),
|
||||
label: panel_menu_label(p).into(),
|
||||
path: vec!["Window".into()],
|
||||
shortcut: session.shortcuts.primary(&panel_command_id(p)),
|
||||
enabled: true,
|
||||
@@ -1318,7 +1375,7 @@ pub fn external_commands() -> Vec<filmcraft_engine::shortcuts::CommandInfo> {
|
||||
let mut v: Vec<CommandInfo> =
|
||||
UI_COMMANDS.iter().chain(crate::panels::keyboard::COMMANDS).map(|c| CommandInfo::new(c.id, c.label, c.menu, c.shortcut)).collect();
|
||||
for p in PanelKind::ALL {
|
||||
v.push(CommandInfo::new(&panel_command_id(p), p.title(), &["Window"], p.window_shortcut()));
|
||||
v.push(CommandInfo::new(&panel_command_id(p), panel_menu_label(p), &["Window"], p.window_shortcut()));
|
||||
}
|
||||
v
|
||||
}
|
||||
@@ -1663,8 +1720,11 @@ mod tests {
|
||||
assert!(items.iter().all(|it| it.path.first().is_some_and(|top| MENUS.contains(&top.as_str()))));
|
||||
let ws: Vec<&MenuItem> = items.iter().filter(|it| it.path == ["Window", "Workspaces"]).collect();
|
||||
for name in crate::dock::WORKSPACES {
|
||||
assert!(ws.iter().any(|it| it.label == name && it.checked.is_none()), "no workspace {name}");
|
||||
let id = format!("window.workspace.{}", crate::dock::slug(name));
|
||||
assert!(ws.iter().any(|it| it.id == id && it.checked.is_none()), "no workspace {name}");
|
||||
}
|
||||
assert!(ws.iter().any(|it| it.id == "window.workspace.script" && it.label == "Lined Script"));
|
||||
assert!(items.iter().any(|it| it.id == "window.panel.Script" && it.path == ["Window"] && it.label == "Lined Script"));
|
||||
let editing = ws.iter().position(|it| it.label == "Editing");
|
||||
let reset = ws.iter().position(|it| it.id == "window.workspace.reset");
|
||||
assert!(matches!((editing, reset), (Some(e), Some(r)) if e < r), "workspaces come before the layout commands");
|
||||
|
||||
@@ -1422,7 +1422,8 @@ fn graph_components(v: &ParamValue) -> Vec<f64> {
|
||||
|
||||
/// Value and velocity graphs of an animated scalar or point parameter, drawn across the keyframe
|
||||
/// lane. A point draws an X and a Y curve, and its velocity graph is the speed along its path.
|
||||
/// Keyframes drag vertically (value); Bezier influence handles drag horizontally.
|
||||
/// Keyframes drag vertically (value); Bezier influence handles drag horizontally. A double-click
|
||||
/// on the value graph adds a keyframe at the pointer. The velocity graph stays hover-only.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn graph_rows(
|
||||
app: &mut FilmcraftApp,
|
||||
@@ -1438,6 +1439,12 @@ pub(crate) fn graph_rows(
|
||||
actions: &mut Vec<(String, Value)>,
|
||||
) {
|
||||
let t = app.tokens;
|
||||
let with_mask = |mut v: Value| -> Value {
|
||||
if let Some(k) = mask {
|
||||
v["mask"] = json!(k);
|
||||
}
|
||||
v
|
||||
};
|
||||
let (vr, _) = ui.allocate_exact_size(vec2(body.width(), 110.0), Sense::hover());
|
||||
let (velr, _) = ui.allocate_exact_size(vec2(body.width(), 64.0), Sense::hover());
|
||||
row_line(ui, velr, lane, &t);
|
||||
@@ -1476,6 +1483,60 @@ pub(crate) fn graph_rows(
|
||||
ui.data_mut(|d| d.insert_temp(range_id, (lo, hi, frame)));
|
||||
let area = Rect::from_min_max(pos2(lane.min.x, vr.min.y + 4.0), pos2(lane.max.x, vr.max.y - 4.0));
|
||||
let y_of = |v: f64| area.max.y - ((v - lo) / (hi - lo)) as f32 * area.height();
|
||||
let v_of = |y: f32| lo + ((area.max.y - y) / area.height()) as f64 * (hi - lo);
|
||||
// The plot used to be hover-only, so a double-click never reached the lane (#1277).
|
||||
let plot = ui.interact(area, egui::Id::unique(("kfg-plot", clip.0, idx, mask, pd.id)), Sense::click());
|
||||
if plot.double_clicked()
|
||||
&& let Some(pos) = plot.interact_pointer_pos()
|
||||
{
|
||||
let f = ((pos.x - lane.min.x) / lane.width().max(1.0)).clamp(0.0, 1.0) as f64;
|
||||
// On a frame, so the keyframe navigator (which moves the playhead, kept on frames) can
|
||||
// reach the new keyframe; and inside the clip.
|
||||
let rate = app.session.active_sequence().map(|q| q.settings.frame_rate).unwrap_or_default();
|
||||
let mut timeline = rate.snap_nearest(Tick(it.start.0.saturating_add((f * dur) as i64)));
|
||||
if timeline >= it.end() {
|
||||
timeline = rate.snap((it.end() - Tick(1)).max(it.start));
|
||||
}
|
||||
// Sampled where the command stores the keyframe (a reversed clip runs backwards from its
|
||||
// out point, which `to_media` doesn't model).
|
||||
let sampled = graph_components(¶m.value_at(it.effect_time_at(timeline)));
|
||||
let value = if sampled.len() <= 1 {
|
||||
Some(json!(v_of(pos.y)))
|
||||
} else if sampled.iter().all(|v| v.is_finite()) {
|
||||
// A point is one keyframe. The curve nearer the pointer takes the pointer's value;
|
||||
// the other coordinate keeps the value sampled at that time.
|
||||
let mut moved = sampled;
|
||||
let nearest = moved
|
||||
.iter()
|
||||
.enumerate()
|
||||
.min_by(|(_, a), (_, b)| (y_of(**a) - pos.y).abs().partial_cmp(&(y_of(**b) - pos.y).abs()).unwrap_or(std::cmp::Ordering::Equal))
|
||||
.map(|(i, _)| i);
|
||||
if let Some(ci) = nearest
|
||||
&& let Some(slot) = moved.get_mut(ci)
|
||||
{
|
||||
*slot = v_of(pos.y);
|
||||
}
|
||||
Some(json!(moved))
|
||||
} else {
|
||||
// An automatic (NaN) coordinate has no JSON form: the keyframe takes the sampled point.
|
||||
None
|
||||
};
|
||||
let body = json!({"clip": clip.0, "effect": idx, "param": pd.id, "time": timeline.0});
|
||||
match value {
|
||||
// Insert or update: a double-click on the plot never removes a keyframe (the diamond's
|
||||
// click does), and the value goes through `setParam`'s hard-range check.
|
||||
Some(v) => {
|
||||
let mut body = body;
|
||||
body["value"] = v;
|
||||
body["keyframe"] = json!(true);
|
||||
actions.push(("effects.setParam".into(), with_mask(body)));
|
||||
}
|
||||
None if !param.keyframes.iter().any(|k| k.time == it.effect_time_at(timeline)) => {
|
||||
actions.push(("effects.addKeyframe".into(), with_mask(body)));
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
let p = ui.painter();
|
||||
p.rect_filled(area, 0.0, t.keyframe_plot_bg);
|
||||
for g in 1..4 {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
//! Automation ids: `export.fileName`, `export.location`, `export.preset`, `export.preset.more`,
|
||||
//! `export.format`, `export.section.<video|audio|multiplexer|captions|effects|metadata>`,
|
||||
//! `export.video.*`, `export.audio.*`, `export.effects.*`, `export.metadata.*`, `export.range`,
|
||||
//! `export.scaling`, `export.summary`, `export.estimate`, `export.sendToQueue`, `export.button`,
|
||||
//! `export.preview.seek` (integer `frame`), `export.preview.toggle|first|last|stepBack|stepForward`,
|
||||
//! `export.preview.scrub`, `export.preview.timecode`, `export.scaling`, `export.summary`, `export.estimate`, `export.sendToQueue`, `export.button`,
|
||||
//! `export.queue.start|stop|clear`, `export.queue.item.<id>` and `….<id>.<up|down|cancel|retry|remove>`;
|
||||
//! Preset Manager: `presetManager.search`, `presetManager.favoritesOnly`,
|
||||
//! `presetManager.item.<name>`, `presetManager.favorite.<name>`, `presetManager.saveName`,
|
||||
@@ -45,6 +46,7 @@ use presets::preset_manager;
|
||||
#[cfg(test)]
|
||||
pub(crate) use preview::RANGES;
|
||||
use preview::preview_column;
|
||||
pub(crate) use preview::{preview_bounds, preview_command};
|
||||
use queue::queue_column;
|
||||
pub use quick::quick_export;
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::settings::{DragOptions, combo, drag};
|
||||
use super::{
|
||||
Align2, CUSTOM, Color32, ExportUi, FilmcraftApp, FrameKey, Rect, Reg, Scaling, Sense, Target, Tick, Tokens, active_export_job, export_params, format_bytes,
|
||||
is_export_busy, json, output_path, pos2, vec2,
|
||||
Align2, CUSTOM, Color32, ExportUi, FilmcraftApp, FrameKey, Rect, Reg, Scaling, Sense, Target, Tick, Tokens, Value, active_export_job, export_params,
|
||||
format_bytes, is_export_busy, json, output_path, pos2, vec2,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
@@ -10,6 +10,98 @@ use super::{
|
||||
|
||||
pub(crate) const RANGES: [(&str, &str); 4] = [("entire", "Entire Source"), ("inOut", "Source In/Out"), ("workArea", "Work Area"), ("custom", "Custom")];
|
||||
|
||||
/// First and last visible frames in the export range; invalid ranges still clamp safely.
|
||||
pub(crate) fn preview_bounds(app: &FilmcraftApp) -> Option<(i64, i64)> {
|
||||
let q = app.session.active_sequence()?;
|
||||
let rate = q.settings.frame_rate;
|
||||
let (start, end) = range_ticks(&app.ui.export, q);
|
||||
let maximum = rate.frame_at(Tick::MAX).max(0);
|
||||
let first = rate.frame_at(start).clamp(0, maximum);
|
||||
let last = rate.frame_at(Tick(end.0.saturating_sub(1))).clamp(first, maximum);
|
||||
Some((first, last))
|
||||
}
|
||||
|
||||
/// Navigate the sequence playhead without editing project content or export settings.
|
||||
pub(crate) fn preview_command(app: &mut FilmcraftApp, command: &str, params: &Value) -> Result<Value, String> {
|
||||
if app.ui.mode != crate::state::Mode::Export {
|
||||
return Err("Open Export mode to use its preview controls".into());
|
||||
}
|
||||
let (first, last) = preview_bounds(app).ok_or("Open a sequence to export")?;
|
||||
let rate = app.session.sequence_rate();
|
||||
let current = rate.frame_at(app.session.playhead());
|
||||
if command == "export.preview.toggle" {
|
||||
if app.playback.playing {
|
||||
app.stop();
|
||||
} else {
|
||||
let frame = if current < first || current >= last { first } else { current };
|
||||
app.session.execute("playhead.set", json!({"frame": frame})).map_err(|e| e.to_string())?;
|
||||
app.play(1.0);
|
||||
// Program's restart-at-end preference must not move a one-frame export to zero.
|
||||
app.session.execute("playhead.set", json!({"frame": frame})).map_err(|e| e.to_string())?;
|
||||
app.playback.anchor_tick = app.session.playhead();
|
||||
}
|
||||
return Ok(json!({"playing": app.playback.playing}));
|
||||
}
|
||||
let frame = match command {
|
||||
"export.preview.seek" => params.get("frame").and_then(Value::as_i64).ok_or("Export preview seek needs an integer frame")?,
|
||||
"export.preview.first" => first,
|
||||
"export.preview.last" => last,
|
||||
"export.preview.stepBack" => current.saturating_sub(1),
|
||||
"export.preview.stepForward" => current.saturating_add(1),
|
||||
_ => return Err("Unknown export preview command".into()),
|
||||
}
|
||||
.clamp(first, last);
|
||||
app.stop();
|
||||
app.stop_source();
|
||||
app.session.execute("playhead.set", json!({"frame": frame})).map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Render the export transport and bounded scrubber with stable automation IDs.
|
||||
fn preview_controls(app: &mut FilmcraftApp, ui: &mut egui::Ui) {
|
||||
let Some((first, last)) = preview_bounds(app) else { return };
|
||||
let rate = app.session.sequence_rate();
|
||||
let frame = rate.frame_at(app.session.playhead());
|
||||
let drop = app.session.active_sequence().is_some_and(|q| q.settings.drop_frame);
|
||||
let tc = |f| filmcraft_time::format_timecode_frames(f, rate, drop);
|
||||
let response = ui.label(egui::RichText::new(format!("{} / {}", tc(frame), tc(last))).monospace());
|
||||
app.auto.add_response("export.preview.timecode", &response, &format!("{} / {}", tc(frame), tc(last)));
|
||||
let mut at = frame.clamp(first, last);
|
||||
let response = ui
|
||||
.scope(|ui| {
|
||||
ui.spacing_mut().slider_width = ui.available_width().max(40.0);
|
||||
ui.add(egui::Slider::new(&mut at, first..=last).show_value(false))
|
||||
})
|
||||
.inner;
|
||||
app.auto.add_response("export.preview.scrub", &response, "Preview");
|
||||
if response.changed()
|
||||
&& let Err(e) = crate::menus::invoke(app, ui.ctx(), "export.preview.seek", json!({"frame": at}))
|
||||
{
|
||||
app.ui.status = e;
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
use crate::icons::{self, Icon};
|
||||
for (id, icon, label) in [
|
||||
("export.preview.first", Icon::GoToIn, tl!("Go to In (Shift+I)")),
|
||||
("export.preview.stepBack", Icon::StepBack, tl!("Step Back 1 Frame (Left)")),
|
||||
("export.preview.toggle", if app.playback.playing { Icon::Pause } else { Icon::Play }, tl!("Play-Stop Toggle (Space)")),
|
||||
("export.preview.stepForward", Icon::StepFwd, tl!("Step Forward 1 Frame (Right)")),
|
||||
("export.preview.last", Icon::GoToOut, tl!("Go to Out (Shift+O)")),
|
||||
] {
|
||||
let response = icons::button(ui, icon, 28.0, false, &app.tokens, label);
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, response.enabled(), label));
|
||||
if response.has_focus() {
|
||||
ui.painter().rect_stroke(response.rect, 4.0, egui::Stroke::new(1.0, app.tokens.accent), egui::StrokeKind::Inside);
|
||||
}
|
||||
app.auto.add_response(id, &response, label);
|
||||
if response.clicked()
|
||||
&& let Err(e) = crate::menus::invoke(app, ui.ctx(), id, json!({}))
|
||||
{
|
||||
app.ui.status = e;
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
}
|
||||
pub(super) fn preview_column(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect, seq_id: filmcraft_engine::project::ItemId) {
|
||||
let t = app.tokens;
|
||||
let mut reg = Reg::default();
|
||||
@@ -24,10 +116,36 @@ pub(super) fn preview_column(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Re
|
||||
let frame = rate.frame_at(app.session.playhead());
|
||||
let key = FrameKey { target: Target::Sequence(seq_id), frame, size: 500, revision: app.session.revision, draft: false };
|
||||
let project = app.session.project.clone();
|
||||
app.frames.request(key, rate.tick_of(frame), 0.5, &project, 0);
|
||||
if let Some(img) = app.frames.get(&key) {
|
||||
let ctx = ui.ctx().clone();
|
||||
let tex = app.texture_for(&ctx, "export-preview", key, &img);
|
||||
if app.playback.playing {
|
||||
app.frames.schedule_playback(key, rate, 0.5, &project, app.playback.speed, app.playback.preroll.is_some());
|
||||
if app.playback.preroll.is_some() {
|
||||
app.playback.preroll_ready = app.frames.preroll_ready(key, app.playback.speed, preview_bounds(app).map(|(_, last)| last).unwrap_or(frame));
|
||||
}
|
||||
} else {
|
||||
app.frames.request(key, rate.tick_of(frame), 0.5, &project, 0);
|
||||
}
|
||||
let asked = crate::panels::monitor::asked_before(app, "export-preview", key, app.playback.playing);
|
||||
// Keep one texture, but never show a previous sequence while its replacement renders.
|
||||
let name = "export-preview";
|
||||
if app.texture_key(name).is_some_and(|old| old.target != key.target) {
|
||||
app.textures.remove(name);
|
||||
}
|
||||
let (mut texture, mut shown) = crate::panels::monitor::cpu_texture(app, ui.ctx(), name, key, &asked, None, crate::state::DisplayMode::Composite);
|
||||
// The shared monitor may fall back to an older cached frame. Playing or requesting
|
||||
// a frame within the range must not show an out-of-range stand-in. Preserve the
|
||||
// existing ability to inspect an explicitly positioned frame while paused.
|
||||
if shown.is_some_and(|old| {
|
||||
preview_bounds(app)
|
||||
.is_some_and(|(first, last)| (app.playback.playing || (first..=last).contains(&key.frame)) && !(first..=last).contains(&old.frame))
|
||||
}) {
|
||||
app.textures.remove(name);
|
||||
texture = None;
|
||||
shown = None;
|
||||
}
|
||||
if shown != Some(key) {
|
||||
ui.ctx().request_repaint_after(std::time::Duration::from_millis(16));
|
||||
}
|
||||
if let Some(tex) = texture {
|
||||
let inner = match app.ui.export.settings.scaling {
|
||||
Scaling::StretchToFill => pic,
|
||||
Scaling::ScaleToFit => crate::panels::monitor::fit(pic, q.settings.width as f32, q.settings.height as f32),
|
||||
@@ -39,6 +157,7 @@ pub(super) fn preview_column(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Re
|
||||
ui.painter().with_clip_rect(pic).image(tex, inner, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
|
||||
}
|
||||
} else {
|
||||
app.playback.preroll_ready = true;
|
||||
ui.painter().text(pic.center(), Align2::CENTER_CENTER, tl!("Audio only"), Tokens::ui(13.0), t.text_dim);
|
||||
}
|
||||
reg.add("export.preview", pic, "Preview");
|
||||
@@ -51,102 +170,111 @@ pub(super) fn preview_column(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Re
|
||||
.max_rect(Rect::from_min_max(pos2(rect.min.x + 14.0, pv_area.max.y + 8.0), pos2(rect.max.x - 14.0, rect.max.y - 50.0)))
|
||||
.id_salt("export-right"),
|
||||
);
|
||||
let ex = &mut app.ui.export;
|
||||
let has_work_area = q.work_area.is_some();
|
||||
child.add_enabled_ui(!busy, |child| {
|
||||
child.horizontal_wrapped(|ui| {
|
||||
ui.label(egui::RichText::new(tl!("Range")).color(t.text_dim));
|
||||
let cur = RANGES.iter().find(|(k, _)| *k == ex.range).map(|x| x.1).unwrap_or("Entire Source");
|
||||
let labels: Vec<(String, bool)> = RANGES.iter().map(|(k, l)| (l.to_string(), *k != "workArea" || has_work_area)).collect();
|
||||
if let Some(i) = combo(ui, &mut reg, "export.range", cur, &labels, 140.0) {
|
||||
ex.range = RANGES[i].0.into();
|
||||
}
|
||||
if ex.range == "custom" {
|
||||
drag(ui, &mut reg, "export.range.start", &mut ex.custom_start, DragOptions { range: 0.0..=86_400.0, speed: 0.04, suffix: " s", decimals: 2 });
|
||||
drag(ui, &mut reg, "export.range.end", &mut ex.custom_end, DragOptions { range: 0.0..=86_400.0, speed: 0.04, suffix: " s", decimals: 2 });
|
||||
}
|
||||
let (start, end) = range_ticks(ex, &q);
|
||||
let span = filmcraft_time::TimeRange::from_bounds(start, end);
|
||||
let frames = rate.frame_at(end - Tick(1)).saturating_add(1).saturating_sub(rate.frame_at(start)).max(0);
|
||||
let seconds = format!("{:.3}", span.duration.seconds());
|
||||
let label = if frames == 1 {
|
||||
tlf!("1 frame ({seconds} s)", seconds = seconds)
|
||||
} else {
|
||||
tlf!("{frames} frames ({seconds} s)", frames = frames, seconds = seconds)
|
||||
};
|
||||
let resp = ui.label(egui::RichText::new(&label).color(t.text_dim));
|
||||
reg.add("export.range.duration", resp.rect, label);
|
||||
});
|
||||
let (start, end) = range_ticks(ex, &q);
|
||||
if ex.range == "inOut" && filmcraft_engine::export_tools::single_frame_in_out(&q, filmcraft_time::TimeRange::from_bounds(start, end)) {
|
||||
let warning = tl!("Source In/Out is only 1 frame. Choose Entire Source to export the whole sequence.");
|
||||
let resp = child.add(egui::Label::new(egui::RichText::new(warning).color(t.danger)).wrap());
|
||||
reg.add("export.range.warning", resp.rect, warning);
|
||||
}
|
||||
if ex.settings.has_video() {
|
||||
child.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(tl!("Scaling")).color(t.text_dim));
|
||||
let o = [
|
||||
(Scaling::ScaleToFit, tl!("Scale To Fit")),
|
||||
(Scaling::ScaleToFill, tl!("Scale To Fill")),
|
||||
(Scaling::StretchToFill, tl!("Stretch To Fill")),
|
||||
];
|
||||
let cur = o.iter().find(|(x, _)| *x == ex.settings.scaling).map_or(o[0].1, |x| x.1);
|
||||
let labels: Vec<(String, bool)> = o.iter().map(|(_, l)| (l.to_string(), true)).collect();
|
||||
if let Some(i) = combo(ui, &mut reg, "export.scaling", cur, &labels, 140.0) {
|
||||
ex.settings.scaling = o[i].0;
|
||||
egui::ScrollArea::vertical().id_salt("export-preview-details").show(&mut child, |child| {
|
||||
preview_controls(app, child);
|
||||
let ex = &mut app.ui.export;
|
||||
let has_work_area = q.work_area.is_some();
|
||||
child.add_enabled_ui(!busy, |child| {
|
||||
child.horizontal_wrapped(|ui| {
|
||||
ui.label(egui::RichText::new(tl!("Range")).color(t.text_dim));
|
||||
let cur = RANGES.iter().find(|(k, _)| *k == ex.range).map(|x| x.1).unwrap_or("Entire Source");
|
||||
let labels: Vec<(String, bool)> = RANGES.iter().map(|(k, l)| (l.to_string(), *k != "workArea" || has_work_area)).collect();
|
||||
if let Some(i) = combo(ui, &mut reg, "export.range", cur, &labels, 140.0) {
|
||||
ex.range = RANGES[i].0.into();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// summary
|
||||
let range = range_ticks(ex, &q);
|
||||
let sum = ex.settings.summary(q.settings.width, q.settings.height, rate, q.settings.sample_rate, range.1 - range.0);
|
||||
child.add_space(8.0);
|
||||
let resp = egui::Frame::NONE
|
||||
.fill(t.field_bg)
|
||||
.corner_radius(4.0)
|
||||
.inner_margin(egui::Margin::same(10))
|
||||
.show(&mut child, |ui| {
|
||||
ui.set_width(ui.available_width());
|
||||
ui.label(egui::RichText::new(tl!("Summary")).strong());
|
||||
egui::Grid::new("export-summary-grid").num_columns(2).spacing(vec2(10.0, 3.0)).show(ui, |ui| {
|
||||
let line = |ui: &mut egui::Ui, k: &str, v: &str| {
|
||||
ui.label(egui::RichText::new(crate::i18n::t(k)).color(t.text_dim).size(11.5));
|
||||
ui.add(egui::Label::new(egui::RichText::new(v).size(11.5)).wrap_mode(egui::TextWrapMode::Wrap).halign(egui::Align::Min));
|
||||
ui.end_row();
|
||||
if ex.range == "custom" {
|
||||
drag(
|
||||
ui,
|
||||
&mut reg,
|
||||
"export.range.start",
|
||||
&mut ex.custom_start,
|
||||
DragOptions { range: 0.0..=86_400.0, speed: 0.04, suffix: " s", decimals: 2 },
|
||||
);
|
||||
drag(ui, &mut reg, "export.range.end", &mut ex.custom_end, DragOptions { range: 0.0..=86_400.0, speed: 0.04, suffix: " s", decimals: 2 });
|
||||
}
|
||||
let (start, end) = range_ticks(ex, &q);
|
||||
let span = filmcraft_time::TimeRange::from_bounds(start, end);
|
||||
let frames = rate.frame_at(end - Tick(1)).saturating_add(1).saturating_sub(rate.frame_at(start)).max(0);
|
||||
let seconds = format!("{:.3}", span.duration.seconds());
|
||||
let label = if frames == 1 {
|
||||
tlf!("1 frame ({seconds} s)", seconds = seconds)
|
||||
} else {
|
||||
tlf!("{frames} frames ({seconds} s)", frames = frames, seconds = seconds)
|
||||
};
|
||||
line(ui, "Output", &output_path(ex));
|
||||
line(ui, "", &sum.format);
|
||||
line(ui, "", &sum.video);
|
||||
line(ui, "", &sum.audio);
|
||||
line(
|
||||
ui,
|
||||
"Source",
|
||||
&tlf!(
|
||||
"Sequence, {w}x{h}, {fps} fps, {rate} Hz",
|
||||
w = q.settings.width,
|
||||
h = q.settings.height,
|
||||
fps = rate.label(),
|
||||
rate = q.settings.sample_rate
|
||||
),
|
||||
);
|
||||
line(
|
||||
ui,
|
||||
"Range",
|
||||
&format!(
|
||||
"{} ({:.2} s)",
|
||||
crate::i18n::t(RANGES.iter().find(|(k, _)| *k == ex.range).map(|x| x.1).unwrap_or("")),
|
||||
(range.1 - range.0).seconds()
|
||||
),
|
||||
);
|
||||
let resp = ui.label(egui::RichText::new(&label).color(t.text_dim));
|
||||
reg.add("export.range.duration", resp.rect, label);
|
||||
});
|
||||
})
|
||||
.response;
|
||||
reg.add("export.summary", resp.rect, sum.video.clone());
|
||||
child.add_space(4.0);
|
||||
let est = child.label(egui::RichText::new(tlf!("Estimated file size: {size}", size = format_bytes(sum.estimated_bytes))).color(t.text_dim));
|
||||
reg.add("export.estimate", est.rect, sum.estimated_size.clone());
|
||||
let (start, end) = range_ticks(ex, &q);
|
||||
if ex.range == "inOut" && filmcraft_engine::export_tools::single_frame_in_out(&q, filmcraft_time::TimeRange::from_bounds(start, end)) {
|
||||
let warning = tl!("Source In/Out is only 1 frame. Choose Entire Source to export the whole sequence.");
|
||||
let resp = child.add(egui::Label::new(egui::RichText::new(warning).color(t.danger)).wrap());
|
||||
reg.add("export.range.warning", resp.rect, warning);
|
||||
}
|
||||
if ex.settings.has_video() {
|
||||
child.horizontal(|ui| {
|
||||
ui.label(egui::RichText::new(tl!("Scaling")).color(t.text_dim));
|
||||
let o = [
|
||||
(Scaling::ScaleToFit, tl!("Scale To Fit")),
|
||||
(Scaling::ScaleToFill, tl!("Scale To Fill")),
|
||||
(Scaling::StretchToFill, tl!("Stretch To Fill")),
|
||||
];
|
||||
let cur = o.iter().find(|(x, _)| *x == ex.settings.scaling).map_or(o[0].1, |x| x.1);
|
||||
let labels: Vec<(String, bool)> = o.iter().map(|(_, l)| (l.to_string(), true)).collect();
|
||||
if let Some(i) = combo(ui, &mut reg, "export.scaling", cur, &labels, 140.0) {
|
||||
ex.settings.scaling = o[i].0;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// summary
|
||||
let range = range_ticks(ex, &q);
|
||||
let sum = ex.settings.summary(q.settings.width, q.settings.height, rate, q.settings.sample_rate, range.1 - range.0);
|
||||
child.add_space(8.0);
|
||||
let resp = egui::Frame::NONE
|
||||
.fill(t.field_bg)
|
||||
.corner_radius(4.0)
|
||||
.inner_margin(egui::Margin::same(10))
|
||||
.show(child, |ui| {
|
||||
ui.set_width(ui.available_width());
|
||||
ui.label(egui::RichText::new(tl!("Summary")).strong());
|
||||
egui::Grid::new("export-summary-grid").num_columns(2).spacing(vec2(10.0, 3.0)).show(ui, |ui| {
|
||||
let line = |ui: &mut egui::Ui, k: &str, v: &str| {
|
||||
ui.label(egui::RichText::new(crate::i18n::t(k)).color(t.text_dim).size(11.5));
|
||||
ui.add(egui::Label::new(egui::RichText::new(v).size(11.5)).wrap_mode(egui::TextWrapMode::Wrap).halign(egui::Align::Min));
|
||||
ui.end_row();
|
||||
};
|
||||
line(ui, "Output", &output_path(ex));
|
||||
line(ui, "", &sum.format);
|
||||
line(ui, "", &sum.video);
|
||||
line(ui, "", &sum.audio);
|
||||
line(
|
||||
ui,
|
||||
"Source",
|
||||
&tlf!(
|
||||
"Sequence, {w}x{h}, {fps} fps, {rate} Hz",
|
||||
w = q.settings.width,
|
||||
h = q.settings.height,
|
||||
fps = rate.label(),
|
||||
rate = q.settings.sample_rate
|
||||
),
|
||||
);
|
||||
line(
|
||||
ui,
|
||||
"Range",
|
||||
&format!(
|
||||
"{} ({:.2} s)",
|
||||
crate::i18n::t(RANGES.iter().find(|(k, _)| *k == ex.range).map(|x| x.1).unwrap_or("")),
|
||||
(range.1 - range.0).seconds()
|
||||
),
|
||||
);
|
||||
});
|
||||
})
|
||||
.response;
|
||||
reg.add("export.summary", resp.rect, sum.video.clone());
|
||||
child.add_space(4.0);
|
||||
let est = child.label(egui::RichText::new(tlf!("Estimated file size: {size}", size = format_bytes(sum.estimated_bytes))).color(t.text_dim));
|
||||
reg.add("export.estimate", est.rect, sum.estimated_size.clone());
|
||||
});
|
||||
// buttons
|
||||
let go = Rect::from_min_size(pos2(rect.max.x - 120.0, rect.max.y - 44.0), vec2(104.0, 30.0));
|
||||
let queue = Rect::from_min_size(pos2(go.min.x - 132.0, go.min.y), vec2(122.0, 30.0));
|
||||
@@ -224,3 +352,209 @@ fn range_ticks(ex: &ExportUi, q: &filmcraft_engine::project::Sequence) -> (Tick,
|
||||
_ => (Tick::ZERO, end),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod preview_tests {
|
||||
use super::*;
|
||||
use crate::{dock::PanelKind, state::Mode};
|
||||
|
||||
fn app() -> FilmcraftApp {
|
||||
let mut s = filmcraft_engine::Session::default();
|
||||
s.execute("file.openDemoProject", json!({})).unwrap();
|
||||
let mut app = FilmcraftApp::new(s);
|
||||
app.ui.mode = Mode::Export;
|
||||
app.ui.export.range = "custom".into();
|
||||
app.ui.export.custom_start = 2.0;
|
||||
app.ui.export.custom_end = 4.0;
|
||||
app
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_preview_commands_are_rejected_outside_export_mode() {
|
||||
for mode in [Mode::Edit, Mode::Import] {
|
||||
let mut app = app();
|
||||
app.ui.mode = mode;
|
||||
let ctx = egui::Context::default();
|
||||
let before = serde_json::to_value(&app.session.project).unwrap();
|
||||
let playhead = app.session.playhead();
|
||||
let revision = app.session.revision;
|
||||
let dirty = app.session.is_dirty();
|
||||
let undo = app.session.undo_mark();
|
||||
for command in [
|
||||
"export.preview.seek",
|
||||
"export.preview.toggle",
|
||||
"export.preview.first",
|
||||
"export.preview.last",
|
||||
"export.preview.stepBack",
|
||||
"export.preview.stepForward",
|
||||
] {
|
||||
assert!(crate::menus::invoke(&mut app, &ctx, command, json!({"frame": 51})).is_err(), "{command} in {mode:?}");
|
||||
assert!(!app.playback.playing);
|
||||
assert_eq!(app.session.playhead(), playhead);
|
||||
assert_eq!(serde_json::to_value(&app.session.project).unwrap(), before);
|
||||
assert_eq!(app.session.revision, revision);
|
||||
assert_eq!(app.session.is_dirty(), dirty);
|
||||
assert_eq!(app.session.undo_mark(), undo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preview_navigation_is_bounded_and_does_not_edit_the_project() {
|
||||
let mut app = app();
|
||||
let before = serde_json::to_value(&app.session.project).unwrap();
|
||||
let revision = app.session.revision;
|
||||
let dirty = app.session.is_dirty();
|
||||
let undo = app.session.undo_mark();
|
||||
let (first, last) = preview_bounds(&app).unwrap();
|
||||
for (input, expected) in [(i64::MIN, first), (i64::MAX, last), (first + 1, first + 1)] {
|
||||
preview_command(&mut app, "export.preview.seek", &json!({"frame": input})).unwrap();
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), expected);
|
||||
}
|
||||
for input in [json!({}), json!({"frame": 1.5}), json!({"frame": "bad"}), json!({"frame": u64::MAX})] {
|
||||
assert!(preview_command(&mut app, "export.preview.seek", &input).is_err());
|
||||
}
|
||||
preview_command(&mut app, "export.preview.first", &json!({})).unwrap();
|
||||
preview_command(&mut app, "export.preview.stepBack", &json!({})).unwrap();
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), first);
|
||||
preview_command(&mut app, "export.preview.last", &json!({})).unwrap();
|
||||
preview_command(&mut app, "export.preview.stepForward", &json!({})).unwrap();
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), last);
|
||||
assert_eq!(serde_json::to_value(&app.session.project).unwrap(), before);
|
||||
assert_eq!(app.session.revision, revision);
|
||||
assert_eq!(app.session.is_dirty(), dirty);
|
||||
assert_eq!(app.session.undo_mark(), undo);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_transport_treats_null_monitor_as_omitted() {
|
||||
let mut app = app();
|
||||
app.ui.focused = PanelKind::Source;
|
||||
let ctx = egui::Context::default();
|
||||
let (first, last) = preview_bounds(&app).unwrap();
|
||||
for params in [json!({}), json!({"monitor": null})] {
|
||||
for (command, expected) in [("markers.goToIn", first), ("playhead.stepBack", first), ("markers.goToOut", last), ("playhead.stepForward", last)] {
|
||||
crate::menus::invoke(&mut app, &ctx, command, params.clone()).unwrap();
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), expected);
|
||||
}
|
||||
crate::menus::invoke(&mut app, &ctx, "playback.toggle", params.clone()).unwrap();
|
||||
assert!(app.playback.playing);
|
||||
assert!(!app.source_playback.clock.playing);
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), first);
|
||||
crate::menus::invoke(&mut app, &ctx, "playback.toggle", params).unwrap();
|
||||
assert!(!app.playback.playing);
|
||||
}
|
||||
// An explicit Program target retains the unrestricted transport behavior.
|
||||
crate::menus::invoke(&mut app, &ctx, "playhead.stepBack", json!({"monitor": "program"})).unwrap();
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), first - 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_keyboard_targets_sequence_and_playback_stops_at_range_end_even_with_loop_on() {
|
||||
let mut app = app();
|
||||
app.ui.focused = PanelKind::Source;
|
||||
app.playback.looping = true;
|
||||
let ctx = egui::Context::default();
|
||||
crate::menus::invoke(&mut app, &ctx, "playback.toggle", json!({})).unwrap();
|
||||
assert!(app.playback.playing);
|
||||
assert!(!app.source_playback.clock.playing);
|
||||
assert_eq!(app.session.playhead(), app.session.sequence_rate().snap(Tick::from_seconds_f64(2.0)));
|
||||
app.playback.preroll = None;
|
||||
app.playback.anchor_time = 1.0;
|
||||
app.set_now_for_test(4.0);
|
||||
let mut out = ctx.run_ui(egui::RawInput { time: Some(4.0), ..Default::default() }, |ui| app.advance_playback(ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
assert!(!app.playback.playing);
|
||||
assert!(app.playback.looping, "the Program loop preference is preserved");
|
||||
let (_, last) = preview_bounds(&app).unwrap();
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), last);
|
||||
crate::menus::invoke(&mut app, &ctx, "playback.toggle", json!({})).unwrap();
|
||||
assert_eq!(app.session.playhead(), app.session.sequence_rate().snap(Tick::from_seconds_f64(2.0)));
|
||||
crate::menus::invoke(&mut app, &ctx, "playhead.stepForward", json!({})).unwrap();
|
||||
assert!(!app.playback.playing);
|
||||
assert_eq!(app.session.sequence_rate().frame_at(app.session.playhead()), preview_bounds(&app).unwrap().0 + 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_range_change_stops_and_clamps_both_directions_and_preroll() {
|
||||
for speed in [1.0, -1.0] {
|
||||
for preroll in [false, true] {
|
||||
let mut app = app();
|
||||
app.audio = None;
|
||||
let rate = app.session.sequence_rate();
|
||||
app.session.set_playhead(rate.snap(Tick::from_seconds_f64(3.0)));
|
||||
app.play(speed);
|
||||
app.playback.preroll = preroll.then_some(1.0);
|
||||
app.playback.preroll_ready = false;
|
||||
app.playback.anchor_time = 1.0;
|
||||
app.set_now_for_test(1.0);
|
||||
let before = serde_json::to_value(&app.session.project).unwrap();
|
||||
let revision = app.session.revision;
|
||||
let undo = app.session.undo_mark();
|
||||
let dirty = app.session.is_dirty();
|
||||
if speed > 0.0 {
|
||||
app.ui.export.custom_start = 4.0;
|
||||
app.ui.export.custom_end = 5.0;
|
||||
} else {
|
||||
app.ui.export.custom_start = 0.0;
|
||||
app.ui.export.custom_end = 1.0;
|
||||
}
|
||||
let (first, last) = preview_bounds(&app).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| app.advance_playback(ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
assert!(!app.playback.playing, "speed={speed}, preroll={preroll}");
|
||||
assert_eq!(rate.frame_at(app.session.playhead()), if speed > 0.0 { first } else { last });
|
||||
assert!(app.playback.preroll.is_none());
|
||||
assert!(app.playback.smooth_playhead.is_none());
|
||||
assert_eq!(serde_json::to_value(&app.session.project).unwrap(), before);
|
||||
assert_eq!(app.session.revision, revision);
|
||||
assert_eq!(app.session.undo_mark(), undo);
|
||||
assert_eq!(app.session.is_dirty(), dirty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_range_change_drops_an_out_of_range_preview_texture() {
|
||||
for playing in [false, true] {
|
||||
let mut app = app();
|
||||
app.session.set_playhead(Tick::ZERO);
|
||||
app.playback.playing = playing;
|
||||
let seq = app.session.state.active_sequence.unwrap();
|
||||
let key = FrameKey { target: Target::Sequence(seq), frame: 0, size: 500, revision: app.session.revision, draft: false };
|
||||
let ctx = egui::Context::default();
|
||||
app.texture_for(&ctx, "export-preview", key, &crate::frames::Rgba { w: 1, h: 1, px: vec![255, 0, 0, 255] });
|
||||
assert_eq!(app.texture_key("export-preview"), Some(key));
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
|
||||
preview_column(&mut app, ui, Rect::from_min_size(pos2(0.0, 0.0), vec2(600.0, 900.0)), seq);
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
assert_eq!(app.texture_key("export-preview").is_none(), playing, "paused inspection is preserved");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preview_ranges_cover_in_out_work_area_empty_and_hostile_custom_values() {
|
||||
let mut app = app();
|
||||
let id = app.session.state.active_sequence.unwrap();
|
||||
let rate = app.session.sequence_rate();
|
||||
let q = std::sync::Arc::make_mut(&mut app.session.project).sequence_mut(id).unwrap();
|
||||
q.mark_in = Some(rate.tick_of(10));
|
||||
q.mark_out = Some(rate.tick_of(20));
|
||||
q.work_area = Some(filmcraft_time::TimeRange::new(rate.tick_of(30), rate.tick_of(10)));
|
||||
app.ui.export.range = "inOut".into();
|
||||
assert_eq!(preview_bounds(&app), Some((10, 20)));
|
||||
app.ui.export.range = "workArea".into();
|
||||
assert_eq!(preview_bounds(&app), Some((30, 39)));
|
||||
app.ui.export.range = "custom".into();
|
||||
for (start, end) in [(f64::NAN, f64::INFINITY), (5.0, 2.0), (-10.0, -20.0), (f64::MAX, f64::MAX)] {
|
||||
app.ui.export.custom_start = start;
|
||||
app.ui.export.custom_end = end;
|
||||
let (first, last) = preview_bounds(&app).unwrap();
|
||||
assert!(first >= 0 && last >= first);
|
||||
}
|
||||
let mut empty = FilmcraftApp::new(filmcraft_engine::Session::default());
|
||||
assert!(preview_command(&mut empty, "export.preview.toggle", &json!({})).is_err());
|
||||
}
|
||||
}
|
||||
@@ -588,7 +588,7 @@ const ASKED_KEYS: usize = 64;
|
||||
/// is, and showing it keeps the picture one pass behind the mouse instead of frozen until the
|
||||
/// mouse rests. Playback has its own schedule and remembers nothing (what was on screen before
|
||||
/// Play is no stand-in for where it stopped).
|
||||
fn asked_before(app: &mut FilmcraftApp, prefix: &str, key: FrameKey, playing: bool) -> Vec<FrameKey> {
|
||||
pub(crate) fn asked_before(app: &mut FilmcraftApp, prefix: &str, key: FrameKey, playing: bool) -> Vec<FrameKey> {
|
||||
let asked = app.monitor_asked.entry(prefix.to_string()).or_default();
|
||||
if playing {
|
||||
asked.clear();
|
||||
@@ -618,7 +618,7 @@ fn playing_recent(app: &FilmcraftApp, key: FrameKey, dir: Option<i64>) -> Option
|
||||
/// A monitor texture from the CPU frame path: the exact frame, else the nearest cached one before
|
||||
/// it, else the newest ready one of `asked` (see [`asked_before`]), else `recent` (while playing),
|
||||
/// with the display mode's channel mapping. Returns the texture and the frame it shows.
|
||||
fn cpu_texture(
|
||||
pub(crate) fn cpu_texture(
|
||||
app: &mut FilmcraftApp,
|
||||
ctx: &egui::Context,
|
||||
name: &str,
|
||||
|
||||
@@ -161,7 +161,7 @@ fn splice(items: &mut Vec<MenuItem>, prefs: &dock::WorkspacePrefs, session: &fil
|
||||
.map(|n| {
|
||||
let id = format!("window.workspace.{}", slug(&n));
|
||||
MenuItem {
|
||||
label: tr(&n),
|
||||
label: tr(crate::menus::UI_COMMANDS.iter().find(|cmd| cmd.id == id).map_or(n.as_str(), |cmd| cmd.label)),
|
||||
path: vec!["Window".into(), "Workspaces".into()],
|
||||
shortcut: session.shortcuts.primary(&id),
|
||||
enabled: true,
|
||||
@@ -170,6 +170,7 @@ fn splice(items: &mut Vec<MenuItem>, prefs: &dock::WorkspacePrefs, session: &fil
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
sub.sort_by_cached_key(|item| item.label.to_lowercase());
|
||||
sub.extend(actions);
|
||||
items.splice(at..at, sub);
|
||||
}
|
||||
|
||||
@@ -301,6 +301,27 @@ mod tests {
|
||||
assert!(fill.lock().unwrap().is_none());
|
||||
}
|
||||
|
||||
/// Export's seek command feeds the same per-frame pointer scrub path as the monitors.
|
||||
#[test]
|
||||
fn export_preview_seek_respects_the_shared_scrub_audio_preference() {
|
||||
for enabled in [false, true] {
|
||||
let (mut app, fill) = app(enabled);
|
||||
app.ui.mode = crate::state::Mode::Export;
|
||||
app.ui.export.range = "entire".into();
|
||||
app.session.set_playhead(app.session.sequence_rate().tick_of(48));
|
||||
app.scrub_tick(0.0, true);
|
||||
crate::panels::export_mode::preview_command(&mut app, "export.preview.seek", &serde_json::json!({"frame": 60})).unwrap();
|
||||
assert_eq!(app.scrub_tick(0.02, true), enabled);
|
||||
if enabled {
|
||||
assert!(loudness(&fill) > 0.0, "the export seek auditions the demo's sequence mix");
|
||||
} else {
|
||||
assert!(fill.lock().unwrap().is_none());
|
||||
}
|
||||
assert!(!app.scrub_tick(0.03 + LINGER_S, false));
|
||||
assert!(fill.lock().unwrap().is_none());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nothing_plays_with_the_setting_off_or_while_playing() {
|
||||
let (mut app, fill) = app(false);
|
||||
|
||||
@@ -490,6 +490,81 @@ fn sample_size_lists_every_size_and_greys_out_what_the_format_cannot_store() {
|
||||
d.snapshot("export-sample-size-prores");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_preview_plays_steps_and_scrubs_without_changing_settings() {
|
||||
use filmcraft_ui_egui::dock::PanelKind;
|
||||
let mut d = Driver::new("preview");
|
||||
// Entering Export picks the Range from the sequence marks (#2749); choose Custom afterwards.
|
||||
d.ok("ui.set", json!({"mode":"export"}));
|
||||
d.frames(2);
|
||||
d.ok("ui.set", json!({"export":{"range":"custom","customStart":2.0,"customEnd":4.0}}));
|
||||
d.frames(2);
|
||||
assert_eq!(d.app().ui.export.range, "custom");
|
||||
let settings = serde_json::to_value(&d.app().ui.export.settings).unwrap();
|
||||
let project = serde_json::to_value(&d.app().session.project).unwrap();
|
||||
let dirty = d.app().session.is_dirty();
|
||||
d.click("export.preview.first");
|
||||
let rate = d.app().session.sequence_rate();
|
||||
assert_eq!(d.app().session.playhead(), rate.snap(filmcraft_engine::time::Tick::from_seconds_f64(2.0)));
|
||||
d.click("export.preview.stepForward");
|
||||
assert_eq!(rate.frame_at(d.app().session.playhead()), rate.frame_at(filmcraft_engine::time::Tick::from_seconds_f64(2.0)) + 1);
|
||||
d.click("export.preview.stepBack");
|
||||
d.click("export.preview");
|
||||
d.app().ui.focused = PanelKind::Source;
|
||||
d.ok("ui.key", json!({"key":"Space"}));
|
||||
assert!(d.app().playback.playing);
|
||||
assert!(!d.app().source_playback.clock.playing);
|
||||
d.click("export.preview.toggle");
|
||||
assert!(!d.app().playback.playing);
|
||||
let elements = d.ok("ui.elements", json!({"prefix":"export.preview.scrub"}));
|
||||
let rect = elements[0]["rect"].as_array().unwrap();
|
||||
let x = rect[0].as_f64().unwrap();
|
||||
let y = rect[1].as_f64().unwrap() + rect[3].as_f64().unwrap() / 2.0;
|
||||
let w = rect[2].as_f64().unwrap();
|
||||
d.ok("ui.drag", json!({"from":{"x":x+12.0,"y":y},"to":{"x":x+w*0.65,"y":y},"steps":8}));
|
||||
assert!(d.app().session.playhead().seconds() > 2.5);
|
||||
assert!(d.app().session.playhead().seconds() < 4.0);
|
||||
assert!(!d.app().playback.playing);
|
||||
d.click("export.preview.last");
|
||||
assert_eq!(rate.frame_at(d.app().session.playhead()), rate.frame_at(filmcraft_engine::time::Tick::from_seconds_f64(4.0) - filmcraft_engine::time::Tick(1)));
|
||||
assert_eq!(serde_json::to_value(&d.app().ui.export.settings).unwrap(), settings);
|
||||
assert_eq!(serde_json::to_value(&d.app().session.project).unwrap(), project);
|
||||
assert_eq!(d.app().session.is_dirty(), dirty);
|
||||
d.snapshot("export-preview-controls");
|
||||
// Audio-only exports keep navigation and audition available without requesting picture.
|
||||
d.app().ui.export.settings.format = filmcraft_engine::export::Format::Wav;
|
||||
d.frames(3);
|
||||
d.click("export.preview.first");
|
||||
assert!(d.has("export.preview.scrub"));
|
||||
d.snapshot("export-preview-audio");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_preview_range_change_stops_at_the_new_start() {
|
||||
let mut d = Driver::new("preview-range-change");
|
||||
d.ok("ui.set", json!({"mode":"export"}));
|
||||
d.ok("ui.set", json!({"export":{"range":"custom","customStart":0.0,"customEnd":10.0}}));
|
||||
d.click("export.preview.first");
|
||||
d.wait_until("initial preview picture", |d| d.app().texture_key("export-preview").is_some_and(|key| key.frame == 0));
|
||||
d.click("export.preview.toggle");
|
||||
assert!(d.app().playback.playing);
|
||||
let project = serde_json::to_value(&d.app().session.project).unwrap();
|
||||
let undo = d.app().session.undo_mark();
|
||||
let dirty = d.app().session.is_dirty();
|
||||
d.ok("ui.set", json!({"export":{"customStart":8.0,"customEnd":10.0}}));
|
||||
d.frames(3);
|
||||
assert!(!d.app().playback.playing);
|
||||
let rate = d.app().session.sequence_rate();
|
||||
assert_eq!(d.app().session.playhead(), rate.snap(filmcraft_engine::time::Tick::from_seconds_f64(8.0)));
|
||||
assert_eq!(serde_json::to_value(&d.app().session.project).unwrap(), project);
|
||||
assert_eq!(d.app().session.undo_mark(), undo);
|
||||
assert_eq!(d.app().session.is_dirty(), dirty);
|
||||
let first = rate.frame_at(filmcraft_engine::time::Tick::from_seconds_f64(8.0));
|
||||
assert!(d.app().texture_key("export-preview").is_none_or(|key| key.frame >= first));
|
||||
d.wait_until("new range preview picture", |d| d.app().texture_key("export-preview").is_some_and(|key| key.frame == first));
|
||||
d.snapshot("export-preview-range-change");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frame_rate_offers_the_high_rates_a_sequence_can_have() {
|
||||
use filmcraft_time::FrameRate;
|
||||
|
||||
@@ -57,6 +57,7 @@ mod panels_ui;
|
||||
mod par_ui;
|
||||
mod perf_ui;
|
||||
mod playback_clock_ui;
|
||||
mod playhead_step_ui;
|
||||
mod project_panel_ui;
|
||||
mod properties_scroll_ui;
|
||||
mod remix_ui;
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
//! #4655: Step 1 Frame and Go to Edit Point stop playback where they land.
|
||||
//!
|
||||
//! `Session::execute` moved the playhead, but the UI's playback clock stayed on, so
|
||||
//! `advance_playback` recomputed the playhead from its running anchor on the next pass and
|
||||
//! overwrote the step. These commands now stop the transport on the frame they chose, as in
|
||||
//! Premiere Pro.
|
||||
|
||||
use egui_kittest::Harness;
|
||||
use filmcraft_engine::Session;
|
||||
use filmcraft_ui_egui::{FilmcraftApp, menus};
|
||||
use serde_json::json;
|
||||
|
||||
/// A demo project with the playhead on frame 24 and playback running.
|
||||
fn playing() -> Harness<'static, FilmcraftApp> {
|
||||
let mut session = Session::default();
|
||||
session.execute("file.openDemoProject", json!({})).unwrap();
|
||||
let rate = session.sequence_rate();
|
||||
session.set_playhead(rate.tick_of(24));
|
||||
let mut harness = Harness::builder().with_size(egui::vec2(1280.0, 800.0)).with_step_dt(1.0 / 60.0).build_eframe(move |cc| {
|
||||
filmcraft_ui_egui::framework::install_headless(&cc.egui_ctx);
|
||||
FilmcraftApp::new(session)
|
||||
});
|
||||
harness.step();
|
||||
harness.state_mut().play(1.0);
|
||||
harness.step();
|
||||
assert!(harness.state().playback.playing, "playback is running before the key");
|
||||
harness
|
||||
}
|
||||
|
||||
/// The step keys stop playback and keep the frame they chose.
|
||||
#[test]
|
||||
fn stepping_the_playhead_stops_playback() {
|
||||
for (command, frames) in [("playhead.stepForward", 1), ("playhead.stepBack", -1)] {
|
||||
let mut harness = playing();
|
||||
let ctx = harness.ctx.clone();
|
||||
let rate = harness.state().session.sequence_rate();
|
||||
let want = rate.tick_of(rate.frame_at(harness.state().session.playhead()) + frames);
|
||||
menus::invoke(harness.state_mut(), &ctx, command, json!({})).expect(command);
|
||||
assert!(!harness.state().playback.playing, "{command} stops playback");
|
||||
assert_eq!(harness.state().session.playhead(), want, "{command} lands on its frame");
|
||||
// The bug: a running clock overwrote the step on the next pass.
|
||||
harness.step();
|
||||
assert_eq!(harness.state().session.playhead(), want, "{command} keeps its frame on the next pass");
|
||||
}
|
||||
// Settings ▸ Playback ▸ Step forward/back many.
|
||||
for (command, direction) in [("playhead.stepForward5", 1), ("playhead.stepBack5", -1)] {
|
||||
let mut harness = playing();
|
||||
let ctx = harness.ctx.clone();
|
||||
let rate = harness.state().session.sequence_rate();
|
||||
let n = i64::from(harness.state().session.prefs.playback.step_many_frames) * direction;
|
||||
let want = rate.tick_of(rate.frame_at(harness.state().session.playhead()) + n);
|
||||
menus::invoke(harness.state_mut(), &ctx, command, json!({})).expect(command);
|
||||
assert!(!harness.state().playback.playing, "{command} stops playback");
|
||||
assert_eq!(harness.state().session.playhead(), want, "{command} lands on its frame");
|
||||
harness.step();
|
||||
assert_eq!(harness.state().session.playhead(), want, "{command} keeps its frame on the next pass");
|
||||
}
|
||||
// Go to Edit Point: the demo's next edit is ahead of frame 24, its previous one behind it.
|
||||
for (command, forward) in [("playhead.nextEdit", true), ("playhead.prevEdit", false)] {
|
||||
let mut harness = playing();
|
||||
let ctx = harness.ctx.clone();
|
||||
let start = harness.state().session.playhead();
|
||||
menus::invoke(harness.state_mut(), &ctx, command, json!({})).expect(command);
|
||||
assert!(!harness.state().playback.playing, "{command} stops playback");
|
||||
let landed = harness.state().session.playhead();
|
||||
assert!(if forward { landed > start } else { landed < start }, "{command} moved the playhead: {landed:?}");
|
||||
harness.step();
|
||||
assert_eq!(harness.state().session.playhead(), landed, "{command} keeps its frame on the next pass");
|
||||
}
|
||||
}
|
||||
|
||||
/// A step while stopped is unchanged: there is no transport to stop.
|
||||
#[test]
|
||||
fn stepping_while_stopped_leaves_the_transport_alone() {
|
||||
let mut session = Session::default();
|
||||
session.execute("file.openDemoProject", json!({})).unwrap();
|
||||
let rate = session.sequence_rate();
|
||||
session.set_playhead(rate.tick_of(24));
|
||||
let mut harness = Harness::builder().with_size(egui::vec2(1280.0, 800.0)).build_eframe(move |cc| {
|
||||
filmcraft_ui_egui::framework::install_headless(&cc.egui_ctx);
|
||||
FilmcraftApp::new(session)
|
||||
});
|
||||
harness.step();
|
||||
let ctx = harness.ctx.clone();
|
||||
menus::invoke(harness.state_mut(), &ctx, "playhead.stepForward", json!({})).unwrap();
|
||||
assert!(!harness.state().playback.playing);
|
||||
assert_eq!(harness.state().session.playhead(), rate.tick_of(25));
|
||||
}
|
||||
@@ -31,7 +31,10 @@ impl Driver {
|
||||
if snapshots.is_some() {
|
||||
builder = builder.wgpu();
|
||||
}
|
||||
let harness = builder.build_eframe(move |_cc| app);
|
||||
let harness = builder.build_eframe(move |cc| {
|
||||
filmcraft_ui_egui::framework::install_headless(&cc.egui_ctx);
|
||||
app
|
||||
});
|
||||
let mut driver = Self { harness, tx, snapshots };
|
||||
driver.frames(4);
|
||||
driver
|
||||
@@ -39,10 +42,6 @@ impl Driver {
|
||||
|
||||
fn frames(&mut self, count: usize) {
|
||||
for _ in 0..count {
|
||||
let ctx = self.harness.ctx.clone();
|
||||
let mut raw = std::mem::take(self.harness.input_mut());
|
||||
eframe::App::raw_input_hook(self.harness.state_mut(), &ctx, &mut raw);
|
||||
*self.harness.input_mut() = raw;
|
||||
self.harness.step();
|
||||
}
|
||||
}
|
||||
@@ -1186,8 +1185,9 @@ fn dropping_project_clips_beside_script_text_creates_setups_at_the_hovered_lines
|
||||
driver.harness.state_mut().ui.script.selected_lines = Some((first, second));
|
||||
driver.frames(4);
|
||||
if view == "list" {
|
||||
driver.ok("ui.scroll", json!({"id":format!("project.item.{source}"),"dy":-150.0}));
|
||||
driver.frames(4);
|
||||
// List rows can start outside the viewport. Bring this source into view before the drag.
|
||||
driver.harness.state_mut().ui.project_panel.reveal = Some(source);
|
||||
driver.frames(30);
|
||||
}
|
||||
let [x, _, width, _] = driver.rect("script.emptyCanvas");
|
||||
let [_, y, _, height] = driver.rect(&format!("script.line.{second}"));
|
||||
|
||||
@@ -120,8 +120,8 @@ fn save_switch_reset_rename_delete_and_restart() {
|
||||
"Editing",
|
||||
"Effects",
|
||||
"Learning",
|
||||
"Lined Script",
|
||||
"Review",
|
||||
"Script",
|
||||
"Vertical",
|
||||
"Reset to Saved Layout",
|
||||
"Save Changes to this Workspace",
|
||||
|
||||
@@ -9,6 +9,15 @@ Opus 5.5 agent-hours (calibration in [target-app-parity.md](target-app-parity.md
|
||||
The one-page summary is [ROADMAP.md](../ROADMAP.md); the ranked work list is [gaps.md](gaps.md).
|
||||
There is no `cargo xtask scorecard` or `cargo xtask parity` yet ([G7](gaps.md#g7-no-measured-parity-tool-in-ci)).
|
||||
|
||||
## Export preview navigation (#1388)
|
||||
|
||||
Export mode offers playback with sequence audio, frame stepping, start/end navigation and a
|
||||
frame-snapped scrub bar over the selected export range. Navigation leaves project content and
|
||||
export settings unchanged. This is a reduced-resolution sequence preview with output framing;
|
||||
encoder simulation and live export-job pictures remain outside this feature. Behaviour and
|
||||
validation are documented in the [UI README](../crates/ui-egui/README.md#export-preview-1388).
|
||||
Parity percentages are unchanged.
|
||||
|
||||
## Current focus
|
||||
|
||||
In order. Each item links to its gap entry, which says what "done" means.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Script window settings inventory
|
||||
|
||||
Open **Window → Lined Script** to show the panel, or choose **Window → Workspaces → Lined Script** for the dedicated layout.
|
||||
|
||||
The Script toolbar has a gear menu for settings that are implemented today. This inventory tracks the other requested controls without presenting them as working features.
|
||||
|
||||
Toolbar controls wrap when the panel is narrow. Scene/Page captions stay with their menus, the **?** help button stays visible and aligned with the first row, and search sits below the wrapped controls. The **?** button opens the same getting-started guide shown before a script is created or imported.
|
||||
|
||||
Reference in new issue
Block a user