Plug-ins: ScriptUI Panels folder scripts dock as panels and reopen, as in After Effects
EffectCraft's extension points compared with After Effects' (public user guide and Scripting Guide) are now in docs/plugins.md, which becomes "Plug-ins and extensions": scripts, ScriptUI panels and effect plug-ins, with a short guide and an example panel for writing your own. ScriptUI panels already came from `Scripts/ScriptUI Panels/` in the settings folder, were listed at the bottom of the Window menu and docked as tabs. What was missing: After Effects reopens the panels that were open when it quit. Now the open panels are remembered in `scriptui_panels.json` in the settings folder (a panel is added when it opens and dropped when its tab or its script closes it; quitting leaves the list), and `window.restoreScriptPanels` opens them again; the desktop and web apps run it at start-up. A panel whose script is gone or fails is reported and forgotten, and the others still open. Where a panel was docked isn't kept, as workspace layouts aren't saved between launches. Gaps recorded in plugins.md and gaps.md G8: the Startup and Shutdown script folders, keyboard shortcuts for scripts, ExtendScript's `#include` / `#target` directives and `.jsxbin`. Test: open_panels_open_again_at_the_next_launch (fails before: no restore command), a_panel_dropped_in_the_folder_is_listed_and_opens_as_a_panel (script), panels_open_at_quit_dock_again_at_launch (UI: the restored panel docks with its controls; closing the tab forgets it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6ce58040fd
commit
9da33c157e
@@ -90,6 +90,28 @@ fn script_windows_are_drawn_and_clickable() {
|
||||
h.state_mut().session.execute("scriptui.close", json!({})).unwrap();
|
||||
}
|
||||
|
||||
/// A ScriptUI panel open when the app quit opens again, docked, at the next launch (the
|
||||
/// frontends call `window.restoreScriptPanels` before building the app).
|
||||
#[test]
|
||||
fn panels_open_at_quit_dock_again_at_launch() {
|
||||
use effectcraft_engine::config::{ConfigStore, MemoryConfig};
|
||||
let store = std::sync::Arc::new(MemoryConfig::default());
|
||||
store.write("Scripts/ScriptUI Panels/Hello Panel.jsx", "this.add('button', undefined, 'Hi', { name: 'hi' });").unwrap();
|
||||
store.write(effectcraft_engine::commands::scripts::OPEN_PANELS_FILE, r#"{"open": ["Hello Panel.jsx"]}"#).unwrap();
|
||||
let mut s = effectcraft_host::session();
|
||||
s.config = Some(store.clone());
|
||||
s.execute("window.restoreScriptPanels", json!({})).unwrap();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 900.0)).build_eframe(|_| EffectcraftApp::new(s));
|
||||
h.run_steps(3);
|
||||
let panel = h.state().session.script_ui.windows.iter().find(|w| w.script == "Hello Panel.jsx").expect("the panel's window").id;
|
||||
assert!(h.state().ui.dock.contains(PanelKind::ScriptPanel(panel)), "the panel docks");
|
||||
assert!(h.state().auto.find(&format!("scriptui.{panel}.hi")).is_some(), "its controls are drawn");
|
||||
// Closing its tab forgets it for the next launch.
|
||||
h.state_mut().close_panel(PanelKind::ScriptPanel(panel));
|
||||
h.run_steps(2);
|
||||
assert_eq!(store.read(effectcraft_engine::commands::scripts::OPEN_PANELS_FILE).as_deref(), Some(r#"{"open":[]}"#));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn history_panel_jumps_between_branches() {
|
||||
let mut h = harness();
|
||||
|
||||
Reference in New Issue
Block a user