EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge main into #1581; keep main's toolbar/Preview rows and the PR's rows in both Chinese panel catalogs, tr() the tab labels in main's comp_settings::show (tab_body split)
bflatasticbc868c7138fb
diff --cc crates/ui-egui/src/i18n/ui.rsindex efde2c370,061090871..544366319--- a/crates/ui-egui/src/i18n/ui.rs+++ b/crates/ui-egui/src/i18n/ui.rs@@@ -1641,32 -1643,49 +1643,75 @@@ const SIMPLIFIED_CHINESE: &[(&str, &str("Total Offset", "总偏移"),("Per Layer", "每个图层"),("Track", "跟踪"),+ ("Selection Tool", "选择工具"),+ ("Hand Tool", "抓手工具"),+ ("Zoom Tool", "缩放工具"),+ ("Orbit Around Cursor Tool", "绕行摄像机工具"),+ ("Pan Under Cursor Tool", "平移摄像机工具"),+ ("Dolly Towards Cursor Tool", "推拉摄像机工具"),+ ("Rotation Tool", "旋转工具"),+ ("Pan Behind (Anchor Point) Tool", "向后平移工具"),+ ("Rectangle Tool", "矩形工具"),+ ("Rounded Rectangle Tool", "圆角矩形工具"),+ ("Ellipse Tool", "椭圆工具"),+ ("Polygon Tool", "多边形工具"),+ ("Star Tool", "星形工具"),+ ("Pen Tool", "钢笔工具"),+ ("Add Vertex Tool", "添加顶点工具"),+ ("Delete Vertex Tool", "删除顶点工具"),+ ("Convert Vertex Tool", "转换顶点工具"),+ ("Mask Feather Tool", "蒙版羽化工具"),+ ("Horizontal Type Tool", "横排文字工具"),+ ("Vertical Type Tool", "直排文字工具"),+ ("Brush Tool", "画笔工具"),+ ("Clone Stamp Tool", "仿制图章工具"),+ ("Eraser Tool", "橡皮擦工具"),+ ("Roto Brush Tool", "Roto 笔刷工具"),+ ("Refine Edge Tool", "调整边缘工具"),+ ("Object Matte Tool", "对象遮罩工具"),+ ("Puppet Position Pin Tool", "人偶位置控点工具"),+ ("Puppet Starch Pin Tool", "人偶扑粉控点工具"),+ ("Puppet Bend Pin Tool", "人偶弯曲控点工具"),+ ("Puppet Advanced Pin Tool", "人偶高级控点工具"),+ ("Puppet Overlap Pin Tool", "人偶重叠控点工具"),+ ("Shortcut", "快捷键"),+ ("Range", "范围"),+ ("Play From", "从以下位置播放"),+ ("Frame Rate", "帧速率"),+ ("Resolution", "分辨率"),+ ("Overlays", "叠加"),+ ("Layer Controls", "图层控制"),+ ("Loop", "循环"),+ ("Cache Before Playback", "播放前缓存"),+ ("Pre-roll", "预卷"),+ ("Post-roll", "后卷"),+ ("If caching, play cached frames", "缓存时播放已缓存帧"),+ ("Apply", "应用"),+ ("Analyze", "分析"),+ ("Create Camera", "创建摄像机"),+ ("Add Point", "添加点"),+ ("Remove Point", "移除点"),+ ("Render", "渲染"),+ ("Save Current as Template…", "将当前项存为模板…"),+ ("New Composition From Footage", "从素材新建合成"),+ ("Search effects and presets", "搜索效果和预设"),+ ("Search project", "搜索项目"),+ ("Search", "搜索"),+ ("(no composition)", "没有合成"),+ ("per second", "每秒"),+ ("Waveform", "波形"),+ ("steps", "步"),+ ("Building waveform…", "正在生成波形…"),+ ("No effects. Drag one from Effects & Presets.", "没有效果。从效果和预设中拖入一个。"),+ ("Click the ring to add a colour; Alt-click a stop (or drag it off) to remove it", "点击色环添加颜色;按住 Alt 点击色标(或将其拖出)可移除"),+ ("Start from a ready-made project. Opening a template makes an untitled copy.", "从现成项目开始。打开模板会创建一份未命名副本。"),+ ("Square Pixels", "方形像素"),+ ("Basic", "基本"),+ ("Advanced", "高级"),+ ("3D Renderer", "3D 渲染器"),+ ("Black", "黑色"),+ ("White", "白色"),+ ("Composition Settings", "合成设置"),];const TRADITIONAL_CHINESE: &[(&str, &str)] = &[@@@ -2353,32 -2373,49 +2399,75 @@@("Total Offset", "總偏移"),("Per Layer", "每個圖層"),("Track", "追蹤"),+ ("Selection Tool", "選取工具"),+ ("Hand Tool", "手形工具"),+ ("Zoom Tool", "縮放工具"),+ ("Orbit Around Cursor Tool", "繞行攝影機工具"),+ ("Pan Under Cursor Tool", "平移攝影機工具"),+ ("Dolly Towards Cursor Tool", "推拉攝影機工具"),+ ("Rotation Tool", "旋轉工具"),+ ("Pan Behind (Anchor Point) Tool", "向後平移工具"),+ ("Rectangle Tool", "矩形工具"),+ ("Rounded Rectangle Tool", "圓角矩形工具"),+ ("Ellipse Tool", "橢圓工具"),+ ("Polygon Tool", "多邊形工具"),+ ("Star Tool", "星形工具"),+ ("Pen Tool", "筆型工具"),+ ("Add Vertex Tool", "添加頂點工具"),+ ("Delete Vertex Tool", "刪除頂點工具"),+ ("Convert Vertex Tool", "轉換頂點工具"),+ ("Mask Feather Tool", "遮色片羽化工具"),+ ("Horizontal Type Tool", "橫排文字工具"),+ ("Vertical Type Tool", "垂直文字工具"),+ ("Brush Tool", "筆刷工具"),+ ("Clone Stamp Tool", "仿製圖章工具"),+ ("Eraser Tool", "橡皮擦工具"),+ ("Roto Brush Tool", "Roto 筆刷工具"),+ ("Refine Edge Tool", "調整邊緣工具"),+ ("Object Matte Tool", "物件遮色片工具"),+ ("Puppet Position Pin Tool", "人偶位置控點工具"),+ ("Puppet Starch Pin Tool", "人偶撲粉控點工具"),+ ("Puppet Bend Pin Tool", "人偶彎曲控點工具"),+ ("Puppet Advanced Pin Tool", "人偶高級控點工具"),+ ("Puppet Overlap Pin Tool", "人偶重疊控點工具"),+ ("Shortcut", "快速鍵"),+ ("Range", "範圍"),+ ("Play From", "從下列位置播放"),+ ("Frame Rate", "影格速率"),+ ("Resolution", "解析度"),+ ("Overlays", "覆疊"),+ ("Layer Controls", "圖層控制"),+ ("Loop", "循環"),+ ("Cache Before Playback", "播放前快取"),+ ("Pre-roll", "預卷"),+ ("Post-roll", "後卷"),+ ("If caching, play cached frames", "快取時播放已快取影格"),+ ("Apply", "套用"),+ ("Analyze", "分析"),+ ("Create Camera", "建立攝影機"),+ ("Add Point", "添加點"),+ ("Remove Point", "移除點"),+ ("Render", "算圖"),+ ("Save Current as Template…", "將目前項目存為範本…"),+ ("New Composition From Footage", "從素材新增合成"),+ ("Search effects and presets", "搜尋效果與預設"),+ ("Search project", "搜尋專案"),+ ("Search", "搜尋"),+ ("(no composition)", "沒有合成"),+ ("per second", "每秒"),+ ("Waveform", "波形"),+ ("steps", "步驟"),+ ("Building waveform…", "正在產生波形…"),+ ("No effects. Drag one from Effects & Presets.", "沒有效果。從效果與預設集中拖入一個。"),+ ("Click the ring to add a colour; Alt-click a stop (or drag it off) to remove it", "點擊色環新增顏色;按住 Alt 點擊色標(或將其拖出)即可移除"),+ ("Start from a ready-made project. Opening a template makes an untitled copy.", "從現成專案開始。開啟範本會建立一份未命名副本。"),+ ("Square Pixels", "方形像素"),+ ("Basic", "基本"),+ ("Advanced", "高級"),+ ("3D Renderer", "3D 算圖引擎"),+ ("Black", "黑色"),+ ("White", "白色"),+ ("Composition Settings", "合成設置"),];/// Ukrainian (uk): original translations of the same interface rows as the Chinese catalogs.diff --cc crates/ui-egui/src/panels/comp_settings.rsindex ffa9af8a8,0d07afd94..402a7fd6d--- a/crates/ui-egui/src/panels/comp_settings.rs+++ b/crates/ui-egui/src/panels/comp_settings.rs@@@ -485,6 -467,54 +467,54 @@@ fn tab_body});}}+ }++ /// The height `tab` would take at `top`, from laying it out unseen: it follows the font, the+ /// language and the scale. Nothing it registers or changes is kept.+ fn tab_height(ui: &mut egui::Ui, tab: Tab, d: &CompDraft, t: &Tokens, custom: &[CompPreset], top: f32) -> f32 {+ let rect = egui::Rect::from_min_size(egui::pos2(ui.max_rect().left(), top), vec2(ui.max_rect().width(), 0.0));+ let mut child = ui.new_child(egui::UiBuilder::new().max_rect(rect).id_salt("comp-tab-measure").invisible());+ tab_body(&mut child, tab, &mut d.clone(), t, &mut Registry::default(), custom, &mut Vec::new());+ child.cursor().top() - top+ }++ /// Draw the dialog. Returns `Some(params)` when OK is pressed, `Some(Null)` on Cancel. `custom`+ /// are the presets the user saved; saving or deleting one pushes its engine command to `cmds`.+ pub fn show(+ ui: &mut egui::Ui,+ d: &mut CompDraft,+ t: &Tokens,+ auto: &mut Registry,+ custom: &[CompPreset],+ cmds: &mut Vec<(&'static str, serde_json::Value)>,+ ) -> Option<serde_json::Value> {+ let mut out = None;+ ui.horizontal(|ui| {+ ui.label(tr("Composition Name:"));+ let r = ui.add(egui::TextEdit::singleline(&mut d.name).desired_width(300.0));+ crate::widgets::focus_on_open(ui.ctx(), &r, &d.name);+ auto.add("dialog.comp.name", r.rect, "Composition Name");+ });+ ui.add_space(8.0);+ ui.horizontal(|ui| {+ for (tab, label, key) in [(Tab::Basic, "Basic", "basic"), (Tab::Advanced, "Advanced", "advanced"), (Tab::Renderer, "3D Renderer", "renderer")] {- let r = ui.selectable_label(d.tab == tab, label);++ let r = ui.selectable_label(d.tab == tab, tr(label));+ auto.add(&format!("dialog.comp.tab.{key}"), r.rect, label);+ if r.clicked() {+ d.tab = tab;+ }+ }+ });+ ui.separator();+ // Every tab takes the height of the tallest one, so Cancel and OK stay put between tabs.+ let body_top = ui.cursor().top();+ tab_body(ui, d.tab, d, t, auto, custom, cmds);+ let shown = ui.cursor().top() - body_top;+ let tallest = [Tab::Basic, Tab::Advanced, Tab::Renderer]+ .into_iter()+ .filter(|tab| *tab != d.tab)+ .fold(shown, |h, tab| h.max(tab_height(ui, tab, d, t, custom, body_top)));+ ui.add_space((tallest - shown).max(0.0));ui.add_space(14.0);ui.horizontal(|ui| {ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {