Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge main into M13.1 (scripts in File ▸ Scripts / Window via @dynamic menu nodes)

Brandon Thomas47d2da04de3e
diff --cc crates/engine/src/commands/mod.rs
index 16afc125d,d9e4feec8..17a496a0a
--- a/crates/engine/src/commands/mod.rs
+++ b/crates/engine/src/commands/mod.rs
@@@ -40,7 -47,7 +47,8 @@@ mod query
mod render_queue;
pub(crate) mod rig3d;
pub mod roto_cmds;
+ mod scene_detect;
+pub mod scripts;
mod settings;
mod shape_stroke;
mod stubs;
@@@ -159,7 -175,12 +176,13 @@@ pub fn command_specs() -> &'static [Com
v.extend(essential::specs());
v.extend(expr_tools::specs());
v.extend(proxy::specs());
+ v.extend(scripts::specs());
+ v.extend(panels_cmds::specs());
+ v.extend(footage_panel::specs());
+ v.extend(autotrace::specs());
+ v.extend(scene_detect::specs());
+ v.extend(align_data::specs());
+ v.extend(content_fill::specs());
v.extend(stubs::specs());
v
})
diff --cc crates/engine/src/lib.rs
index ad6ae4fba,f7fda4871..41ff6a190
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@@ -13,18 -13,21 +13,23 @@@ pub mod camera_track
pub mod commands;
pub mod config;
pub mod demo;
+pub mod history;
+ pub mod jobs;
pub mod links;
+ pub mod logging;
pub mod mask_track;
+ pub mod media_browser;
+ pub mod media_cache;
pub mod menus;
pub mod offload;
pub mod prefs;
pub mod psd_import;
pub mod render_queue;
pub mod roto;
+pub mod scriptui;
mod session_settings;
pub mod shortcuts;
+ pub mod sysinfo;
pub mod tracking;
pub mod vector;
pub mod viewer;
@@@ -314,11 -336,11 +330,16 @@@ pub struct Session
/// The JavaScript scripting engine (set by the host that links `effectcraft-script`):
/// `script.run`, File ▸ Scripts ▸ Run Script File… (`.jsx`/`.js`) and the Script Console.
pub script: Option<ScriptRunner>,
+ /// Loads WebAssembly effect plug-ins (set by the host that links `effectcraft-plugin` with
+ /// its runtime): `effect.plugins.load`.
+ pub plugin_loader: Option<PluginLoader>,
+ /// ScriptUI windows and panels opened by scripts (see [`scriptui`]).
+ pub script_ui: scriptui::ScriptUi,
+ /// The last physical-memory reading (Settings ▸ Memory & CPU budgets); `None` = unknown
+ /// (headless sessions don't query it, see [`Session::memory_tick`]).
+ pub sys_memory: Option<sysinfo::SysMemory>,
+ /// Switches Affect Nested Comps as last applied (a change empties the layer cache).
+ pub applied_nested_switches: Option<bool>,
/// Runs renders and analyses off the UI thread where there are no threads (the web app's
/// Web Workers, see [`offload`]); `None` = threads (desktop) or inline (wasm32).
pub offload: Option<Arc<dyn offload::Offload>>,
@@@ -382,10 -405,13 +408,15 @@@ impl Default for Session
autosave: autosave::AutoSaveState::default(),
snapshot: None,
script: None,
+ plugin_loader: None,
+ script_ui: scriptui::ScriptUi::default(),
+ sys_memory: None,
+ applied_nested_switches: None,
offload: None,
offloaded: vec![],
+ tasks: vec![],
+ job_log: vec![],
+ next_task_id: 1,
}
}
}
@@@ -750,9 -823,71 +826,73 @@@ pub fn text_presets() -> Vec<(String, S
pub fn text_families() -> Vec<String> {
effectcraft_text::families().into_iter().map(|(f, _)| f).collect()
}
+
+ /// One row of the Character panel's font menu.
+ #[derive(Clone, Debug, PartialEq)]
+ pub struct FontRow {
+ /// The family to apply (empty for the separator after the recent fonts).
+ pub family: String,
+ /// What the menu shows: the English family name, or the font's own-language name when
+ /// Settings ▸ Type ▸ Show Font Names in English is off.
+ pub display: String,
+ pub recent: bool,
+ }
+
+ /// Outline polylines of "Sample" set in `family` at `size` px (baseline at y = 0, y down), for
+ /// the font menu's preview (Settings ▸ Type ▸ Show Font Preview).
+ pub fn font_preview(family: &str, size: f64) -> Vec<Vec<[f32; 2]>> {
+ use kurbo::PathEl;
+ let st = effectcraft_keyframe::text_doc::CharStyle { font: family.to_string(), size, ..Default::default() };
+ let mut out = vec![];
+ let mut x = 0.0;
+ for ch in "Sample".chars() {
+ let (path, adv) = effectcraft_text::char_glyph_style(&st, ch);
+ let mut cur: Vec<[f32; 2]> = vec![];
+ let pt = |p: kurbo::Point| [(p.x + x) as f32, p.y as f32];
+ kurbo::flatten(&path, 0.2, |el| match el {
+ PathEl::MoveTo(p) => {
+ if cur.len() > 1 {
+ out.push(std::mem::take(&mut cur));
+ }
+ cur = vec![pt(p)];
+ }
+ PathEl::LineTo(p) => cur.push(pt(p)),
+ PathEl::ClosePath => {
+ if let Some(f) = cur.first().copied() {
+ cur.push(f);
+ }
+ if cur.len() > 1 {
+ out.push(std::mem::take(&mut cur));
+ }
+ }
+ _ => {}
+ });
+ if cur.len() > 1 {
+ out.push(cur);
+ }
+ x += adv;
+ }
+ out
+ }
+
+ /// The Character panel's font menu: the recent fonts (Settings ▸ Type ▸ Number of Recent Fonts
+ /// to Display), a separator, then every family.
+ pub fn font_menu(prefs: &prefs::Prefs) -> Vec<FontRow> {
+ let all = text_families();
+ let native = if prefs.type_.font_names_in_english { Default::default() } else { effectcraft_text::fonts::native_families() };
+ let row = |f: &String, recent: bool| FontRow { family: f.clone(), display: native.get(f).cloned().unwrap_or_else(|| f.clone()), recent };
+ let mut out: Vec<FontRow> = prefs.recent_fonts_shown().iter().filter(|f| all.contains(f)).map(|f| row(f, true)).collect();
+ if !out.is_empty() {
+ out.push(FontRow { family: String::new(), display: "-".into(), recent: false });
+ }
+ out.extend(all.iter().map(|f| row(f, false)));
+ out
+ }
#[cfg(test)]
+mod tests_history;
+#[cfg(test)]
mod tests_paint;
#[cfg(test)]
+ mod tests_panels;
+ #[cfg(test)]
mod tests_roto;
diff --cc crates/engine/src/menus.rs
index 84522c196,9ab366dbe..d43b9bccb
--- a/crates/engine/src/menus.rs
+++ b/crates/engine/src/menus.rs
@@@ -35,7 -37,116 +37,129 @@@ use crate::commands::{self, CommandSpec
pub enum MenuNode {
Item(MenuEntry),
Separator,
- Submenu { label: String, children: Vec<MenuNode> },
+ Submenu {
+ label: String,
+ children: Vec<MenuNode>,
+ },
+ /// Entries computed when the menu opens (see [`dynamic`]).
+ Dynamic {
+ name: String,
+ },
+ }
+
+ /// Frontend state dynamic menus depend on.
+ #[derive(Clone, Copy, Debug, Default)]
+ pub struct DynCtx<'a> {
+ /// The current workspace (Window ▸ Assign Shortcut to "…" Workspace).
+ pub workspace: Option<&'a str>,
+ }
+
+ fn file_name(p: &str) -> String {
+ std::path::Path::new(p).file_name().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| p.to_string())
+ }
+
+ fn dyn_entry(label: String, command: &str, params: Value) -> MenuEntry {
+ MenuEntry { label, command: command.into(), params, shortcut: None }
+ }
+
+ /// The bindable holding shortcut `keys` in the active preset (its label).
+ fn holder_of(s: &Session, keys: &str) -> Option<String> {
+ let t = s.shortcuts();
+ t.bindables.iter().find(|b| t.keys.get(&b.key).is_some_and(|k| k.iter().any(|k| k == keys))).map(|b| b.label.clone())
+ }
+
+ /// The entries of a `@dynamic:<name>` node, and the disabled placeholder shown when there are
+ /// none: `recentProjects`, `recentFootage`, `recentPresets`, `history` (undo steps, newest
+ /// first), `view3dShortcuts`, `workspaceShortcuts` and `openViewers` (open compositions other
-/// than the active one).
++/// than the active one), `scripts` (File ▸ Scripts) and `scriptPanels` (ScriptUI panels).
+ pub fn dynamic(s: &Session, name: &str, cx: &DynCtx) -> (Vec<MenuEntry>, Option<&'static str>) {
+ use serde_json::json;
+ let indexed = |list: &[String], cmd: &str, stem: bool| -> Vec<MenuEntry> {
+ list.iter()
+ .enumerate()
+ .map(|(i, p)| {
+ let n =
+ if stem { std::path::Path::new(p).file_stem().map(|n| n.to_string_lossy().to_string()).unwrap_or_else(|| p.clone()) } else { file_name(p) };
+ dyn_entry(n, cmd, json!({"index": i}))
+ })
+ .collect()
+ };
+ match name {
+ "recentProjects" => (indexed(&s.prefs.recent_projects, "file.openRecent", false), Some("No Recent Projects")),
+ "recentFootage" => (indexed(&s.prefs.recent_footage, "file.importRecent", false), Some("No Recent Footage")),
+ "recentPresets" => (indexed(&s.prefs.recent_presets, "anim.applyRecentPreset", true), Some("No Recent Presets")),
+ "history" => (
+ s.history.undo.iter().rev().enumerate().map(|(i, (l, _))| dyn_entry(format!("Undo {l}"), "edit.history", json!({"steps": i + 1}))).collect(),
+ Some("No History"),
+ ),
+ "view3dShortcuts" => (
+ ["F10", "F11", "F12"]
+ .iter()
+ .map(|k| {
+ let label = match holder_of(s, k) {
+ Some(h) => format!("{k} (Replace “{h}”)"),
+ None => k.to_string(),
+ };
+ dyn_entry(label, "view.assign3dShortcut", json!({"slot": k}))
+ })
+ .collect(),
+ None,
+ ),
+ "workspaceShortcuts" => (
+ ["Shift+F10", "Shift+F11", "Shift+F12"]
+ .iter()
+ .map(|k| {
+ let label = match holder_of(s, k) {
+ Some(h) => format!("{k} (Replace “{h}”)"),
+ None => k.to_string(),
+ };
+ let mut p = json!({"slot": k});
+ if let Some(w) = cx.workspace {
+ p["workspace"] = json!(w);
+ }
+ dyn_entry(label, "window.assignWorkspaceShortcut", p)
+ })
+ .collect(),
+ None,
+ ),
+ "openViewers" => (
+ s.state
+ .open_comps
+ .iter()
+ .filter(|c| Some(**c) != s.state.active_comp)
+ .filter_map(|c| s.project.item(*c).map(|i| dyn_entry(format!("Composition: {}", i.name), "comp.open", json!({"comp": c.0}))))
+ .collect(),
+ None,
+ ),
++ // File ▸ Scripts: installed and sample scripts; the Window menu's ScriptUI panels.
++ "scripts" | "scriptPanels" => {
++ let panels = name == "scriptPanels";
++ let cmd = if panels { "window.scriptPanel" } else { "file.runScript" };
++ (
++ crate::commands::scripts::scripts(s)
++ .into_iter()
++ .filter(|e| e.panel == panels)
++ .map(|e| dyn_entry(e.name.clone(), cmd, json!({"name": e.name})))
++ .collect(),
++ None,
++ )
++ }
+ _ => (vec![], None),
+ }
+ }
+
+ /// Display label of a submenu (the "Assign Shortcut to …" submenus name the current view or
+ /// workspace, like After Effects).
+ pub fn submenu_label(s: &Session, label: &str, cx: &DynCtx) -> String {
+ match label {
+ "Assign Shortcut to 3D View" => {
+ let v = s.active_comp_id().and_then(|c| s.state.views3d.get(&c)).map(|v| v.current).unwrap_or_default();
+ let name = crate::commands::find(crate::commands::view_command(v)).map(|c| c.label).unwrap_or("Active Camera");
+ format!("Assign Shortcut to “{name}”")
+ }
+ "Assign Shortcut to Workspace" => format!("Assign Shortcut to “{}” Workspace", cx.workspace.unwrap_or("Default")),
+ _ => label.to_string(),
+ }
}
/// A clickable menu entry.
@@@ -371,8 -516,6 +529,10 @@@ Fil
Find Missing Footage | file.findMissing {"what":"footage"}
---
Scripts
++ @dynamic:scripts
++ ---
+ Install Script File... | file.installScript
+ Install ScriptUI Panel... | file.installScriptUIPanel
Run Script File... | file.runScript
---
Create Proxy
@@@ -987,6 -1144,7 +1162,9 @@@ Windo
Project | window.panel {"panel":"project"} | Cmd+0
Render Queue | window.panel {"panel":"renderQueue"} | Cmd+Alt+0
Timeline | window.panel {"panel":"timeline"}
+ @dynamic:openViewers
++ ---
++ @dynamic:scriptPanels
Help
EffectCraft Help... | help.docs {"page":"help"} | F1
Scripting Help... | help.docs {"page":"scripting"}
diff --cc crates/engine/src/session_settings.rs
index 155204d4f,d68496a22..96cd5a298
--- a/crates/engine/src/session_settings.rs
+++ b/crates/engine/src/session_settings.rs
@@@ -25,13 -25,21 +25,19 @@@ impl Session
/// Settings changed: apply what the engine owns (cache budgets) and tell frontends.
pub fn prefs_changed(&mut self) {
self.prefs.normalize();
- self.layer_cache.set_budget(self.prefs.layer_cache_bytes());
- self.footage.set_cache_budget(self.prefs.media_cache_bytes());
+ self.apply_cache_budgets();
self.configure_disk_cache();
+ self.footage.set_conform_folder(self.conformed_audio_folder());
+ // Switches Affect Nested Comps changes what precomp layers render: drop cached pixels.
+ let nested = self.prefs.general.switches_affect_nested_comps;
+ if self.applied_nested_switches.replace(nested).is_some_and(|was| was != nested) {
+ self.layer_cache.clear();
+ self.events.push(crate::Event::PurgeCaches);
+ }
// Fewer undo levels apply right away.
let levels = self.prefs.general.undo_levels.max(1) as usize;
- if self.history.undo.len() > levels {
- let extra = self.history.undo.len() - levels;
- self.history.undo.drain(..extra);
- }
+ let current = self.project.clone();
+ self.history.trim(levels, &current);
self.prefs_revision += 1;
}
diff --cc crates/ui-egui/src/dock.rs
index 6f0451011,316b4ea36..28c048374
--- a/crates/ui-egui/src/dock.rs
+++ b/crates/ui-egui/src/dock.rs
@@@ -36,8 -36,12 +36,14 @@@ pub enum PanelKind
MaskInterpolation,
ScriptConsole,
EssentialGraphics,
+ /// A dockable ScriptUI panel (a script from the ScriptUI Panels folder), by script window id.
+ ScriptPanel(u32),
+ LumetriScopes,
+ Footage,
+ MediaBrowser,
+ Metadata,
+ Progress,
+ ContentAwareFill,
}
impl PanelKind {
@@@ -97,7 -107,12 +109,13 @@@
PanelKind::MaskInterpolation => "Mask Interpolation",
PanelKind::ScriptConsole => "Script Console",
PanelKind::EssentialGraphics => "Essential Graphics",
+ PanelKind::ScriptPanel(_) => "ScriptUI Panel",
+ PanelKind::LumetriScopes => "Lumetri Scopes",
+ PanelKind::Footage => "Footage",
+ PanelKind::MediaBrowser => "Media Browser",
+ PanelKind::Metadata => "Metadata",
+ PanelKind::Progress => "Progress",
+ PanelKind::ContentAwareFill => "Content-Aware Fill",
}
}
pub fn id(self) -> String {
diff --cc crates/ui-egui/src/menus.rs
index a6ad85428,69c02433a..c6764dac3
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@@ -797,11 -822,11 +828,13 @@@ fn file_dialog(app: &mut EffectcraftApp
"file.exportLottie" => ("path", Ask::Save("Animation.json")),
"file.importLottie" => ("path", Ask::Open(&["json", "lottie"])),
"render.saveCurrentPreview" => ("path", Ask::Save("Preview.mp4")),
- "file.runScript" => ("path", Ask::Open(&["jsx", "js", "jsonl", "json", "txt"])),
+ "file.runScript" if params.get("name").is_none() => ("path", Ask::Open(&["jsx", "js", "jsonl", "json", "txt"])),
+ "file.installScript" | "file.installScriptUIPanel" => ("path", Ask::Open(&["jsx", "js"])),
+ "effect.plugins.load" if params.get("folder").is_none() => ("path", Ask::Open(&["wasm", "wat"])),
"file.replaceFootage" => ("path", Ask::Import),
"file.collectFiles" => ("folder", Ask::Save("Collected Files")),
+ "file.saveCopyAsXml" => ("path", Ask::Save("Untitled Project.ecprojx")),
+ "keys.rpfCameraImport" => ("path", Ask::Open(&["json", "csv", "txt"])),
"essential.exportTemplate" => ("path", Ask::Save("Template.ectemplate")),
"essential.importTemplate" => ("path", Ask::Open(&["ectemplate"])),
"file.setProxy" => ("path", Ask::Open(&["mp4", "mov", "m4v", "mkv", "webm", "png", "jpg", "jpeg", "gif", "webp", "tif", "tiff", "bmp", "exr"])),
diff --cc crates/ui-egui/src/panels/mod.rs
index 16cc4d821,d9a9864ad..25c8ec016
--- a/crates/ui-egui/src/panels/mod.rs
+++ b/crates/ui-egui/src/panels/mod.rs
@@@ -28,8 -33,8 +33,9 @@@ pub mod properties
pub mod puppet_tool;
pub mod render_queue;
pub mod roto_tool;
+ pub mod scopes_panel;
pub mod script_console;
+pub mod scriptui_view;
pub mod settings;
pub mod shortcut_editor;
pub mod text_panels;
@@@ -99,8 -106,13 +107,14 @@@ pub fn show(app: &mut EffectcraftApp, u
PanelKind::Paint => paint_panels::paint(app, ui, rect),
PanelKind::Brushes => paint_panels::brushes(app, ui, rect),
PanelKind::EssentialGraphics => essential::show(app, ui, rect),
+ PanelKind::ScriptPanel(id) => scriptui_view::panel(app, ui, rect, id),
PanelKind::Flowchart => flowchart::show(app, ui, rect),
+ PanelKind::LumetriScopes => scopes_panel::show(app, ui, rect),
+ PanelKind::Footage => footage_panel::show(app, ui, rect),
+ PanelKind::MediaBrowser => media_panels::media_browser(app, ui, rect),
+ PanelKind::Metadata => media_panels::metadata(app, ui, rect),
+ PanelKind::Progress => media_panels::progress(app, ui, rect),
+ PanelKind::ContentAwareFill => content_fill_panel::show(app, ui, rect),
}
}
diff --cc crates/ui-egui/tests/ui_scriptui.rs
index 621029046,000000000..bbfd9e56c
mode 100644,000000..100644
--- a/crates/ui-egui/tests/ui_scriptui.rs
+++ b/crates/ui-egui/tests/ui_scriptui.rs
@@@ -1,112 -1,0 +1,113 @@@
+//! M13.1 UI: ScriptUI dialogs, palettes and dockable panels drawn from the session's script
+//! windows (clicks reach the script's handlers), the branching History panel, and the Window /
+//! File ▸ Scripts menus listing scripts (egui_kittest, UI logic only).
+
+use effectcraft_ui_egui::EffectcraftApp;
+use effectcraft_ui_egui::dock::PanelKind;
+use egui::{Event, Rect, pos2, vec2};
+use egui_kittest::Harness;
+use serde_json::json;
+
+fn harness() -> Harness<'static, EffectcraftApp> {
+ let mut s = effectcraft_host::session();
+ s.execute("comp.new", json!({"name": "Main", "width": 320, "height": 180, "duration": 4})).unwrap();
+ let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_| EffectcraftApp::new(s));
+ h.run_steps(3);
+ h
+}
+
+fn rect(h: &Harness<'_, EffectcraftApp>, id: &str) -> Rect {
+ let e = h.state().auto.find(id).unwrap_or_else(|| panic!("no {id}"));
+ Rect::from_min_size(pos2(e.rect[0], e.rect[1]), vec2(e.rect[2], e.rect[3]))
+}
+
+fn click(h: &mut Harness<'_, EffectcraftApp>, id: &str) {
+ let c = rect(h, id).center();
+ h.input_mut().events.push(Event::PointerMoved(c));
+ for pressed in [true, false] {
+ h.input_mut().events.push(Event::PointerButton { pos: c, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() });
+ }
+ h.run_steps(3);
+}
+
+fn layer_names(h: &Harness<'_, EffectcraftApp>) -> Vec<String> {
+ h.state().session.active_comp().map(|c| c.layers.iter().map(|l| l.name.clone()).collect()).unwrap_or_default()
+}
+
+#[test]
+fn script_windows_are_drawn_and_clickable() {
+ let mut h = harness();
+ let code = r#"
+ var w = new Window("palette", "Quick Solid");
+ var n = w.add("edittext", undefined, "Card");
+ n.characters = 10;
+ var go = w.add("button", undefined, "Add", { name: "add" });
+ go.onClick = function () { app.project.activeItem.layers.addSolid([0, 1, 0], n.text, 50, 50, 1); };
+ w.show();
+ "#;
+ let r = h.state_mut().session.execute("script.run", json!({"code": code, "name": "quick.jsx"})).unwrap();
+ assert_eq!(r["ok"], true, "{r}");
+ h.run_steps(3);
+ let win = h.state().session.script_ui.windows[0].id;
+ // Every control has an automation id (by id and by name).
+ for id in [format!("scriptui.{win}"), format!("scriptui.{win}.1"), format!("scriptui.{win}.2"), format!("scriptui.{win}.add")] {
+ assert!(h.state().auto.find(&id).is_some(), "missing {id}");
+ }
+ click(&mut h, &format!("scriptui.{win}.add"));
+ assert_eq!(layer_names(&h), ["Card"]);
+ // A modal dialog: the script waits in show() until OK is clicked.
+ let code = r#"
+ var d = new Window("dialog", "Confirm");
+ d.add("statictext", undefined, "Make a null?");
+ var g = d.add("group");
+ g.add("button", undefined, "Cancel", { name: "cancel" });
+ g.add("button", undefined, "OK", { name: "ok" });
+ if (d.show() === 1) app.project.activeItem.layers.addNull().name = "Yes";
+ "#;
+ let r = h.state_mut().session.execute("script.run", json!({"code": code, "name": "confirm.jsx"})).unwrap();
+ assert_eq!(r["waiting"], true, "{r}");
+ h.run_steps(3);
+ let d = h.state().session.script_ui.windows.iter().find(|w| w.modal).unwrap().id;
+ click(&mut h, &format!("scriptui.{d}.ok"));
+ assert_eq!(layer_names(&h), ["Yes", "Card"]);
+ assert!(h.state().session.script_ui.windows.iter().all(|w| !w.modal));
+ // Window ▸ <panel>: the sample ScriptUI panel docks as its own tab.
+ h.state_mut().session.execute("window.scriptPanel", json!({"name": "Layer Tools.jsx"})).unwrap();
+ h.run_steps(3);
+ let panel = h.state().session.script_ui.windows.iter().find(|w| w.script == "Layer Tools.jsx").unwrap().id;
+ assert!(h.state().ui.dock.contains(PanelKind::ScriptPanel(panel)), "the panel docks");
+ assert!(h.state().auto.find(&format!("scriptui.{panel}")).is_some());
+ // The menus list scripts and panels.
- let window_menu = effectcraft_ui_egui::menus::dynamic_entries(h.state(), "Window");
- assert!(window_menu.iter().any(|(l, c, _)| l == "Layer Tools.jsx" && c == "window.scriptPanel"));
- let scripts = effectcraft_ui_egui::menus::dynamic_entries(h.state(), "Scripts");
- assert!(scripts.iter().any(|(l, c, _)| l == "Rename Layers.jsx" && c == "file.runScript"));
++ let cx = effectcraft_engine::menus::DynCtx::default();
++ let (panels, _) = effectcraft_engine::menus::dynamic(&h.state().session, "scriptPanels", &cx);
++ assert!(panels.iter().any(|e| e.label == "Layer Tools.jsx" && e.command == "window.scriptPanel"));
++ let (scripts, _) = effectcraft_engine::menus::dynamic(&h.state().session, "scripts", &cx);
++ assert!(scripts.iter().any(|e| e.label == "Rename Layers.jsx" && e.command == "file.runScript"));
+ // Closing the panel's tab closes its script window.
+ h.state_mut().close_panel(PanelKind::ScriptPanel(panel));
+ h.run_steps(2);
+ assert!(h.state().session.script_ui.window(panel).is_none());
+ h.state_mut().session.execute("scriptui.close", json!({})).unwrap();
+}
+
+#[test]
+fn history_panel_jumps_between_branches() {
+ let mut h = harness();
+ for n in ["A", "B"] {
+ h.state_mut().session.execute("layer.newSolid", json!({"name": n, "color": "#ffffff", "width": 10, "height": 10})).unwrap();
+ }
+ h.state_mut().session.undo();
+ h.state_mut().session.execute("layer.newSolid", json!({"name": "C", "color": "#ffffff", "width": 10, "height": 10})).unwrap();
+ assert_eq!(layer_names(&h), ["C", "A"]);
+ h.state_mut().show_panel(PanelKind::History);
+ h.run_steps(3);
+ // Original, New Composition, A, C, and B on its branch.
+ let states = h.state().session.history_tree();
+ assert_eq!(states.len(), 5);
+ let b = states.iter().find(|n| n.depth == 1).unwrap().index;
+ click(&mut h, &format!("history.state.{b}"));
+ assert_eq!(layer_names(&h), ["B", "A"]);
+ let c = h.state().session.history_tree().iter().find(|n| n.depth == 1).unwrap().index;
+ click(&mut h, &format!("history.state.{c}"));
+ assert_eq!(layer_names(&h), ["C", "A"]);
+}
diff --cc docs/parity.md
index a75d37f54,9c2b2d47c..b2340b0e3
--- a/docs/parity.md
+++ b/docs/parity.md
@@@ -22,13 -22,7 +22,12 @@@ Tracking 88%, Effects 85%, Web 65%
What is left, in priority order: the web app's depth (threads, storage, audio, non-blocking
renders); stroke taper/wave and multi-segment dashes; variable mask feather points; camera iris/bokeh and focus-link commands; Render Queue field render, crop/resize and templates;
approximated effects (Subspace Warp, Key Cleaner) and Liquify's viewer brush; OpenType features and variable
- font axes; AI/EPS/PDF import; more codecs; 59 preferences not yet wired;
- Lumetri Scopes, Footage, Media Browser and Metadata panels; Content-Aware Fill; and face tracking.
-font axes; AI/EPS/PDF import; more codecs; 59 preferences not yet wired; ScriptUI; face tracking; and the "better than After Effects" items (a plug-in API, branching history; GPU particles landed in M12.7).
++font axes; AI/EPS/PDF import; more codecs; 59 preferences not yet wired; and face tracking.
+ScriptUI (dialogs that block `show()`, palettes, dockable ScriptUI panels, File ▸ Scripts install
+and sample scripts), puppet pin recording and the remaining "better than After Effects" items — a
+versioned effect plug-in API with sandboxed WebAssembly plug-ins ([plugins.md](plugins.md)),
+branching undo history in the History panel, and a bit-identical rendering test across runs and
+thread counts — landed in M13.1 (GPU particles landed in M12.7).
The sections below are the original audit (morning of 2 October, ≈ 64%) and its updates, kept for
history.