From 289cbc6ce0a339886500941ff76233a8f7561ff0 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 14:49:50 -0700 Subject: [PATCH] Layers panel: the filter row lists linked, missing or embedded smart objects The filter-type dropdown gains Smart Object, with three toggles: smart objects linked to a file, linked to a file that was not there when the app last looked, and embedded. Like the Kind toggles, the filter applies once a toggle is on, and the panel lists the smart objects that match any toggle that is on. The two-second look at linked files now also records which files were not there, and Session::missing_links returns them for the active document. ui.set {layerFilter} takes by: "smartObject" and a smart list. --- crates/automation/src/server.rs | 7 +- crates/engine/src/lib.rs | 3 + crates/engine/src/link_watch.rs | 48 +++++++++ crates/ui-egui/src/control.rs | 25 +++++ crates/ui-egui/src/layer_filter_ui.rs | 95 +++++++++++++++--- crates/ui-egui/src/layer_filter_ui_tests.rs | 102 +++++++++++++++++++- crates/ui-egui/src/panels.rs | 2 +- crates/ui-egui/src/state.rs | 4 + docs/control-protocol.md | 2 +- docs/ui-parity.md | 3 +- 10 files changed, 270 insertions(+), 21 deletions(-) diff --git a/crates/automation/src/server.rs b/crates/automation/src/server.rs index f5ccef00c77..449325d1fc8 100644 --- a/crates/automation/src/server.rs +++ b/crates/automation/src/server.rs @@ -346,9 +346,10 @@ pub struct UiSetParams { /// dashes, dashOffset and opacity; null disables the stroke). Shape stroke fields use /// `shape.edit` names and units; colour comes from `tools.setColors`. camTransformOnDrop (bool, /// the Content-Aware Move tool's Transform On Drop). tileGrid (bool, a developer overlay of the - /// active layer's storage tiles). layerFilter (an object patching by ("kind", "name" or - /// "mode"), kinds (a list of layer kinds), name (matches part of the layer name) and mode (a - /// blend mode name) for the Layers panel filter). strokeTrace (true, false, "stderr" or "off": + /// active layer's storage tiles). layerFilter (an object patching by ("kind", "name", "mode" or + /// "smartObject"), kinds (a list of layer kinds), name (matches part of the layer name), mode + /// (a blend mode name) and smart (a list of "linked", "missing" and "embedded") for the Layers + /// panel filter). strokeTrace (true, false, "stderr" or "off": /// the stroke latency trace at runtime; a CSV file is set at launch with --stroke-trace, not /// over this channel). updatesOpen (bool, the Help › Check for Updates window). Other fields /// are an error. diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 44cbe903ad4..3e79faa0a74 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -537,6 +537,9 @@ pub struct Session { pub link_stamps: std::collections::HashMap<(u64, String), link_watch::Stamp>, /// The stamps being taken on a worker thread ([`Session::start_link_scan`]). pub link_scan: Option, + /// Each open document's linked smart objects' files that were not there when last looked at + /// ([`Session::missing_links`]). + link_missing: std::collections::HashSet<(u64, String)>, /// Select Subject's last result, reused while the pixels are unchanged (#2865). subject_cache: smartselect_cmds::SubjectCache, /// Object Selection's Object Finder results (#4087), shared by the hover preview and the diff --git a/crates/engine/src/link_watch.rs b/crates/engine/src/link_watch.rs index 453af7806b1..acbcfed4721 100644 --- a/crates/engine/src/link_watch.rs +++ b/crates/engine/src/link_watch.rs @@ -108,6 +108,30 @@ impl Session { } } + /// The active document's linked files that were not there at the last look (the Layers + /// panel's Missing filter). A path that is not followed ([`crate::doc_path`]) is never looked + /// at, so it is not listed. + pub fn missing_links(&self) -> HashSet { + let Some(doc) = self.active().map(|d| d.doc.id.0) else { return HashSet::new() }; + self.link_missing.iter().filter(|(d, _)| *d == doc).map(|(_, p)| p.clone()).collect() + } + + /// Remember which of document `doc`'s files in `now` were not there, and forget the files of + /// closed documents. The web app has no files to look at, so it lists none. + fn note_missing_links(&mut self, doc: u64, now: &[(String, Vec, Option)]) { + let open: HashSet = self.documents().iter().map(|d| d.doc.id.0).collect(); + self.link_missing.retain(|(d, _)| *d != doc && open.contains(d)); + if cfg!(target_arch = "wasm32") { + return; + } + let document = self.active().and_then(|st| st.path.clone()); + for (path, _, stamp) in now { + if stamp.is_none() && crate::doc_path::resolve_in(path, document.as_deref().map(std::path::Path::new)).is_ok() { + self.link_missing.insert((doc, path.clone())); + } + } + } + /// Apply a finished look (`None` while there is none, or it is still running). pub fn poll_link_scan(&mut self) -> Option> { let (doc, stamps) = self.link_scan.as_ref()?.lock().unwrap_or_else(PoisonError::into_inner).take()?; @@ -122,6 +146,7 @@ impl Session { if self.active().map(|d| d.doc.id.0) != Some(doc) { return Ok(json!({"updated": []})); } + self.note_missing_links(doc, &now); // A background job holds the document: refreshing now would replace the snapshot it works // on and its result would be discarded. The stamps stay as they were, so the change is // seen again by the first look after the job ends. @@ -282,6 +307,29 @@ mod tests { assert!(is(centre(&s), BLUE)); } + #[test] + fn a_look_lists_the_linked_files_that_are_not_there() { + let d = dir("missing"); + let path = d.join("art.png"); + std::fs::write(&path, png(10, 10, "#ff0000")).unwrap(); + let (mut s, _) = placed(&path); + let stored = super::linked_files(&s.active().unwrap().doc)[0].0.clone(); + assert!(s.missing_links().is_empty(), "nothing looked at yet"); + s.execute("layer.smartObjects.updateChanged", json!({})).unwrap(); + assert!(s.missing_links().is_empty()); + std::fs::remove_file(&path).unwrap(); + s.execute("layer.smartObjects.updateChanged", json!({})).unwrap(); + assert_eq!(s.missing_links(), [stored.clone()].into()); + // Only the document's own files: another one in front lists none. + s.execute("file.new", json!({"width": 10, "height": 10})).unwrap(); + assert!(s.missing_links().is_empty()); + s.set_active(0); + assert_eq!(s.missing_links(), [stored].into()); + std::fs::write(&path, png(10, 10, "#0000ff")).unwrap(); + s.execute("layer.smartObjects.updateChanged", json!({})).unwrap(); + assert!(s.missing_links().is_empty(), "the file is back"); + } + #[test] fn a_background_look_updates_changed_files() { let d = dir("scan"); diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index b85427c6fa1..4ebf90ea399 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -2041,6 +2041,31 @@ mod tests { assert!(app.ui.tool_options.gradient_classic, "invalid mode must not change options"); } + /// The Layers panel's Smart Object filter takes a list of its toggles. + #[test] + fn ui_set_drives_the_layers_panel_smart_object_filter() { + use crate::layer_filter_ui::FilterBy; + let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); + let ctx = egui::Context::default(); + let ok = call(&mut app, &ctx, "ui.set", json!({"layerFilter": {"by": "smartObject", "smart": ["missing", "embedded", "missing"]}})); + assert_eq!(ok["ok"], true, "{ok}"); + assert_eq!(app.ui.layer_filter_by, FilterBy::SmartObject); + assert_eq!(app.ui.layer_filter_smart, ["missing", "embedded"], "toggles are kept once each"); + let ok = call(&mut app, &ctx, "ui.set", json!({"layerFilter": {"smart": []}})); + assert_eq!(ok["ok"], true, "{ok}"); + assert!(app.ui.layer_filter_smart.is_empty()); + for bad in [ + json!({"layerFilter": {"smart": ["library"]}}), + json!({"layerFilter": {"smart": "linked"}}), + json!({"layerFilter": {"by": "kind", "smart": [1]}}), + json!({"layerFilter": {"by": "smart"}}), + ] { + let r = call(&mut app, &ctx, "ui.set", bad.clone()); + assert_eq!(r["ok"], false, "{bad} → {r}"); + assert_eq!((app.ui.layer_filter_by, app.ui.layer_filter_smart.len()), (FilterBy::SmartObject, 0), "{bad} changed nothing"); + } + } + /// #5048: the Layers panel filter is drivable; a bad field changes nothing. #[test] fn ui_set_drives_the_layers_panel_filter() { diff --git a/crates/ui-egui/src/layer_filter_ui.rs b/crates/ui-egui/src/layer_filter_ui.rs index e933d0c1655..0c727aa0a83 100644 --- a/crates/ui-egui/src/layer_filter_ui.rs +++ b/crates/ui-egui/src/layer_filter_ui.rs @@ -1,10 +1,12 @@ //! The Layers panel's filter row (#5048): a filter-type dropdown, as in Photoshop, then the //! controls for that type. Kind toggles layer kinds, Name matches part of the layer name, Mode -//! picks one blend mode. The criteria live in `UiState` (`layer_filter*`), so the control channel -//! can read and set them. +//! picks one blend mode, Smart Object toggles linked, missing and embedded smart objects. The +//! criteria live in `UiState` (`layer_filter*`), so the control channel can read and set them. + +use std::collections::HashSet; use photocraft_color::BlendMode; -use photocraft_doc::{Layer, LayerContent}; +use photocraft_doc::{Layer, LayerContent, SmartSource}; use serde::{Deserialize, Serialize}; use crate::state::UiState; @@ -18,6 +20,7 @@ pub enum FilterBy { Kind, Name, Mode, + SmartObject, } /// The filter criteria, copied out of `UiState` for one frame of the Layers panel. @@ -28,20 +31,43 @@ pub struct Filter { /// As typed; matched trimmed and ignoring case. pub name: String, pub mode: BlendMode, + /// The Smart Object toggles that are on, from [`SMART`]. + pub smart: Vec, + /// The linked files the Smart Object filter's Missing toggle lists + /// ([`photocraft_engine::Session::missing_links`]). + pub missing: HashSet, } impl Filter { pub fn of(ui: &UiState) -> Self { - Self { by: ui.layer_filter_by, kinds: ui.layer_filter.clone(), name: ui.layer_filter_name.clone(), mode: ui.layer_filter_mode } + Self { + by: ui.layer_filter_by, + kinds: ui.layer_filter.clone(), + name: ui.layer_filter_name.clone(), + mode: ui.layer_filter_mode, + smart: ui.layer_filter_smart.clone(), + missing: HashSet::new(), + } + } + + /// [`Filter::of`] `app`'s settings, with the active document's missing linked files while + /// the panel filters by Smart Object. + pub fn of_app(app: &PhotocraftApp) -> Self { + let mut f = Self::of(&app.ui); + if f.by == FilterBy::SmartObject { + f.missing = app.session.missing_links(); + } + f } /// Whether the panel is filtered. Like Photoshop, Mode always filters (by Normal at first); - /// Kind and Name only once a kind is toggled or some text is typed. + /// Kind, Name and Smart Object only once a toggle is on or some text is typed. pub fn active(&self) -> bool { match self.by { FilterBy::Kind => !self.kinds.is_empty(), FilterBy::Name => !self.name.trim().is_empty(), FilterBy::Mode => true, + FilterBy::SmartObject => !self.smart.is_empty(), } } @@ -54,6 +80,14 @@ impl Filter { FilterBy::Kind => self.kinds.iter().any(|k| k == kind(l)), FilterBy::Name => l.name.to_lowercase().contains(&self.name.trim().to_lowercase()), FilterBy::Mode => l.blend == self.mode, + FilterBy::SmartObject => { + let LayerContent::Smart(sm) = &l.content else { return false }; + self.smart.iter().any(|k| match (k.as_str(), &sm.source) { + ("linked", SmartSource::Linked { .. }) | ("embedded", SmartSource::Embedded { .. }) => true, + ("missing", SmartSource::Linked { path }) => self.missing.contains(path), + _ => false, + }) + } } } } @@ -61,18 +95,22 @@ impl Filter { /// The kinds the Kind filter toggles. pub const KINDS: [&str; 5] = ["pixel", "adjustment", "type", "shape", "smart"]; -/// `ui.set {layerFilter: {by?, kinds?, name?, mode?}}`: `current` with the given fields replaced, -/// or an error naming the bad field (nothing changes then). `by` is `kind`, `name` or `mode`; -/// `kinds` a list of [`KINDS`]; `mode` a blend mode name such as `Multiply` or `Pass Through`. +/// The Smart Object filter's toggles: smart objects linked to a file, linked to a file that is +/// not there, and embedded in the document. +pub const SMART: [&str; 3] = ["linked", "missing", "embedded"]; + +/// `ui.set {layerFilter: {by?, kinds?, name?, mode?, smart?}}`: `current` with the given fields +/// replaced, or an error naming the bad field (nothing changes then). `by` is `kind`, `name`, +/// `mode` or `smartObject`; `kinds` a list of [`KINDS`]; `mode` a blend mode name such as +/// `Multiply` or `Pass Through`; `smart` a list of [`SMART`]. pub fn patched(current: &UiState, v: &serde_json::Value) -> Result { let Some(o) = v.as_object() else { return Err("layerFilter must be an object".into()) }; - if let Some(k) = o.keys().find(|k| !["by", "kinds", "name", "mode"].contains(&k.as_str())) { - return Err(format!("unknown layerFilter field `{k}` (fields: by, kinds, name, mode)")); + if let Some(k) = o.keys().find(|k| !["by", "kinds", "name", "mode", "smart"].contains(&k.as_str())) { + return Err(format!("unknown layerFilter field `{k}` (fields: by, kinds, name, mode, smart)")); } - let mut f = - Filter { by: current.layer_filter_by, kinds: current.layer_filter.clone(), name: current.layer_filter_name.clone(), mode: current.layer_filter_mode }; + let mut f = Filter::of(current); if let Some(by) = o.get("by") { - f.by = serde_json::from_value(by.clone()).map_err(|_| "layerFilter.by must be kind, name or mode".to_string())?; + f.by = serde_json::from_value(by.clone()).map_err(|_| "layerFilter.by must be kind, name, mode or smartObject".to_string())?; } if let Some(kinds) = o.get("kinds") { let list = kinds.as_array().ok_or("layerFilter.kinds must be a list")?; @@ -95,6 +133,18 @@ pub fn patched(current: &UiState, v: &serde_json::Value) -> Result &'static str { pub fn bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { ui.horizontal(|ui| { ui.spacing_mut().item_spacing.x = 2.0; - let by = [(FilterBy::Kind, tl!("Kind")), (FilterBy::Name, tl!("Name")), (FilterBy::Mode, tl!("Mode"))]; + let by = [(FilterBy::Kind, tl!("Kind")), (FilterBy::Name, tl!("Name")), (FilterBy::Mode, tl!("Mode")), (FilterBy::SmartObject, tl!("Smart Object"))]; widgets::dropdown(ui, "layer-filter-by", &mut app.ui.layer_filter_by, &by, 64.0); ui.add_space(4.0); match app.ui.layer_filter_by { @@ -153,6 +204,22 @@ pub fn bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let width = ui.available_width().max(96.0); widgets::dropdown(ui, "layer-filter-mode", &mut app.ui.layer_filter_mode, &modes, width); } + FilterBy::SmartObject => { + for (kind, icon, tip) in [ + ("linked", "link", tl!("Filter for smart objects linked locally")), + ("missing", "unlink", tl!("Filter for linked smart objects that are missing")), + ("embedded", "file", tl!("Filter for embedded smart objects")), + ] { + let on = app.ui.layer_filter_smart.iter().any(|k| k == kind); + if icons::button(ui, icon, 22.0, on, tip).clicked() { + if on { + app.ui.layer_filter_smart.retain(|k| k != kind); + } else { + app.ui.layer_filter_smart.push(kind.to_string()); + } + } + } + } } }); } diff --git a/crates/ui-egui/src/layer_filter_ui_tests.rs b/crates/ui-egui/src/layer_filter_ui_tests.rs index aeeb63e7cc0..5f30052010d 100644 --- a/crates/ui-egui/src/layer_filter_ui_tests.rs +++ b/crates/ui-egui/src/layer_filter_ui_tests.rs @@ -1,4 +1,4 @@ -//! #5048: the Layers panel's filter-type dropdown (Kind, Name, Mode). +//! #5048: the Layers panel's filter-type dropdown (Kind, Name, Mode, Smart Object). use egui::vec2; use egui_kittest::Harness; @@ -135,3 +135,103 @@ fn the_dropdown_switches_the_panel_between_filter_types() { h.run_steps(4); assert_eq!(drawn(&h), ["ink notes"]); } + +/// A PNG at `//art.png` (a folder per test: tests run in parallel). +fn art_file(name: &str) -> std::path::PathBuf { + let d = std::env::temp_dir().join(format!("photocraft-layer-filter-{name}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&d); + std::fs::create_dir_all(&d).unwrap(); + let file = d.join("art.png"); + let mut s = photocraft_engine::Session::new(); + s.execute("file.new", json!({"width": 8, "height": 8, "background": "#ff0000"})).unwrap(); + s.execute("file.saveACopy", json!({"path": file.to_string_lossy(), "layers": false})).unwrap(); + file +} + +/// "Linked art" (linked to `file`) above "Embedded art" (a copy of `file`), "Plain" and +/// "Background". +fn smart_session(file: &std::path::Path) -> photocraft_engine::Session { + let mut s = photocraft_engine::Session::new(); + s.execute("file.new", json!({"width": 32, "height": 32})).unwrap(); + s.execute("layer.new.layer", json!({"name": "Plain"})).unwrap(); + for (command, name) in [("file.placeEmbedded", "Embedded art"), ("file.placeLinked", "Linked art")] { + s.execute(command, json!({"path": file.to_string_lossy()})).unwrap(); + let id = s.active().unwrap().active_layer.unwrap().0; + s.execute("layer.setProps", json!({"layer": id, "name": name})).unwrap(); + } + s +} + +fn by_smart(smart: &[&str], missing: std::collections::HashSet) -> Filter { + Filter { smart: smart.iter().map(|k| k.to_string()).collect(), missing, ..filter(FilterBy::SmartObject, &[], "", BlendMode::Normal) } +} + +#[test] +fn the_smart_object_filter_lists_linked_missing_and_embedded_smart_objects() { + let file = art_file("list"); + let mut s = smart_session(&file); + let doc = &s.active().unwrap().doc; + let none = std::collections::HashSet::new; + assert!(!by_smart(&[], none()).active(), "no toggle on: every layer"); + assert_eq!(listed(doc, &by_smart(&[], none())), ["Linked art", "Embedded art", "Plain", "Background"]); + assert_eq!(listed(doc, &by_smart(&["linked"], none())), ["Linked art"]); + assert_eq!(listed(doc, &by_smart(&["embedded"], none())), ["Embedded art"]); + assert_eq!(listed(doc, &by_smart(&["linked", "embedded"], none())), ["Linked art", "Embedded art"]); + assert_eq!(listed(doc, &by_smart(&["missing"], s.missing_links())), Vec::::new(), "the file is there"); + std::fs::remove_file(&file).unwrap(); + s.execute("layer.smartObjects.updateChanged", json!({})).unwrap(); + let doc = &s.active().unwrap().doc; + assert_eq!(listed(doc, &by_smart(&["missing"], s.missing_links())), ["Linked art"]); + assert_eq!(listed(doc, &by_smart(&["missing", "embedded"], s.missing_links())), ["Linked art", "Embedded art"]); +} + +#[test] +fn saved_settings_without_the_smart_object_toggles_still_load() { + let mut saved = serde_json::to_value(UiState::default()).unwrap(); + assert!(saved.as_object_mut().unwrap().remove("layer_filter_smart").is_some(), "layer_filter_smart is saved"); + let ui: UiState = serde_json::from_value(saved).unwrap(); + assert!(ui.layer_filter_smart.is_empty()); + let round = + serde_json::to_value(UiState { layer_filter_by: FilterBy::SmartObject, layer_filter_smart: vec!["missing".into()], ..UiState::default() }).unwrap(); + let back: UiState = serde_json::from_value(round.clone()).unwrap(); + assert_eq!( + (round["layer_filter_by"].as_str(), back.layer_filter_by, back.layer_filter_smart), + (Some("smartObject"), FilterBy::SmartObject, vec!["missing".to_string()]) + ); +} + +#[test] +fn the_smart_object_toggles_filter_the_panel() { + let file = art_file("panel"); + let session = smart_session(&file); + let mut h = Harness::builder().with_size(vec2(1440.0, 900.0)).with_max_steps(64).build_eframe(move |cc| { + PhotocraftApp::setup_context(&cc.egui_ctx, Default::default()); + PhotocraftApp::new(session, crate::Services::default()) + }); + h.run_steps(8); + let all = ["Linked art", "Embedded art", "Plain", "Background"]; + assert_eq!(drawn(&h), all); + h.get_by_value("Kind").click(); + h.run_steps(4); + h.query_all_by_label("Smart Object").last().expect("Smart Object in the open list").click(); + h.run_steps(4); + assert_eq!(h.state().ui.layer_filter_by, FilterBy::SmartObject); + assert_eq!(drawn(&h), all, "no toggle on yet: every layer"); + h.get_by_label("Filter for embedded smart objects").click(); + h.run_steps(4); + assert_eq!(h.state().ui.layer_filter_smart, ["embedded"]); + assert_eq!(drawn(&h), ["Embedded art"]); + h.get_by_label("Filter for embedded smart objects").click(); + h.get_by_label("Filter for smart objects linked locally").click(); + h.run_steps(4); + assert_eq!(drawn(&h), ["Linked art"]); + h.get_by_label("Filter for smart objects linked locally").click(); + h.get_by_label("Filter for linked smart objects that are missing").click(); + h.run_steps(4); + assert_eq!(h.state().ui.layer_filter_smart, ["missing"]); + assert_eq!(drawn(&h), Vec::::new(), "the file is there"); + std::fs::remove_file(&file).unwrap(); + h.state_mut().session.execute("layer.smartObjects.updateChanged", json!({})).unwrap(); + h.run_steps(4); + assert_eq!(drawn(&h), ["Linked art"]); +} diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index b6bd34d9d2a..f8dc2b563b7 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -2714,7 +2714,7 @@ fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) { ui.scroll_with_delta(vec2(0.0, delta)); ctx.request_repaint(); } - let filter = crate::layer_filter_ui::Filter::of(&app.ui); + let filter = crate::layer_filter_ui::Filter::of_app(app); let fx_collapsed = app.session.active().map(|d| d.fx_collapsed.clone()).unwrap_or_default(); crate::layer_row_ui::begin(ui.ctx()); // The drawn rows, top to bottom (#1721): the space between them and below the last diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index b3b9d7b05e1..4917103ac16 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -1477,6 +1477,9 @@ pub struct UiState { /// Layers panel kind filter ("pixel", "adjustment", "type", "shape", "smart"); empty = all. #[serde(default)] pub layer_filter: Vec, + /// Layers panel Smart Object filter ("linked", "missing", "embedded"); empty = all. + #[serde(default)] + pub layer_filter_smart: Vec, /// Thumbnail dimensions, content cropping and filter-strip visibility. #[serde(default)] pub layers_panel_options: LayersPanelOptions, @@ -1666,6 +1669,7 @@ impl Default for UiState { artboard_tool: Default::default(), shell: Default::default(), layer_filter: Vec::new(), + layer_filter_smart: Vec::new(), layers_panel_options: LayersPanelOptions::default(), layers_panel_dialog: None, layer_filter_by: Default::default(), diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 3d4d601b308..d01354e803c 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -54,7 +54,7 @@ The transport is `apps/photocraft/src/control_server.rs`, and the handlers are i - `ui.set` also accepts `camTransformOnDrop` (boolean), the Content-Aware Move tool's Transform On Drop checkbox: a drop then puts a scale/rotate box on the patch (`ui.inspect` › `camTransform`: its document/revision, drag `offset` and `frame`), driven with `ui.pointer` (handles as Free Transform's; outside the box rotates), committed with `ui.key Enter` (one `paint.contentAwareMove` with `scaleX`, `scaleY`, `rotate`) or dropped with `Escape`. - `ui.set` also accepts `tileGrid` (boolean), a developer overlay of the active layer's storage tiles: the tile grid over the document, every stored tile filled and labelled `tx,ty`, tiles with identical pixels in a shared colour and unique ones in blue. It has no menu item and View › Extras doesn't hide it. `ui.inspect` reports it as `view.tile_grid`. - `ui.set` also accepts `strokeTrace` (`true`, `false`, `"stderr"` or `"off"`): turn the stroke latency trace on or off at runtime; each stroke's summary is in `ui.inspect` `perf.strokeTrace`. A CSV file of every frame is set only at launch (`PHOTOCRAFT_STROKE_TRACE=` / `--stroke-trace `): the control channel doesn't write files outside the automation write root -- `ui.set` also accepts `layerFilter` (#5048), the Layers panel filter row: `{by?, kinds?, name?, mode?}`, any subset. `by` is `kind`, `name` or `mode` (the filter-type dropdown); `kinds` lists the Kind toggles that are on (`pixel`, `adjustment`, `type`, `shape`, `smart`); `name` matches part of a layer name, ignoring case; `mode` is a blend mode name (`Multiply`, `Pass Through`). Kind and Name filter only once a kind is on or text is typed; Mode always filters, by Normal at first, as in Photoshop. Fields left out keep their value; a bad one is an error and changes nothing. +- `ui.set` also accepts `layerFilter` (#5048), the Layers panel filter row: `{by?, kinds?, name?, mode?, smart?}`, any subset. `by` is `kind`, `name`, `mode` or `smartObject` (the filter-type dropdown); `kinds` lists the Kind toggles that are on (`pixel`, `adjustment`, `type`, `shape`, `smart`); `name` matches part of a layer name, ignoring case; `mode` is a blend mode name (`Multiply`, `Pass Through`); `smart` lists the Smart Object toggles that are on (`linked`: linked to a file, `missing`: linked to a file that was not there when the app last looked, `embedded`). Kind, Name and Smart Object filter only once a toggle is on or text is typed; Mode always filters, by Normal at first, as in Photoshop. Fields left out keep their value; a bad one is an error and changes nothing. - Each painting tool keeps its own brush, as in Photoshop: `tools.setBrush` and `ui.set {brushSize}` change the active tool's brush, and switching tools swaps in that tool's own (size, hardness, mode, opacity, flow, dynamics, smoothing). A tool used for the first time starts from the brush in hand. The colours, the erase flag and the stroke seed stay shared. So `ui.set {tool: "eraser", brushSize: 12}` sets the Eraser's size, and `ui.set {tool: "brush"}` afterwards brings the Brush's own size back. - Brush Pose's `pose.overrideTiltX` and `pose.overrideTiltY` are independent booleans. For example, `engine.execute {"command":"tools.setBrush","params":{"pose":{"enabled":true,"tiltX":45,"overrideTiltX":true,"overrideTiltY":false}}}` fixes X at 45° while Y follows the stylus. Pose tilts are degrees (±90); the Brush Settings panel displays percentages (±100). Old stored `overrideTilt` values migrate to both axes. In command patches, `overrideTilt` sets both axes unless an explicit axis field in the same patch overrides it. `brush.get` includes both axis flags and the legacy combined readback (`overrideTilt` is true only when both flags are true). Axis-only journals omit that derived combined key so replay retains the other axis. Present flag values must be booleans; null and other types return an error. - `ui.set` also accepts the Eyedropper options bar (#1649): `eyedropperSampleSize` (`"point"` or 1, 3, 5, 11, 31, 51, 101: the side of the averaged square, shared by the Eyedropper, a painting tool's Alt-click eyedropper, the Curves/Color Picker eyedroppers and the Info panel), `eyedropperSample` (`current`, `currentAndBelow`, `all`, `allNoAdjustments`, `currentAndBelowNoAdjustments`) and `eyedropperRing` (boolean, Show Sampling Ring). `ui.inspect` reports them under `toolOptions` (`eyedropper_size`, `eyedropper_sample`, `eyedropper_ring`). The engine command `document.sampleColor {x, y, size, sampleLayer}` returns the colour such a sample picks, as four floats 0..1 (not 0..255). diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 8a189ad491c..ff0b3e2111d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -234,7 +234,7 @@ Paragraph; the rest open as in-app floating windows. | Themes: Photoshop's four greys | partial | five themes; #2661 | | Document tabs: overflow, context menu, reorder | done | UI-217-6; middle-click close #2570 | | Layers panel: wheel steps blend modes, drop on New/Trash | partial | UI-217-14 | -| Layers panel filter-type dropdown (Kind, Name, Effect, Mode, Attribute, Color, Smart Object, Selected, Artboard) | partial | Kind, Name and Mode; the other six missing. `layer_filter_ui.rs`, `ui.set {layerFilter}` (#5048) | +| Layers panel filter-type dropdown (Kind, Name, Effect, Mode, Attribute, Color, Smart Object, Selected, Artboard) | partial | Kind, Name, Mode and Smart Object (linked, missing and embedded; no library links or out-of-date state); the other five missing. `layer_filter_ui.rs`, `ui.set {layerFilter}` (#5048) | | Adjustment scope: clipping control visible above tall Properties editors in a compact dock | done (2026-10-21) | `panels.rs`, `clipping_indicator_tests.rs`; #5231; stack-wide default retained | | Smart filter rows: click selects, drag onto another smart object moves, ⌥-drag copies, drag onto Delete removes; with a row selected, the Delete button and the ⌫/Delete key remove that filter, not the smart object | done | `smart_ui.rs`, `layer.smartFilter.transfer` (#4271), `smart_ui::keys` (#4751) | | Layers panel: Clip Thumbnails to Layer Bounds (panel menu, `interface.clipThumbnailsToLayerBounds`) | done (2026-10-12) | `layer_thumb_bounds_tests.rs`; #4281. Thumbnail size and the Panel Options dialog to come | @@ -299,4 +299,5 @@ Paragraph; the rest open as in-app floating windows. | 2026-10-14 | minor | Rounded corners on live triangles, polygons and stars: Properties field and on-canvas widgets (TOOL-214-12) | | 2026-10-14 | minor | A colour picked in the Color or Swatches panel or the Color Picker recolours the selected type layers (Type tool) or shape fills (shape, Pen and path selection tools) | | 2026-10-15 | minor | Color panel: Photoshop's panel-menu modes, colour ramp and copy commands; the theme no longer picks the panel's layout (UI-217-17 done, #2569, #6000) | +| 2026-10-24 | minor | Layers panel filter row: Smart Object lists linked, missing or embedded smart objects, drivable by `ui.set {layerFilter: {by: "smartObject", smart}}`; no percentage changed | | 2026-10-23 | minor | ⌥ + an adjustment's shortcut (⌥⌘L Levels, ⌥⌘M Curves) opens its dialog at the settings of its last OK, as in Photoshop (#8900); no percentage changed |