From 1662723cae541837df6b0fdb13a3b09ee2f73c90 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 30 Nov 2026 17:54:45 -0800 Subject: [PATCH] MCP: ui.menuDialog lists the slider keys and Edit Points Only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main now lists the Smooth and Simplify sliders in ui.inspect as dialogs smoothSlider and simplifySlider, which ui.dialog.set, confirm and cancel control, and Object › Plug-ins › Selection Tools › Edit Points Only… opens through ui.menuDialog. The params text of ui.menuDialog, ui.smoothAuto and ui.simplifyAuto, docs/mcp.md and the menu dialog key test now say so. --- crates/mcp/src/ui_catalog.rs | 6 +++--- crates/ui-egui/src/dialogs/tests.rs | 28 ++++++++++--------------- crates/ui-egui/src/menus/ui_commands.rs | 6 +++--- docs/mcp.md | 14 +++++++------ 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index e1ff8d54a0..2c8f54eb6e 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1531,7 +1531,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.color.applyNearestSwatch|addon.select.byArtboards|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, and `envelopeOptions` for object.envelope.options; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; a slider over the canvas, not a dialog, for object.path.smooth, and for object.path.simplify until OK in its dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.color.applyNearestSwatch|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", @@ -1549,13 +1549,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.simplifyAuto", "Auto-Simplify", "", - "{} the open Simplify slider (Object › Path › Simplify opens it: a canvas popover with slider `level` 0..100, object.path.simplify's level, opening at the level object.path.simplify {auto: true} picks for the selection, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect does not list the popover as a dialog, and ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel do not control it; after OK in the Simplify dialog with `retain` ticked, the menu item opens the dialog `object.path.simplify` with the fields of that OK instead) moves to the level object.path.simplify {auto: true} picks for the selection and previews it → {level}; an error when the slider isn't open", + "{} the open Simplify slider (Object › Path › Simplify opens it: a canvas popover with slider `level` 0..100, object.path.simplify's level, opening at the level object.path.simplify {auto: true} picks for the selection, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect lists the popover as dialog `simplifySlider` with field `level`, ui.dialog.set moves the slider (refusing a level outside 0..100), ui.dialog.confirm keeps the result as Enter does, and ui.dialog.cancel restores the paths as Escape does; after OK in the Simplify dialog with `retain` ticked, the menu item opens the dialog `object.path.simplify` with the fields of that OK instead) moves to the level object.path.simplify {auto: true} picks for the selection and previews it → {level}; an error when the slider isn't open", ), ( "ui.smoothAuto", "Auto-Smooth", "", - "{} the open Smooth slider (Object › Path › Smooth, the canvas context menu's Smooth… and the Contextual Task Bar's Smooth open it: a canvas popover with slider `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect does not list the popover as a dialog, and ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel do not control it) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", + "{} the open Smooth slider (Object › Path › Smooth, the canvas context menu's Smooth… and the Contextual Task Bar's Smooth open it: a canvas popover with slider `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect lists the popover as dialog `smoothSlider` with field `level`, ui.dialog.set moves the slider (refusing a level outside 0..100), ui.dialog.confirm keeps the result as Enter does, and ui.dialog.cancel restores the paths as Escape does) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", ), ( "ui.simplifyMoreOptions", diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index 5311a8c2d3..38c156048e 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -1059,13 +1059,12 @@ fn names(clause: &str, id: &str) -> bool { /// Each command `ui.menuDialog`'s params text lists opens the dialog that text names, by the `key` `ui.inspect` /// reports: the command id unless the text names another key for that command, none for the commands the text says -/// have no key, and no dialog for the commands the text says show a slider. Every key the text names is one a listed -/// command opens. +/// have no key, and the slider's key for Smooth and Simplify, whose sliders show over the canvas. Every key the text +/// names is one a listed command opens. #[test] fn menu_dialog_opens_the_dialog_keys_its_params_text_names() { let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.menuDialog").expect("registered").3; let list = doc.strip_prefix("{command: ").and_then(|rest| rest.split_once('}')).expect("a command list").0; - let sliders = clause(doc, "not a dialog, for ", &[';']); let keyless = clause(doc, "the dialogs of ", &[';']); let except = clause(doc, "is the command id, except ", &[';']); let mut opened = Vec::new(); @@ -1086,21 +1085,16 @@ fn menu_dialog_opens_the_dialog_keys_its_params_text_names() { ); let keys: Vec = entries.into_iter().flatten().collect(); match keys.last() { - None if names(keyless, id) => {} - None => { - assert!(names(sliders, id), "{id} opens no dialog, and the params text does not say it shows a slider"); - let showing = match id { - "object.path.simplify" => crate::dialogs::simplify_slider::showing(&app), - "object.path.smooth" => crate::dialogs::smooth_slider::showing(&app), - _ => false, - }; - assert!(showing, "{id}: its slider is not showing"); - } - Some(key) => { - assert!(!names(sliders, id), "{id} opens a dialog, and the params text says it shows a slider"); - assert_eq!(key, expected, "{id}: its dialog key differs from the params text"); - } + None => assert!(names(keyless, id), "{id} opens no dialog"), + Some(key) => assert_eq!(key, expected, "{id}: its dialog key differs from the params text"), } + // Smooth and Simplify open the slider over the canvas, which ui.inspect lists under its own key. + let showing = match id { + "object.path.simplify" => crate::dialogs::simplify_slider::showing(&app), + "object.path.smooth" => crate::dialogs::smooth_slider::showing(&app), + _ => true, + }; + assert!(showing, "{id}: its slider is not showing"); opened.extend(keys); } for named in except.split('`').skip(1).step_by(2) { diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 370b12d2b1..5681df62bf 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1532,7 +1532,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.menuDialog", "Menu Dialog", "", - "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.color.applyNearestSwatch|addon.select.byArtboards|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, and `envelopeOptions` for object.envelope.options; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; a slider over the canvas, not a dialog, for object.path.smooth, and for object.path.simplify until OK in its dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", + "{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.color.applyNearestSwatch|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)", ), ( "ui.widthPointEdit", @@ -1550,13 +1550,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.simplifyAuto", "Auto-Simplify", "", - "{} the open Simplify slider (Object › Path › Simplify opens it: a canvas popover with slider `level` 0..100, object.path.simplify's level, opening at the level object.path.simplify {auto: true} picks for the selection, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect does not list the popover as a dialog, and ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel do not control it; after OK in the Simplify dialog with `retain` ticked, the menu item opens the dialog `object.path.simplify` with the fields of that OK instead) moves to the level object.path.simplify {auto: true} picks for the selection and previews it → {level}; an error when the slider isn't open", + "{} the open Simplify slider (Object › Path › Simplify opens it: a canvas popover with slider `level` 0..100, object.path.simplify's level, opening at the level object.path.simplify {auto: true} picks for the selection, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect lists the popover as dialog `simplifySlider` with field `level`, ui.dialog.set moves the slider (refusing a level outside 0..100), ui.dialog.confirm keeps the result as Enter does, and ui.dialog.cancel restores the paths as Escape does; after OK in the Simplify dialog with `retain` ticked, the menu item opens the dialog `object.path.simplify` with the fields of that OK instead) moves to the level object.path.simplify {auto: true} picks for the selection and previews it → {level}; an error when the slider isn't open", ), ( "ui.smoothAuto", "Auto-Smooth", "", - "{} the open Smooth slider (Object › Path › Smooth, the canvas context menu's Smooth… and the Contextual Task Bar's Smooth open it: a canvas popover with slider `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect does not list the popover as a dialog, and ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel do not control it) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", + "{} the open Smooth slider (Object › Path › Smooth, the canvas context menu's Smooth… and the Contextual Task Bar's Smooth open it: a canvas popover with slider `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths; ui.inspect lists the popover as dialog `smoothSlider` with field `level`, ui.dialog.set moves the slider (refusing a level outside 0..100), ui.dialog.confirm keeps the result as Enter does, and ui.dialog.cancel restores the paths as Escape does) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", ), ( "ui.simplifyMoreOptions", diff --git a/docs/mcp.md b/docs/mcp.md index e979efa27e..31412c3703 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8669,8 +8669,9 @@ A path with only lone anchors selected, and every path with `wholePaths: true`, In the desktop app, unless retained settings select the Simplify dialog (see below), Object › Path › Simplify opens a canvas popover (`ui.menuDialog {command: "object.path.simplify"}`) with a slider for `level` (0..100) at the Auto-Simplify level for the selection. The canvas previews the result. -Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths. `ui.inspect` does not list -the popover as a dialog, and `ui.dialog.set`, `ui.dialog.confirm` and `ui.dialog.cancel` do not control it. +Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; Escape restores the paths. `ui.inspect` lists +the popover as dialog `simplifySlider` with field `level`. `ui.dialog.set` moves the slider and refuses a level outside +0..100, `ui.dialog.confirm` keeps the result as Enter does, and `ui.dialog.cancel` restores the paths as Escape does. `ui.simplifyAuto` moves the open slider back to the Auto-Simplify level, and `ui.simplifyMoreOptions` opens the Simplify dialog at the slider's tolerance. When OK confirms the dialog with `retain` ticked, the menu item opens the dialog on those settings next time. @@ -8759,8 +8760,9 @@ In the desktop app, Object › Path › Smooth, the canvas context menu's Smooth path) and the Contextual Task Bar's Smooth (with a path selected whole with the Direct Selection tool) open the canvas popover (`ui.menuDialog {command: "object.path.smooth"}`) with a slider for `level` (0..100) at the Auto-Smooth level. The canvas previews the result. Enter or a click outside the popover keeps the result, recording one undo step if the paths changed and none otherwise; -Escape restores the paths. `ui.inspect` does not list the popover as a dialog, and `ui.dialog.set`, `ui.dialog.confirm` -and `ui.dialog.cancel` do not control it. `ui.smoothAuto` moves the open slider back to the Auto-Smooth level. +Escape restores the paths. `ui.inspect` lists the popover as dialog `smoothSlider` with field `level`. `ui.dialog.set` +moves the slider and refuses a level outside 0..100, `ui.dialog.confirm` keeps the result as Enter does, and +`ui.dialog.cancel` restores the paths as Escape does. `ui.smoothAuto` moves the open slider back to the Auto-Smooth level. ## Circle through two or three points @@ -17593,8 +17595,8 @@ anchor points selected on them. Nothing selected, no anchor point left to keep ( {"name":"run_command","arguments":{"command":"addon.select.editPointsOnly","params":{"segmentEnds":false}}} ``` -In the desktop app, Object › Plug-ins › Selection Tools › Edit Points Only… opens a dialog with Keep Ends of Selected -Segments (off). With Preview on, the canvas shows the narrowed selection; OK keeps it and Cancel puts the selection +In the desktop app, Object › Plug-ins › Selection Tools › Edit Points Only… opens a dialog (`ui.menuDialog {command}`, key +`addon.select.editPointsOnly`) with Keep Ends of Selected Segments (off). With Preview on, the canvas shows the narrowed selection; OK keeps it and Cancel puts the selection back. After a failed preview, a successful preview or OK clears the dialog's error only if that error is still the current status message. Messages from other commands stay displayed.