mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Render path: the adjustment preview's CPU-proxy reason has its own slot (#9328)
A clipped or Blend If adjustment preview runs on the CPU proxy. Its reason lives in a slot of its own, separate from the canvas's per-document reasons and the app-wide reason, so closing or retargeting the dialog ends only the preview's entry and can never report the canvas back on the GPU.
This commit is contained in:
1 parent
63b718a0b3
commit
ae043f50a0
4 files changed
+133
-21
No files matched your search
@@ -218,6 +218,7 @@ fn update(app: &mut PhotocraftApp, idx: usize) -> Option<&AdjustPreview> {
|
||||
if let Some(p) = app.adjust_preview.as_mut() {
|
||||
(p.hash, p.layer_path, p.shown) = (0, false, None);
|
||||
}
|
||||
crate::render_path::adjust_preview_ok(app);
|
||||
return None;
|
||||
};
|
||||
let st = app.session.documents().get(idx)?;
|
||||
@@ -236,11 +237,16 @@ fn update(app: &mut PhotocraftApp, idx: usize) -> Option<&AdjustPreview> {
|
||||
}
|
||||
if app.adjust_preview.as_ref().is_none_or(|p| (p.doc, p.session) != (doc_id, session)) {
|
||||
let doc = st.doc.clone();
|
||||
// A target the layer path can't preview falls to the CPU proxy: say why (#7487).
|
||||
if !channel_target && let Some(why) = unsupported(&doc, target) {
|
||||
crate::render_path::note(app, doc_id.0, crate::render_path::Path::Cpu(crate::render_path::CpuReason::AdjustPreview(why)));
|
||||
let base = if channel_target { None } else { base_document(&doc, target).ok() };
|
||||
// A target the layer path can't preview (or the GPU can't draw) falls to the CPU proxy: say
|
||||
// why (#7487), in the preview's own slot. A channel target's proxy is by design, not a
|
||||
// fallback.
|
||||
let gpu_refuses = app.gpu.as_ref().zip(base.as_ref()).is_some_and(|(g, b)| !g.supports(b));
|
||||
match (!channel_target).then(|| unsupported(&doc, target)).flatten().or(gpu_refuses.then_some("the GPU can't draw the result")) {
|
||||
Some(why) => crate::render_path::adjust_preview_cpu(app, doc_id.0, why),
|
||||
None => crate::render_path::adjust_preview_ok(app),
|
||||
}
|
||||
let base = if channel_target { None } else { base_document(&doc, target).ok().filter(|b| cheap(app, b)).map(Arc::new) };
|
||||
let base = base.filter(|b| cheap(app, b)).map(Arc::new);
|
||||
let region = if base.is_some() { region(&doc, target) } else { Rect::EMPTY };
|
||||
app.adjust_preview = Some(AdjustPreview {
|
||||
doc: doc_id,
|
||||
|
||||
@@ -307,7 +307,8 @@ fn a_clipped_adjustment_preview_records_why_it_uses_the_proxy() {
|
||||
let (doc, _) = document(ColorMode::Rgb, SampleType::U8, false);
|
||||
let clipped = doc.layers[2].id;
|
||||
let mut app = app_with(doc, clipped);
|
||||
crate::adjust_dialog::open(&mut app, "image.adjustments.curves").unwrap();
|
||||
app.render_path.assume_gpu = true;
|
||||
let dialog = crate::adjust_dialog::open(&mut app, "image.adjustments.curves").unwrap();
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
let doc = app.session.active().unwrap().doc.id.0;
|
||||
assert_eq!(app.render_path.current(doc), Some(&crate::render_path::CpuReason::AdjustPreview("the target is clipped")));
|
||||
@@ -317,6 +318,57 @@ fn a_clipped_adjustment_preview_records_why_it_uses_the_proxy() {
|
||||
// Asked again with nothing changed: no new entry.
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
assert_eq!(app.render_path.history().count(), 1);
|
||||
// A GPU refresh of the canvas while the dialog is open doesn't end the preview's reason.
|
||||
crate::render_path::note(&mut app, doc, crate::render_path::Path::Gpu { full: true });
|
||||
assert_eq!(app.render_path.current(doc), Some(&crate::render_path::CpuReason::AdjustPreview("the target is clipped")));
|
||||
assert_eq!(app.render_path.history().count(), 1);
|
||||
// Closing the dialog ends the reason, though the canvas is still current (no refresh).
|
||||
app.ui.close_dialog(dialog);
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
assert_eq!(app.render_path.current(doc), None);
|
||||
assert_eq!(app.render_path.history().count(), 2);
|
||||
let path = crate::render_path::inspect(&app);
|
||||
assert_eq!(path["history"][1]["kind"], "adjustPreview", "the preview's end isn't the canvas back on the GPU: {path}");
|
||||
assert!(path["history"][1]["detail"].is_null(), "{path}");
|
||||
}
|
||||
|
||||
/// A document the canvas already draws on the CPU keeps that reason through an adjustment
|
||||
/// dialog's proxy preview, and closing the dialog doesn't report "back on the GPU".
|
||||
#[test]
|
||||
fn an_adjustment_preview_keeps_the_canvas_reason() {
|
||||
use crate::render_path::{CpuReason, Path};
|
||||
let (doc, _) = document(ColorMode::Rgb, SampleType::U8, false);
|
||||
let clipped = doc.layers[2].id;
|
||||
let canvas_back_on_gpu = |app: &crate::PhotocraftApp| app.render_path.history().any(|c| !c.preview && c.reason.is_none());
|
||||
let mut app = app_with(doc.clone(), clipped);
|
||||
app.render_path.assume_gpu = true;
|
||||
let doc_id = app.session.active().unwrap().doc.id.0;
|
||||
let canvas = CpuReason::Unsupported("Advanced Blending on Layer 1".into());
|
||||
crate::render_path::note(&mut app, doc_id, Path::Cpu(canvas.clone()));
|
||||
let dialog = crate::adjust_dialog::open(&mut app, "image.adjustments.curves").unwrap();
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
assert_eq!(app.render_path.current(doc_id), Some(&canvas));
|
||||
app.ui.close_dialog(dialog);
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
assert_eq!(app.render_path.current(doc_id), Some(&canvas));
|
||||
// The canvas entry, then the preview's start and end: never the canvas back on the GPU.
|
||||
assert_eq!(app.render_path.history().filter(|c| !c.preview).count(), 1);
|
||||
assert!(!canvas_back_on_gpu(&app));
|
||||
|
||||
// A window without the GPU (`--safe-gpu`): the preview adds nothing, before or after closing.
|
||||
let mut app = app_with(doc, clipped);
|
||||
app.render_path.assume_gpu = true;
|
||||
let doc_id = app.session.active().unwrap().doc.id.0;
|
||||
let cpu = CpuReason::CpuMode("--safe-gpu".into());
|
||||
crate::render_path::note_app(&mut app, Some(cpu.clone()));
|
||||
let dialog = crate::adjust_dialog::open(&mut app, "image.adjustments.curves").unwrap();
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
assert_eq!(app.render_path.current(doc_id), Some(&cpu));
|
||||
app.ui.close_dialog(dialog);
|
||||
assert!(!on_layer(&mut app, 0));
|
||||
assert_eq!(app.render_path.current(doc_id), Some(&cpu));
|
||||
assert_eq!(app.render_path.history().count(), 1, "the app-wide entry only");
|
||||
assert!(!canvas_back_on_gpu(&app));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
//! point ([`note`]) by every exit from the GPU path, logged once when it changes, kept in a short
|
||||
//! history, shown in the status bar (`chrome_ui::render_path_status`) and returned by the control
|
||||
//! channel (`perf.renderPath`). `perf.gpuFallback` mirrors the current reason as text.
|
||||
//!
|
||||
//! Three slots, each written only by its own events: the canvas's reason per document ([`note`]),
|
||||
//! a reason for the whole window ([`note_app`]) and an adjustment dialog's CPU proxy preview
|
||||
//! ([`adjust_preview_cpu`] / [`adjust_preview_ok`]). [`RenderPath::current`] reads them in that
|
||||
//! order of precedence: the window, then the canvas, then the preview.
|
||||
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::fmt;
|
||||
@@ -103,6 +108,9 @@ pub struct Change {
|
||||
pub t_ms: f64,
|
||||
pub doc: u64,
|
||||
pub reason: Option<CpuReason>,
|
||||
/// A change of the adjustment preview's slot: `reason` None means the preview stopped using
|
||||
/// the CPU proxy, not that the canvas is back on the GPU.
|
||||
pub preview: bool,
|
||||
}
|
||||
|
||||
/// The current reasons and their history.
|
||||
@@ -111,14 +119,21 @@ pub struct RenderPath {
|
||||
docs: HashMap<u64, CpuReason>,
|
||||
/// A reason for every document: the GPU canvas was dropped, or never started.
|
||||
app_wide: Option<CpuReason>,
|
||||
/// The open adjustment dialog's CPU proxy preview: (doc, [`CpuReason::AdjustPreview`]). Only
|
||||
/// one dialog is open at a time.
|
||||
preview: Option<(u64, CpuReason)>,
|
||||
startup_checked: bool,
|
||||
history: VecDeque<Change>,
|
||||
/// Tests without a GPU: act as if the window had a GPU canvas.
|
||||
#[cfg(test)]
|
||||
pub(crate) assume_gpu: bool,
|
||||
}
|
||||
|
||||
impl RenderPath {
|
||||
/// Why document `doc` is drawn on the CPU now, or None on the GPU.
|
||||
/// Why document `doc` is drawn on the CPU now, or None on the GPU: the window's reason, else
|
||||
/// the canvas's, else the adjustment preview's.
|
||||
pub fn current(&self, doc: u64) -> Option<&CpuReason> {
|
||||
self.app_wide.as_ref().or_else(|| self.docs.get(&doc))
|
||||
self.app_wide.as_ref().or_else(|| self.docs.get(&doc)).or_else(|| self.preview.as_ref().filter(|(d, _)| *d == doc).map(|(_, r)| r))
|
||||
}
|
||||
|
||||
/// The changes, oldest first.
|
||||
@@ -126,11 +141,11 @@ impl RenderPath {
|
||||
self.history.iter()
|
||||
}
|
||||
|
||||
fn push(&mut self, doc: u64, reason: Option<CpuReason>) {
|
||||
fn push(&mut self, doc: u64, reason: Option<CpuReason>, preview: bool) {
|
||||
if self.history.len() == HISTORY {
|
||||
self.history.pop_front();
|
||||
}
|
||||
self.history.push_back(Change { t_ms: crate::gpu_canvas::now_ms(), doc, reason });
|
||||
self.history.push_back(Change { t_ms: crate::gpu_canvas::now_ms(), doc, reason, preview });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +179,7 @@ pub fn note(app: &mut PhotocraftApp, doc: u64, path: Path) {
|
||||
app.perf.gpu_fallback = app.render_path.current(doc).map(ToString::to_string);
|
||||
if changed {
|
||||
log_change(&doc_name(app, doc), next.as_ref());
|
||||
app.render_path.push(doc, next);
|
||||
app.render_path.push(doc, next, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +191,7 @@ pub fn note_app(app: &mut PhotocraftApp, reason: Option<CpuReason>) {
|
||||
app.perf.gpu_fallback = reason.as_ref().map(ToString::to_string);
|
||||
if changed {
|
||||
log_change("all documents", reason.as_ref());
|
||||
app.render_path.push(0, reason);
|
||||
app.render_path.push(0, reason, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +202,42 @@ pub fn view_ok(app: &mut PhotocraftApp, doc: u64) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the window composites on the GPU at all: no reason for every document, and a GPU canvas.
|
||||
fn window_on_gpu(app: &PhotocraftApp) -> bool {
|
||||
#[cfg(test)]
|
||||
let gpu = app.gpu.is_some() || app.render_path.assume_gpu;
|
||||
#[cfg(not(test))]
|
||||
let gpu = app.gpu.is_some();
|
||||
gpu && app.render_path.app_wide.is_none()
|
||||
}
|
||||
|
||||
/// An adjustment dialog on document `doc` previews through the CPU proxy for `why`. It has its
|
||||
/// own slot, so it never replaces or ends the canvas's or the window's reason. Not recorded when
|
||||
/// the whole window is off the GPU: the proxy is then simply part of a CPU window.
|
||||
pub fn adjust_preview_cpu(app: &mut PhotocraftApp, doc: u64, why: &'static str) {
|
||||
if !window_on_gpu(app) {
|
||||
adjust_preview_ok(app);
|
||||
return;
|
||||
}
|
||||
let reason = CpuReason::AdjustPreview(why);
|
||||
let changed = app.render_path.preview.as_ref().is_none_or(|(d, _)| *d != doc);
|
||||
app.render_path.preview = Some((doc, reason.clone()));
|
||||
app.perf.gpu_fallback = app.render_path.current(doc).map(ToString::to_string);
|
||||
if changed {
|
||||
log::info!("render path: {}: adjustment preview uses the CPU proxy: {why}", doc_name(app, doc));
|
||||
app.render_path.push(doc, Some(reason), true);
|
||||
}
|
||||
}
|
||||
|
||||
/// The adjustment dialog closed, or retargeted to a layer the layer path can preview: end its
|
||||
/// CPU proxy preview, if one was recorded. The canvas's and the window's reasons are untouched.
|
||||
pub fn adjust_preview_ok(app: &mut PhotocraftApp) {
|
||||
let Some((doc, _)) = app.render_path.preview.take() else { return };
|
||||
app.perf.gpu_fallback = app.render_path.current(doc).map(ToString::to_string);
|
||||
log::info!("render path: {}: adjustment preview no longer uses the CPU proxy", doc_name(app, doc));
|
||||
app.render_path.push(doc, None, true);
|
||||
}
|
||||
|
||||
/// Once, when the window has no GPU canvas: a software adapter or CPU mode chosen at startup.
|
||||
pub fn frame(app: &mut PhotocraftApp) {
|
||||
if app.render_path.startup_checked || app.gpu.is_some() || app.gpu_fault.is_some() {
|
||||
@@ -209,20 +260,23 @@ fn reason_json(doc: u64, r: Option<&CpuReason>) -> Value {
|
||||
json!({"doc": doc, "kind": r.map(CpuReason::kind), "detail": r.map(ToString::to_string)})
|
||||
}
|
||||
|
||||
/// A history entry: a preview entry's `kind` is always `adjustPreview` (`detail` null when the
|
||||
/// preview stopped using the CPU proxy), so its end never reads as the canvas back on the GPU.
|
||||
fn change_json(c: &Change) -> Value {
|
||||
let mut v = reason_json(c.doc, c.reason.as_ref());
|
||||
if c.preview {
|
||||
v["kind"] = json!("adjustPreview");
|
||||
}
|
||||
v["t"] = json!(c.t_ms);
|
||||
v
|
||||
}
|
||||
|
||||
/// The control channel's `perf.renderPath`: the active document's reason (`null` on the GPU) and
|
||||
/// the history, oldest first.
|
||||
pub fn inspect(app: &PhotocraftApp) -> Value {
|
||||
let active = app.session.active().map(|st| st.doc.id.0);
|
||||
let current = active.and_then(|d| app.render_path.current(d).map(|r| reason_json(d, Some(r))));
|
||||
let history: Vec<Value> = app
|
||||
.render_path
|
||||
.history()
|
||||
.map(|c| {
|
||||
let mut v = reason_json(c.doc, c.reason.as_ref());
|
||||
v["t"] = json!(c.t_ms);
|
||||
v
|
||||
})
|
||||
.collect();
|
||||
let history: Vec<Value> = app.render_path.history().map(change_json).collect();
|
||||
json!({"current": current, "history": history})
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ The transport is `apps/photocraft/src/control_server.rs`, and the handlers are i
|
||||
|
||||
- `engine.execute {command, params}`: run any engine or UI command by id. Engine commands run directly with their default params and never open a dialog. Use `ui.menu.invoke` for menu-click behaviour, which opens a command's dialog when no params are given. `params` must be a JSON object (omit it or pass `null` for none); an array, string, number or boolean is an error naming the command, in every transport (control channel, `serve`, MCP and the CLI)
|
||||
- `engine.commands`: list commands with enablement; the `result` is a JSON array of command objects (see [Command list replies](#command-list-replies))
|
||||
- `ui.inspect`: full UI state (tool, panels, views, dialogs, windows, window size). The menu tree is not included; use `ui.menu.list`. `brushPicker` is `null` while closed and `{pos: [x, y], size: [w, h]?, list: {collapsed, filter, renaming, showName, showStroke, showTip, scale}}` while the Brush Preset picker is open (coordinates in screen points; `size` is the picker's content size once its corner grip was dragged, `null` before that, and the drag remembers both dimensions; the three `show*` flags pick the parts of each preset's card — at least one is always on; `scale` is the footer slider, 0.15–2 with 1 the standard, multiplying the cards' width and height — the heights stop at half size and the name and tip-size text hold their 1.0 size — and dropping the tips' size numbers at 0.40 and below; the parts and the scale are remembered across restarts, while the search, collapsed groups and a rename in progress are not). `view` holds the View/Window/Type preferences: `screen_mode`, `extras`, `show` and `snap_to` flags, `flip_horizontal`, `arrange` (Window › Arrange layout), pixel aspect, font preview size, language options. `perf.timings.gpuInfo` holds the graphics adapter, backend, driver, the backend chosen at launch and why, the canvas renderer (`gpu`/`cpu`) and, after a device loss, `lost` (`help.systemInfo` returns the same as `info`). `perf.renderPath` says why the active document is drawn on the CPU: `current` is `null` on the GPU, else `{doc, kind, detail}` (`kind` is one of `overBudget`, `canvasTooLarge`, `compositorBuild`, `deviceLost`, `gpuError`, `unsupported`, `adjustPreview`, `viewTransform`, `softwareAdapter`, `cpuMode`; `detail` is the English reason, with the working set and budget for `overBudget`), and `history` holds the last 32 changes, oldest first (`{t, doc, kind, detail}`, `kind` `null` for back on the GPU, `doc` 0 for every document). `perf.timings.gpuFallback` is `current`'s `detail` as text
|
||||
- `ui.inspect`: full UI state (tool, panels, views, dialogs, windows, window size). The menu tree is not included; use `ui.menu.list`. `brushPicker` is `null` while closed and `{pos: [x, y], size: [w, h]?, list: {collapsed, filter, renaming, showName, showStroke, showTip, scale}}` while the Brush Preset picker is open (coordinates in screen points; `size` is the picker's content size once its corner grip was dragged, `null` before that, and the drag remembers both dimensions; the three `show*` flags pick the parts of each preset's card — at least one is always on; `scale` is the footer slider, 0.15–2 with 1 the standard, multiplying the cards' width and height — the heights stop at half size and the name and tip-size text hold their 1.0 size — and dropping the tips' size numbers at 0.40 and below; the parts and the scale are remembered across restarts, while the search, collapsed groups and a rename in progress are not). `view` holds the View/Window/Type preferences: `screen_mode`, `extras`, `show` and `snap_to` flags, `flip_horizontal`, `arrange` (Window › Arrange layout), pixel aspect, font preview size, language options. `perf.timings.gpuInfo` holds the graphics adapter, backend, driver, the backend chosen at launch and why, the canvas renderer (`gpu`/`cpu`) and, after a device loss, `lost` (`help.systemInfo` returns the same as `info`). `perf.renderPath` says why the active document is drawn on the CPU: `current` is `null` on the GPU, else `{doc, kind, detail}` (`kind` is one of `overBudget`, `canvasTooLarge`, `compositorBuild`, `deviceLost`, `gpuError`, `unsupported`, `adjustPreview`, `viewTransform`, `softwareAdapter`, `cpuMode`; `detail` is the English reason, with the working set and budget for `overBudget`), and `history` holds the last 32 changes, oldest first (`{t, doc, kind, detail}`, `kind` `null` for back on the GPU, `doc` 0 for every document). An adjustment dialog's CPU proxy preview has its own slot: `current` reports it (`adjustPreview`) only when neither the window nor the canvas has a reason, it isn't recorded while the whole window is off the GPU, and its history entries always have `kind` `adjustPreview`, with `detail` `null` when the preview stops using the proxy (never read as back on the GPU). `perf.timings.gpuFallback` is `current`'s `detail` as text
|
||||
- `ui.set {tool?, panels?, dockTabs?, dock?, dockWidth?, colorPanel?, maskTarget?, vectorMaskTarget?, filterMaskTarget?, selectionMode?, zoom?, center?, rotation?, fit?, theme?, brushSize?, brushSection?, brushTab?, brushesView?, brushPicker?, brushPickerName?, brushPickerStroke?, brushPickerTip?, brushPickerScale?, gradientBlendMode?, gradientClassic?, shapeStroke?}`: change UI state; any other field is an error, checked before anything changes (`zoom` is the canvas zoom where 1 = 100%, one document pixel per physical display pixel, so a scaled display doesn't magnify the image; `theme` is `pro`, `proMedium`, `studio`, `studioLight` or `classic`; `selectionMode` is the selection tools' options-bar mode, 0 New, 1 Add, 2 Subtract, 3 Intersect; `brushSection` indexes the Brush Settings sections, `brushTab` 0 = Brush Settings, 1 = Brushes; `brushesView` is `list` or `grid` for the Brushes panel; `brushPickerName`, `brushPickerStroke` and `brushPickerTip` are the Brush Preset picker's card parts (booleans, at least one on), and `brushPickerScale` its footer card-scale slider (0.15 to 2, 1 the standard); `brushPicker` is `[x, y]` in screen points to open the Brush Preset picker there (as a right-click with a painting tool does) or `null` to close it, and picking a preset in it is `tools.setBrush {"preset": name}`; `dock` is `{order: ["layers", …], heights: {"properties": 180}, collapsed: ["color"], tabOrder: {"layers": ["Paths", "Layers", "Channels"]}}`, the right-dock groups top to bottom, their heights in points, the groups collapsed to their tab strip and each group's tab order left to right by panel name (a group left out keeps its default order, unknown names are ignored and tabs not listed follow in their default order; `dockTabs` keeps indexing tabs in their default order); `dockWidth` sets the right dock width in points, clamped to 250..520; `colorPanel` is `{background?, mode?, ramp?, webSafeRamp?}`, merged into the Color panel's state: `background` is whether it edits the background colour, `mode` its panel-menu display (`hueCube`, `brightnessCube`, `colorWheel`, `grayscaleSlider`, `rgbSliders`, `hsbSliders`, `cmykSliders`, `labSliders` or `webColorSliders`), `ramp` the colour ramp under the sliders (`rgbSpectrum`, `cmykSpectrum`, `grayscaleRamp` or `currentColors`) and `webSafeRamp` Make Ramp Web Safe; `maskTarget` targets the active layer's mask, which, like Photoshop, swaps in the foreground/background pair kept for masks (white/black until one is picked) and swaps the pixels' pair back when the pixels are targeted again; `filterMaskTarget` targets the active smart object's filter mask (an error without smart filters), so painting, fills, filters and adjustments edit it (`"target":"filterMask"`) while Move and Edit › Transform still act on the smart object)
|
||||
- `typeTransform` is `null` outside a temporary Ctrl/Cmd Type-tool drag. During a drag it reports its source document/revision, original affine, oriented `frame` (layer, local bounds, document-space corners and pivot), and captured `gesture`. Drive it with `ui.pointer` and `command: true` at `down`; `move`/`up` may release the modifier. The document/history remain unchanged during preview, and `up` applies one `type.edit` within `textEdit`'s session. Pressing Escape during the drag cancels only the preview. This pointer state is never restored from saved UI state.
|
||||
- `ui.menu.invoke {id, params?, wait?}` / `ui.menu.list`: activate a menu item by id; list the menu tree. A menu item that starts a background job (a filter without a dialog, such as Blur More) replies with the job's result once it has been applied; with `"wait": false` the reply is `{job, pending: true}` at once. Window ends with the open documents as `window.document.<index>` (tab order, the active one checked, #2991); invoking one brings that document to the front and replies `{document: index}`. Camera Raw and the full-window workspaces (Liquify, Content-Aware Fill, Filter Gallery, Adaptive Wide Angle) are modal: while one is open, `ui.menu.invoke` refuses every other menu item ("menu command is unavailable while a modal dialog is open") and accepts only that workspace's own `{"ui": {...}}` requests (`filter.liquify`, `edit.contentAwareFill`, `filter.filterGallery`, `filter.adaptiveWideAngle`, `filter.cameraRaw`; `params` must hold only the `ui` object), so finish it with `{"ui":{"commit":true}}` or `{"ui":{"cancel":true}}` first. Those requests are refused too while a dialog, an unsaved-changes prompt or a crop that blocks the command is open: resolve that first, then commit or cancel the workspace. `ui.menu.list` reports the same gate: an item the modal state refuses is listed with `enabled: false`. `engine.execute` is not a menu click and is not gated
|
||||
|
||||
Reference in new issue
Block a user