M13.1: ScriptUI frontend (dialogs, palettes, dockable panels), script menus, example plug-in, docs
- ui-egui: scriptui_view draws script windows at engine layout bounds; PanelKind::ScriptPanel; File ▸ Scripts and Window menu list scripts/panels (egui + native menus) - examples/plugins/posterize-bands (WebAssembly, API v1); host plug-in tests; desktop loads <config>/Plug-ins - MCP: script_ui and history tools; docs/plugins.md, agents.md, parity, architecture, ATTRIBUTION Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
89c9b1b6ee
commit
00eb951711
@@ -315,6 +315,20 @@ fn redo(b: &mut Backend, a: &Value) -> Result<Reply> {
|
||||
history(b, a, "edit.redo")
|
||||
}
|
||||
|
||||
fn script_ui_tool(b: &mut Backend, a: &Value) -> Result<Reply> {
|
||||
let action = get(a, "action").and_then(Value::as_str).unwrap_or("list");
|
||||
let id = match action {
|
||||
"list" => "scriptui.list",
|
||||
"get" => "scriptui.get",
|
||||
"click" => "scriptui.click",
|
||||
"set" => "scriptui.set",
|
||||
"close" => "scriptui.close",
|
||||
other => return Err(Error::BadArgs(format!("unknown action `{other}` (list | get | click | set | close)"))),
|
||||
};
|
||||
let p = obj(&[("window", get(a, "window")), ("widget", get(a, "widget")), ("value", get(a, "value")), ("result", get(a, "result"))]);
|
||||
json_reply(b.exec(id, p)?)
|
||||
}
|
||||
|
||||
fn history_tool(b: &mut Backend, a: &Value) -> Result<Reply> {
|
||||
if let Some(g) = get(a, "goto") {
|
||||
let p = match g {
|
||||
@@ -554,6 +568,24 @@ static TOOLS: &[ToolDef] = &[
|
||||
schema: || schema(json!({"goto": {"type": ["integer", "string"], "description": "State index or id to jump to (edit.history.goto)."}}), &[]),
|
||||
run: history_tool,
|
||||
},
|
||||
ToolDef {
|
||||
name: "script_ui",
|
||||
description: "Drive ScriptUI windows that scripts opened (dialogs, palettes, dockable panels). action `list` (default): open windows; `get`: a window's control tree (type, name, text, value, checked, items, selection, bounds); `click`: press a button / toggle a checkbox / pick a radio button; `set`: type text, move a slider, pick a list item (index or text); `close`: close a window (`result` for a dialog's show(), default 2 = Cancel). Controls by id, \"#id\", properties.name or text. A dialog's script resumes when the dialog closes.",
|
||||
bridge_only: false,
|
||||
schema: || {
|
||||
schema(
|
||||
json!({
|
||||
"action": {"type": "string", "enum": ["list", "get", "click", "set", "close"]},
|
||||
"window": {"type": ["integer", "string"], "description": "Window id or title (optional when one is open)."},
|
||||
"widget": {"type": ["integer", "string"], "description": "Control id, \"#id\", properties.name or text."},
|
||||
"value": {"description": "For `set`: text, number, bool, item index or item text."},
|
||||
"result": {"type": "integer", "description": "For `close`: what the dialog's show() returns."}
|
||||
}),
|
||||
&[],
|
||||
)
|
||||
},
|
||||
run: script_ui_tool,
|
||||
},
|
||||
ToolDef {
|
||||
name: "screenshot",
|
||||
description: "Screenshot of the live app window, or one panel (`Composition`, `Timeline`, `EffectControls`, `Project`, ...) or element id, as PNG (longest side `max_side`, default 1600). Use it to check what the UI looks like after an action.",
|
||||
|
||||
Reference in New Issue
Block a user