Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Merge main into #2452 (resolve append conflicts)

Brandon Thomas520e32d8932f
diff --cc crates/ui-egui/src/i18n/es.tsv
index c855c6b6c,1b0888947..2ac92decc
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@@ -3610,6 -3611,6 +3611,9 @@@
Shows the version, community links and credits in a FilmCraft window. Muestra la versión, los enlaces de la comunidad y los créditos en una ventana de FilmCraft.
Couldn't open your web browser No se pudo abrir el navegador web
Open this address in your browser yourself: Abre esta dirección tú mismo en el navegador:
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom Restablecer zoom de la interfaz
+ Track Color Color de pista
+ 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.
diff --cc crates/ui-egui/src/i18n/fr.tsv
index 3afa61278,e72289a22..6778b0322
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@@ -3577,6 -3578,6 +3578,9 @@@
Export the labels to a preset file… Exporter les étiquettes dans un fichier de paramètre prédéfini…
Show the presets folder Afficher le dossier des paramètres prédéfinis
Delete this preset Supprimer ce paramètre prédéfini
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom Réinitialiser le zoom de l'interface
+ Track Color Couleur de la piste
+ 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.
diff --cc crates/ui-egui/src/i18n/id.tsv
index 0cc020b8a,3c9faa1d5..8ffc4f5b3
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@@ -3575,6 -3576,6 +3576,9 @@@
Appearance Settings… Pengaturan Tampilan…
Add to favorites Tambahkan ke favorit
Remove from favorites Hapus dari favorit
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom Atur Ulang Zoom Antarmuka
+ Track Color Warna Trek
+ 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.
diff --cc crates/ui-egui/src/i18n/it.tsv
index 38d0e7936,bac8a3144..ef02460c3
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@@ -3601,6 -3602,6 +3602,9 @@@
Shows the version, community links and credits in a FilmCraft window. Mostra la versione, i link della community e i riconoscimenti in una finestra di FilmCraft.
Couldn't open your web browser Impossibile aprire il browser web
Open this address in your browser yourself: Apri tu questo indirizzo nel browser:
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom Reimposta zoom dell'interfaccia
+ Track Color Colore traccia
+ 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.
diff --cc crates/ui-egui/src/i18n/ja.tsv
index 3a1d97c7b,6bfb7f629..d0fb3d4e7
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@@ -3609,6 -3610,6 +3610,9 @@@
Shows the version, community links and credits in a FilmCraft window. バージョン、コミュニティへのリンク、クレジットを FilmCraft のウィンドウに表示します。
Couldn't open your web browser ウェブブラウザーを開けませんでした
Open this address in your browser yourself: このアドレスをご自身でブラウザーで開いてください:
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom インターフェイスのズームをリセット
+ Track Color トラックカラー
+ Open a sequence to search its graphics シーケンスを開くとグラフィックスを検索できます
+ No text graphics in this sequence. Add text with the Type tool. このシーケンスにはテキストのグラフィックスがありません。文字ツールでテキストを追加してください。
+ No matching text. 一致するテキストはありません。
diff --cc crates/ui-egui/src/i18n/ko.tsv
index e49db8a57,ac2a413cd..73d5adf68
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@@ -3596,6 -3597,6 +3597,9 @@@
Shows the version, community links and credits in a FilmCraft window. FilmCraft 창에 버전, 커뮤니티 링크, 제작진을 보여 줍니다.
Couldn't open your web browser 웹 브라우저를 열 수 없습니다
Open this address in your browser yourself: 이 주소를 브라우저에서 직접 여세요:
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom 인터페이스 확대/축소 재설정
+ Track Color 트랙 색상
+ Open a sequence to search its graphics 그래픽을 검색하려면 시퀀스를 여세요
+ No text graphics in this sequence. Add text with the Type tool. 이 시퀀스에는 텍스트 그래픽이 없습니다. 문자 도구로 텍스트를 추가하세요.
+ No matching text. 일치하는 텍스트가 없습니다.
diff --cc crates/ui-egui/src/i18n/pt-br.tsv
index 14258bfc3,b08e795f5..7cbb49a58
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@@ -3578,6 -3579,6 +3579,9 @@@
# The native macOS application menu (Settings…).
Settings Preferências
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom Redefinir zoom da interface
+ Track Color Cor da trilha
+ 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.
diff --cc crates/ui-egui/src/i18n/zh-cn.tsv
index 0c922075b,ee6d724dd..244646f47
--- a/crates/ui-egui/src/i18n/zh-cn.tsv
+++ b/crates/ui-egui/src/i18n/zh-cn.tsv
@@@ -3585,6 -3586,6 +3586,9 @@@
Shows the version, community links and credits in a FilmCraft window. 在 FilmCraft 窗口中显示版本、社区链接和致谢。
Couldn't open your web browser 无法打开网页浏览器
Open this address in your browser yourself: 请自行在浏览器中打开此地址:
+ # View ▸ Reset Interface Zoom (#2253).
+ Reset Interface Zoom 重置界面缩放
+ Track Color 轨道颜色
+ Open a sequence to search its graphics 打开序列以搜索其中的图形
+ No text graphics in this sequence. Add text with the Type tool. 此序列中没有文本图形。请用文字工具添加文本。
+ No matching text. 没有匹配的文本。
diff --cc crates/ui-egui/tests/graphics_ui.rs
index 69bf19880,a5e52df6b..fffa7a1d9
--- a/crates/ui-egui/tests/graphics_ui.rs
+++ b/crates/ui-egui/tests/graphics_ui.rs
@@@ -231,86 -231,86 +231,170 @@@ fn shadow_color_drag_is_one_undo_step(
assert_eq!(color(&mut d), before, "one undo restores the original color");
}
+ /// Character ranges use setCharStyle, but must share the same one-gesture undo rule as a layer.
+ #[test]
+ fn selected_character_size_drag_is_one_undo_step() {
+ let mut d = Driver::demo();
+ d.ok("ui.set", json!({"workspace":"Captions and Graphics","tool":"Type"}));
+ d.exec("playhead.set", json!({"seconds":2}));
+ d.frames(3);
+ let p = d.rect("program.picture");
+ d.ok("ui.click", json!({"x":p[0]+p[2]*0.2,"y":p[1]+p[3]*0.35}));
+ d.ok("ui.type", json!({"text":"Undo drag test"}));
+ d.ok("ui.key", json!({"key":"Cmd+A"}));
+ d.frames(3);
+ let before = d.harness.state().session.project.clone();
+ let n = d.harness.state().session.history.undo.len();
+ let r = d.rect("graphics.prop.size");
+ d.ok("ui.drag", json!({"from":{"x":r[0]+r[2]/2.0,"y":r[1]+r[3]/2.0},"to":{"x":r[0]+r[2]/2.0+80.0,"y":r[1]+r[3]/2.0},"steps":8}));
+ d.frames(3);
+ assert_eq!(d.harness.state().session.history.undo.len(), n + 1);
+ let after = d.harness.state().session.project.clone();
+ assert_ne!(*after, *before);
+ d.exec("edit.undo", json!({}));
+ assert_eq!(*d.harness.state().session.project, *before);
+ d.exec("edit.redo", json!({}));
+ assert_eq!(*d.harness.state().session.project, *after);
+ }
+
+ /// The Properties panel's stopwatches animate a layer property (#2358): Tracking (letter
+ /// spacing) gets keyframes from the Essential Graphics panel itself, a change at another time
+ /// adds a keyframe there instead of changing the value everywhere, and the stopwatch turns
+ /// keyframing off again.
+ #[test]
+ fn the_tracking_stopwatch_animates_letter_spacing() {
+ let mut d = Driver::demo();
+ d.ok("ui.set", json!({"workspace": "Captions and Graphics"}));
+ d.exec("playhead.set", json!({"seconds": 0.0}));
+ let r = d.exec("graphics.newText", json!({"text": "Title", "seconds": 4}));
+ let clip = r["clip"].as_u64().unwrap();
+ d.exec("graphics.selectLayer", json!({"clip": clip, "layers": [0]}));
+ d.frames(4);
+ for _ in 0..20 {
+ if d.rect("graphics.prop.tracking")[1] < 800.0 {
+ break;
+ }
+ d.ok("ui.scroll", json!({"id": "graphics.prop.scale", "dy": -200.0}));
+ d.frames(2);
+ }
+ let keys = |d: &mut Driver| -> Vec<(i64, f64)> {
+ let s = &d.harness.state().session;
+ let (_, it) = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(clip)).unwrap();
+ let e = it.effects.iter().find(|e| e.effect == "graphic_text").unwrap();
+ e.params.get("tracking").map(|p| p.keyframes.iter().map(|k| (k.time.0, k.value.as_f64().unwrap())).collect()).unwrap_or_default()
+ };
+ assert!(keys(&mut d).is_empty());
+ d.ok("ui.click", json!({"id": "graphics.prop.tracking.stopwatch"}));
+ d.frames(2);
+ assert_eq!(keys(&mut d).len(), 1, "the stopwatch sets a keyframe at the playhead");
+ // two seconds later, drag the Tracking number: a second keyframe, the first stays
+ d.exec("playhead.set", json!({"seconds": 2.0}));
+ d.frames(2);
+ let n = d.rect("graphics.prop.tracking");
+ let (cx, cy) = (n[0] + n[2] / 2.0, n[1] + n[3] / 2.0);
+ d.ok("ui.drag", json!({"from": {"x": cx, "y": cy}, "to": {"x": cx + 60.0, "y": cy}, "steps": 6}));
+ d.frames(4);
+ let k = keys(&mut d);
+ assert_eq!(k.len(), 2, "{k:?}");
+ // the clip starts at 0, where the first keyframe was set, so the second one sits at the playhead
+ let playhead = d.harness.state().session.playhead().0;
+ assert_eq!((k[0].0, k[1].0), (0, playhead), "the keyframes are where the playhead was: {k:?}");
+ assert_eq!(k[0].1, 0.0, "the first keyframe keeps its value: {k:?}");
+ assert!(k[1].1 > 10.0, "the new keyframe has the dragged value: {k:?}");
+ // letter spacing now animates: halfway between the keyframes the value is in between
+ let mid = {
+ let s = &d.harness.state().session;
+ let (_, it) = s.active_sequence().unwrap().find_item(filmcraft_project::ClipId(clip)).unwrap();
+ let e = it.effects.iter().find(|e| e.effect == "graphic_text").unwrap();
+ e.param("tracking").unwrap().value_at(filmcraft_time::Tick((k[0].0 + k[1].0) / 2)).as_f64().unwrap()
+ };
+ assert!(mid > 0.0 && mid < k[1].1, "{mid} between 0 and {}", k[1].1);
+ d.ok("ui.click", json!({"id": "graphics.prop.tracking.stopwatch"}));
+ d.frames(2);
+ assert!(keys(&mut d).is_empty(), "the stopwatch turns keyframing off");
+ d.shot("tracking-stopwatch");
+ }
++
+/// Text panel ▸ Graphics (#1487): the text of every text layer in the sequence, in timeline
+/// order, searchable; the timecode goes to the clip and selects the layer, and the text edits in
+/// place as one undo step.
+#[test]
+fn the_text_panels_graphics_tab_lists_and_edits_graphic_text() {
+ let mut d = Driver::demo();
+ d.ok("ui.set", json!({"workspace": "Captions and Graphics"}));
+ let mut clips = Vec::new();
+ for (sec, text) in [(6.0, "Closing credits"), (1.0, "Opening title")] {
+ d.exec("playhead.set", json!({"seconds": sec}));
+ let r = d.exec("graphics.newText", json!({"text": text, "seconds": 2}));
+ clips.push(r["clip"].as_u64().unwrap());
+ }
+ let (credits, title) = (clips[0], clips[1]);
+ d.exec("playhead.set", json!({"seconds": 10.0}));
+ d.ok("ui.click", json!({"id": "text.tab.Graphics"}));
+ d.frames(3);
+ let rows = |d: &mut Driver| -> Vec<String> {
+ let v = d.ok("ui.elements", json!({"prefix": "text.graphics."}));
+ v.as_array().unwrap().iter().filter(|e| e["id"].as_str().unwrap().ends_with(".row")).map(|e| e["label"].as_str().unwrap_or("").to_string()).collect()
+ };
+ assert_eq!(rows(&mut d), ["Opening title", "Closing credits"], "in timeline order");
+ // search
+ d.ok("ui.click", json!({"id": "text.graphics.search"}));
+ d.ok("ui.type", json!({"text": "CRED"}));
+ d.frames(3);
+ assert_eq!(rows(&mut d), ["Closing credits"]);
+ d.ok("ui.key", json!({"key": "A", "command": true}));
+ d.ok("ui.key", json!({"key": "Backspace"}));
+ d.frames(3);
+ assert_eq!(rows(&mut d).len(), 2);
+ // the timecode goes to the clip and selects its layer
+ d.ok("ui.click", json!({"id": format!("text.graphics.{credits}.0.goto")}));
+ d.frames(3);
+ let start = d.harness.state().session.active_sequence().unwrap().find_item(filmcraft_project::ClipId(credits)).unwrap().1.start;
+ assert_eq!(d.harness.state().session.playhead(), start);
+ assert_eq!(d.harness.state().session.state.selection, vec![filmcraft_project::ClipId(credits)]);
+ assert_eq!(d.harness.state().session.state.graphic_layers, vec![0]);
+ // edit the title's text in place
+ let undo0 = d.exec("history.list", json!({}))["undo"].as_array().unwrap().len();
+ d.ok("ui.click", json!({"id": format!("text.graphics.{title}.0.text")}));
+ d.ok("ui.key", json!({"key": "A", "command": true}));
+ d.ok("ui.type", json!({"text": "Night Drive"}));
+ d.ok("ui.click", json!({"id": "text.graphics.search"}));
+ d.frames(3);
+ let text = text_param(&mut d, title, "text");
+ assert_eq!(text, Some(filmcraft_project::ParamValue::Text("Night Drive".into())));
+ assert_eq!(d.exec("history.list", json!({}))["undo"].as_array().unwrap().len(), undo0 + 1, "one undo step");
+ assert_eq!(rows(&mut d), ["Night Drive", "Closing credits"]);
+ d.shot("text-panel-graphics");
+}
+
+/// Keyframed text: the Graphics tab shows a clip's text at the clip's start when the playhead is
+/// past the clip, and an edit is written there (not at the clip's last frame), so the value shown
+/// is the one that changes.
+#[test]
+fn a_graphics_tab_edit_writes_keyframed_text_where_it_is_shown() {
+ let mut d = Driver::demo();
+ d.ok("ui.set", json!({"workspace": "Captions and Graphics"}));
+ d.exec("playhead.set", json!({"seconds": 1.0}));
+ let clip = d.exec("graphics.newText", json!({"text": "Start", "seconds": 2}))["clip"].as_u64().unwrap();
+ let it = d.harness.state().session.active_sequence().unwrap().find_item(filmcraft_project::ClipId(clip)).unwrap().1.clone();
+ // animate the text: "Start" at the clip's start, "End" near its end
+ d.exec("effects.toggleAnimation", json!({"clip": clip, "effect": "graphic_text", "param": "text"}));
+ let late = it.start.0 + (it.duration.0 * 9) / 10;
+ d.exec("graphics.set", json!({"clip": clip, "layer": 0, "props": {"text": "End"}, "time": late}));
+ // the playhead past the clip: the row shows the start's text
+ d.exec("playhead.set", json!({"seconds": 10.0}));
+ d.ok("ui.click", json!({"id": "text.tab.Graphics"}));
+ d.frames(3);
+ d.ok("ui.click", json!({"id": format!("text.graphics.{clip}.0.text")}));
+ d.ok("ui.key", json!({"key": "A", "command": true}));
+ d.ok("ui.type", json!({"text": "Edited"}));
+ d.ok("ui.click", json!({"id": "text.graphics.search"}));
+ d.frames(3);
+ let at = |d: &mut Driver, t: i64| {
+ let it = d.harness.state().session.active_sequence().unwrap().find_item(filmcraft_project::ClipId(clip)).unwrap().1.clone();
+ let mt = it.effect_time_at(filmcraft_time::Tick(t));
+ it.effects.iter().find(|e| e.effect == "graphic_text").unwrap().param("text").unwrap().value_at(mt)
+ };
+ assert_eq!(at(&mut d, it.start.0), filmcraft_project::ParamValue::Text("Edited".into()), "the shown (start) value changed");
+ assert_eq!(at(&mut d, late), filmcraft_project::ParamValue::Text("End".into()), "the end keeps its own");
+}