mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-23 19:01:04 +01:00
* Scripts: a ScriptUI Browse… button opens the file dialog Fixes #2778. Fixes #2894. File.openDialog, File.saveDialog, Folder.selectDialog and the instance openDlg / saveDlg / selectDlg were stubs that returned null, so a script dialog's or a dockable ScriptUI panel's Browse… button did nothing. On a script-host thread, in an app that shows them, the script now asks for the dialog (Session::script_ui.file_dialogs, each with an id), hands the session back like a modal dialog's show() does and waits for the answer: a File (an array with multiSelect), a Folder, or null when cancelled. The script's filter becomes the dialog's (its name, "All Files" for *.*); without extensions every file shows. Headless runs, the Script Console, the web and Shutdown scripts get null at once. The app shows the dialog after the pass's events: blocking on Windows (Hooks::pick_file_dialog), without blocking on macOS and Linux, one at a time; a non-blocking dialog that ends without answering counts as cancelled. scriptui.fileDialogs lists the waiting dialogs and scriptui.fileDialog answers one (refused while file access is confined, and refused to scripts). A dialog leaves the list only when its script has the answer; the script's windows refuse events meanwhile, except scriptui.close, which cancels the file dialog first. A script host that ends takes its dialogs with it. * Scripts: carry a file dialog's prompt, start location and filter to the native dialog (#2778) serve_file_dialogs collected the script's prompt, start folder and save filter but dropped them at the host boundary. FileDialog::Script now carries prompt and start, and new ScriptFolder and ScriptSave requests carry the folder dialog's prompt/start and the save dialog's prompt and whole filter (label, extensions, any file) instead of the default name's extension. Both the blocking and the non-blocking host dialogs apply title, initial directory and filters; Save also goes through the blocking hook where one is set. Hook-level regression test asserts all three requests. * Scripts: a hidden window paints so a script's file dialog is shown (#3253 review) * Scripts: formatting (#3253)