diff --git a/crates/automation/src/server.rs b/crates/automation/src/server.rs index 5c743403551..f1fc5b1146d 100644 --- a/crates/automation/src/server.rs +++ b/crates/automation/src/server.rs @@ -369,13 +369,15 @@ 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", "mode", - /// "color", "smartObject" or "artboard", which lists the artboards that hold the selected - /// layers), kinds (a list of layer kinds), name (matches part of the layer name), mode (a blend - /// mode name), color (a layer colour label, or "none") 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). + /// active layer's storage tiles). layerFilter (an object patching by ("kind", "name", "effect", + /// "mode", "color", "smartObject" or "artboard", which lists the artboards that hold the + /// selected layers), kinds (a list of layer kinds), name (matches part of the layer name), + /// effect ("bevelEmboss", "stroke", "innerShadow", "innerGlow", "satin", "overlay", + /// "outerGlow" or "dropShadow"), mode (a blend mode name), color (a layer colour label, or + /// "none") 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). /// histogramPanel (an object patching view ("compact", "expanded" or "allChannels"), channel /// ("composite", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "a", "b", /// "luminosity" or "colors"), showChannelsInColor, showStatistics and source ("entireImage", diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index dc630df23c1..bfb2bf4f1a7 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -890,7 +890,7 @@ fn ui_set_drives_the_layers_panel_artboard_filter() { assert_eq!(app.ui.layer_filter_by, FilterBy::Artboard); let bad = call(&mut app, &ctx, "ui.set", json!({"layerFilter": {"by": "artboards"}})); assert_eq!(bad["ok"], false, "{bad}"); - assert!(bad.to_string().contains("kind, name, mode, color, smartObject or artboard"), "{bad}"); + assert!(bad.to_string().contains("kind, name, effect, mode, color, smartObject or artboard"), "{bad}"); assert_eq!(app.ui.layer_filter_by, FilterBy::Artboard, "a bad value changed nothing"); } diff --git a/crates/ui-egui/src/panels/layer_filter_ui.rs b/crates/ui-egui/src/panels/layer_filter_ui.rs index e7916010e8f..0634d399189 100644 --- a/crates/ui-egui/src/panels/layer_filter_ui.rs +++ b/crates/ui-egui/src/panels/layer_filter_ui.rs @@ -1,8 +1,9 @@ //! 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, Color one layer colour label (#5898), Smart Object toggles linked, missing -//! and embedded smart objects, Artboard lists only the artboards that hold the selected layers. The -//! criteria live in `UiState` (`layer_filter*`), so the control channel can read and set them. +//! controls for that type. Kind toggles layer kinds, Name matches part of the layer name, Effect +//! picks one effect kind (#10880), Mode picks one blend mode, Color one layer colour label (#5898), +//! Smart Object toggles linked, missing and embedded smart objects, Artboard lists only the +//! artboards that hold the selected layers. The criteria live in `UiState` (`layer_filter*`), so +//! the control channel can read and set them. use std::collections::HashSet; @@ -20,6 +21,7 @@ pub enum FilterBy { #[default] Kind, Name, + Effect, Mode, Color, SmartObject, @@ -34,6 +36,7 @@ pub struct Filter { /// As typed; matched trimmed and ignoring case. pub name: String, pub mode: BlendMode, + pub effect: effect::EffectKind, pub color: LabelColor, /// The Smart Object toggles that are on, from [`SMART`]. pub smart: Vec, @@ -51,6 +54,7 @@ impl Filter { kinds: ui.layer_filter.clone(), name: ui.layer_filter_name.clone(), mode: ui.layer_filter_mode, + effect: ui.layer_filter_effect, color: ui.layer_filter_color, smart: ui.layer_filter_smart.clone(), missing: HashSet::new(), @@ -74,14 +78,15 @@ impl Filter { f } - /// Whether the panel is filtered. Like Photoshop, Mode and Color always filter (by Normal and - /// by no colour at first); Kind, Name and Smart Object only once a toggle is on or some text is - /// typed; Artboard only while some layers are selected and each of them is in an artboard. + /// Whether the panel is filtered. Like Photoshop, Effect, Mode and Color always filter (by + /// Bevel & Emboss, by Normal and by no colour at first); Kind, Name and Smart Object only once a + /// toggle is on or some text is typed; Artboard only while some layers are selected and each of + /// them is in an artboard. pub fn active(&self) -> bool { match self.by { FilterBy::Kind => !self.kinds.is_empty(), FilterBy::Name => !self.name.trim().is_empty(), - FilterBy::Mode | FilterBy::Color => true, + FilterBy::Effect | FilterBy::Mode | FilterBy::Color => true, FilterBy::SmartObject => !self.smart.is_empty(), FilterBy::Artboard => !self.board_rows.is_empty(), } @@ -95,6 +100,7 @@ impl Filter { match self.by { FilterBy::Kind => self.kinds.iter().any(|k| k == kind(l)), FilterBy::Name => l.name.to_lowercase().contains(&self.name.trim().to_lowercase()), + FilterBy::Effect => self.effect.shows(l), FilterBy::Mode => l.blend == self.mode, FilterBy::Color => l.label == self.color, FilterBy::SmartObject => { @@ -151,20 +157,21 @@ pub const KINDS: [&str; 5] = ["pixel", "adjustment", "type", "shape", "smart"]; /// not there, and embedded in the document. pub const SMART: [&str; 3] = ["linked", "missing", "embedded"]; -/// `ui.set {layerFilter: {by?, kinds?, name?, mode?, color?, smart?}}`: `current` with the given -/// fields replaced, or an error naming the bad field (nothing changes then). `by` is `kind`, -/// `name`, `mode`, `color`, `smartObject` or `artboard`; `kinds` a list of [`KINDS`]; `mode` a -/// blend mode name such as `Multiply` or `Pass Through`; `color` a label colour id (`none`, `red`, -/// … `gray`, [`LabelColor::id`]); `smart` a list of [`SMART`]. Artboard has no criteria of its -/// own: the selected layers pick the artboards. +/// `ui.set {layerFilter: {by?, kinds?, name?, effect?, mode?, color?, smart?}}`: `current` with +/// the given fields replaced, or an error naming the bad field (nothing changes then). `by` is +/// `kind`, `name`, `effect`, `mode`, `color`, `smartObject` or `artboard`; `kinds` a list of +/// [`KINDS`]; `effect` an [`effect::EffectKind`] id; `mode` a blend mode name such as `Multiply` +/// or `Pass Through`; `color` a label colour id (`none`, `red`, … `gray`, [`LabelColor::id`]); +/// `smart` a list of [`SMART`]. Artboard has no criteria of its own: the selected layers pick the +/// artboards. 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", "color", "smart"].contains(&k.as_str())) { - return Err(format!("unknown layerFilter field `{k}` (fields: by, kinds, name, mode, color, smart)")); + if let Some(k) = o.keys().find(|k| !["by", "kinds", "name", "effect", "mode", "color", "smart"].contains(&k.as_str())) { + return Err(format!("unknown layerFilter field `{k}` (fields: by, kinds, name, effect, mode, color, smart)")); } 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, mode, color, smartObject or artboard".to_string())?; + f.by = serde_json::from_value(by.clone()).map_err(|_| "layerFilter.by must be kind, name, effect, mode, color, smartObject or artboard".to_string())?; } if let Some(kinds) = o.get("kinds") { let list = kinds.as_array().ok_or("layerFilter.kinds must be a list")?; @@ -187,6 +194,9 @@ pub fn patched(current: &UiState, v: &serde_json::Value) -> Result effect::controls(app, ui), FilterBy::Mode => { let modes: Vec<(BlendMode, &str)> = std::iter::once(BlendMode::PassThrough).chain(BlendMode::LAYER_MODES).map(|m| (m, m.label())).collect(); let width = ui.available_width().max(96.0); @@ -302,5 +315,9 @@ pub fn bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { }); } +pub mod effect; + +#[cfg(test)] +mod effect_tests; #[cfg(test)] mod tests; diff --git a/crates/ui-egui/src/panels/layer_filter_ui/effect.rs b/crates/ui-egui/src/panels/layer_filter_ui/effect.rs new file mode 100644 index 00000000000..1ce24754aef --- /dev/null +++ b/crates/ui-egui/src/panels/layer_filter_ui/effect.rs @@ -0,0 +1,95 @@ +//! The Layers panel's Effect filter (#10880): lists the layers with an enabled effect of one kind. +//! Overlay covers Color, Gradient and Pattern Overlay, as in Photoshop. + +use photocraft_doc::{Effect, Layer}; +use serde::{Deserialize, Serialize}; + +use crate::{PhotocraftApp, widgets}; + +/// The effect kinds the Effect filter picks from, in Photoshop's order. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum EffectKind { + #[default] + BevelEmboss, + Stroke, + InnerShadow, + InnerGlow, + Satin, + Overlay, + OuterGlow, + DropShadow, +} + +impl EffectKind { + pub const ALL: [EffectKind; 8] = [ + EffectKind::BevelEmboss, + EffectKind::Stroke, + EffectKind::InnerShadow, + EffectKind::InnerGlow, + EffectKind::Satin, + EffectKind::Overlay, + EffectKind::OuterGlow, + EffectKind::DropShadow, + ]; + + /// The id `ui.set {layerFilter: {effect}}` takes. + pub fn id(self) -> &'static str { + match self { + EffectKind::BevelEmboss => "bevelEmboss", + EffectKind::Stroke => "stroke", + EffectKind::InnerShadow => "innerShadow", + EffectKind::InnerGlow => "innerGlow", + EffectKind::Satin => "satin", + EffectKind::Overlay => "overlay", + EffectKind::OuterGlow => "outerGlow", + EffectKind::DropShadow => "dropShadow", + } + } + + fn label(self) -> &'static str { + match self { + EffectKind::BevelEmboss => tl!("Bevel & Emboss"), + EffectKind::Stroke => tl!("Stroke"), + EffectKind::InnerShadow => tl!("Inner Shadow"), + EffectKind::InnerGlow => tl!("Inner Glow"), + EffectKind::Satin => tl!("Satin"), + EffectKind::Overlay => tl!("Overlay"), + EffectKind::OuterGlow => tl!("Outer Glow"), + EffectKind::DropShadow => tl!("Drop Shadow"), + } + } + + fn matches(self, e: &Effect) -> bool { + matches!( + (self, e), + (EffectKind::BevelEmboss, Effect::BevelEmboss(_)) + | (EffectKind::Stroke, Effect::Stroke(_)) + | (EffectKind::InnerShadow, Effect::InnerShadow(_)) + | (EffectKind::InnerGlow, Effect::InnerGlow(_)) + | (EffectKind::Satin, Effect::Satin(_)) + | (EffectKind::Overlay, Effect::ColorOverlay { .. } | Effect::GradientOverlay { .. } | Effect::PatternOverlay { .. }) + | (EffectKind::OuterGlow, Effect::OuterGlow(_)) + | (EffectKind::DropShadow, Effect::DropShadow(_)) + ) + } + + /// Whether `l` has an enabled effect of this kind; a turned-off one doesn't count. + pub fn shows(self, l: &Layer) -> bool { + l.effects.items.iter().any(|e| e.enabled() && self.matches(e)) + } +} + +/// `layerFilter.effect`: the kind named by `v`, or an error listing the ids. +pub fn parse(v: &serde_json::Value) -> Result { + let ids = || EffectKind::ALL.map(EffectKind::id).join(", "); + let name = v.as_str().ok_or_else(|| format!("layerFilter.effect must be one of {}", ids()))?; + EffectKind::ALL.into_iter().find(|k| k.id() == name).ok_or_else(|| format!("layerFilter.effect: unknown effect `{name}` (effects: {})", ids())) +} + +/// The Effect filter's controls: the effect kind dropdown. +pub fn controls(app: &mut PhotocraftApp, ui: &mut egui::Ui) { + let kinds: Vec<(EffectKind, &str)> = EffectKind::ALL.into_iter().map(|k| (k, k.label())).collect(); + let width = ui.available_width().max(96.0); + widgets::dropdown(ui, "layer-filter-effect", tl!("Effect"), &mut app.ui.layer_filter_effect, &kinds, width); +} diff --git a/crates/ui-egui/src/panels/layer_filter_ui/effect_tests.rs b/crates/ui-egui/src/panels/layer_filter_ui/effect_tests.rs new file mode 100644 index 00000000000..326de21e4e7 --- /dev/null +++ b/crates/ui-egui/src/panels/layer_filter_ui/effect_tests.rs @@ -0,0 +1,128 @@ +//! #10880: the Layers panel's Effect filter, against the cases measured in Photoshop. + +use egui::vec2; +use egui_kittest::Harness; +use egui_kittest::kittest::Queryable; +use photocraft_doc::Document; +use serde_json::json; + +use super::effect::EffectKind; +use super::{Filter, FilterBy}; +use crate::PhotocraftApp; +use crate::state::UiState; + +/// One pixel layer per effect kind (the three overlays each on their own), "shadow off" whose +/// Drop Shadow is turned off, and "plain" without effects, over the Background. +fn session() -> photocraft_engine::Session { + let mut s = photocraft_engine::Session::new(); + s.execute("file.new", json!({"width": 64, "height": 48})).unwrap(); + for (name, kind, params) in [ + ("plain", "", json!({})), + ("bevel", "bevelEmboss", json!({})), + ("stroke", "stroke", json!({})), + ("inner shadow", "innerShadow", json!({})), + ("inner glow", "innerGlow", json!({})), + ("satin", "satin", json!({})), + ("color", "colorOverlay", json!({"color": "#ff8000"})), + ("gradient", "gradientOverlay", json!({})), + ("pattern", "patternOverlay", json!({})), + ("outer glow", "outerGlow", json!({})), + ("shadow", "dropShadow", json!({})), + ("shadow off", "dropShadow", json!({"enabled": false})), + ] { + s.execute("layer.new.layer", json!({"name": name})).unwrap(); + if !kind.is_empty() { + s.execute("layer.layerStyle.replace", json!({"effects": [{"kind": kind, "params": params}]})).unwrap(); + } + } + s +} + +/// The names `filter` lists, top to bottom. +fn listed(doc: &Document, filter: &Filter) -> Vec { + crate::layer_tree_ui::display_rows(doc, filter.active()).into_iter().filter(|(_, l)| filter.shows(l)).map(|(_, l)| l.name.clone()).collect() +} + +fn by_effect(effect: EffectKind) -> Filter { + Filter::of(&UiState { layer_filter_by: FilterBy::Effect, layer_filter_effect: effect, ..UiState::default() }) +} + +#[test] +fn each_effect_lists_the_layers_with_it_enabled() { + let s = session(); + let doc = &s.active().unwrap().doc; + for (effect, want) in [ + (EffectKind::BevelEmboss, &["bevel"][..]), + (EffectKind::Stroke, &["stroke"]), + (EffectKind::InnerShadow, &["inner shadow"]), + (EffectKind::InnerGlow, &["inner glow"]), + (EffectKind::Satin, &["satin"]), + // Overlay covers Color, Gradient and Pattern Overlay. + (EffectKind::Overlay, &["pattern", "gradient", "color"]), + (EffectKind::OuterGlow, &["outer glow"]), + // A turned-off Drop Shadow doesn't count. + (EffectKind::DropShadow, &["shadow"]), + ] { + assert_eq!(listed(doc, &by_effect(effect)), want, "{effect:?}"); + } +} + +#[test] +fn effect_filters_at_once_with_bevel_and_emboss() { + let f = Filter::of(&UiState { layer_filter_by: FilterBy::Effect, ..UiState::default() }); + assert_eq!(f.effect, EffectKind::BevelEmboss); + assert!(f.active(), "Effect filters as soon as it's picked"); +} + +#[test] +fn ui_set_picks_the_effect_by_id() { + let mut ui = UiState::default(); + for effect in EffectKind::ALL { + let f = super::patched(&ui, &json!({"by": "effect", "effect": effect.id()})).unwrap(); + super::apply(&mut ui, f); + assert_eq!((ui.layer_filter_by, ui.layer_filter_effect), (FilterBy::Effect, effect)); + } + let err = super::patched(&ui, &json!({"effect": "colorOverlay"})).unwrap_err(); + assert!(err.contains("colorOverlay") && err.contains("bevelEmboss") && err.contains("dropShadow"), "{err}"); + assert!(super::patched(&ui, &json!({"effect": 3})).is_err()); + assert!(super::patched(&ui, &json!({"effect": null})).is_err()); +} + +#[test] +fn saved_settings_without_the_effect_still_load() { + let mut saved = serde_json::to_value(UiState { layer_filter_effect: EffectKind::Satin, ..UiState::default() }).unwrap(); + assert_eq!(saved["layer_filter_effect"], "satin"); + saved.as_object_mut().unwrap().remove("layer_filter_effect"); + let ui: UiState = serde_json::from_value(saved).unwrap(); + assert_eq!(ui.layer_filter_effect, EffectKind::BevelEmboss); +} + +/// The names of the rows the Layers panel drew, top to bottom. +fn drawn(h: &Harness<'_, PhotocraftApp>) -> Vec { + let doc = &h.state().session.active().unwrap().doc; + let mut rows = crate::layer_row_ui::recorded(&h.ctx); + rows.sort_by(|a, b| a.row.top().total_cmp(&b.row.top())); + rows.iter().filter_map(|r| doc.walk().into_iter().find(|(_, _, l)| l.id.0 == r.layer).map(|(_, _, l)| l.name.clone())).collect() +} + +#[test] +fn the_panel_filters_by_the_effect_picked_in_the_dropdown() { + let session = session(); + let mut h = Harness::builder().with_size(vec2(1440.0, 1200.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); + h.get_by_value("Kind").click(); + h.run_steps(4); + h.query_all_by_label("Effect").last().expect("Effect in the open list").click(); + h.run_steps(4); + assert_eq!(h.state().ui.layer_filter_by, FilterBy::Effect); + assert_eq!(drawn(&h), ["bevel"], "Bevel & Emboss at first"); + h.get_by_value("Bevel & Emboss").click(); + h.run_steps(4); + h.query_all_by_label("Drop Shadow").last().expect("Drop Shadow in the open list").click(); + h.run_steps(4); + assert_eq!(h.state().ui.layer_filter_effect, EffectKind::DropShadow); + assert_eq!(drawn(&h), ["shadow"]); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 43539ecf898..71cce38f378 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -367,6 +367,9 @@ pub struct UiState { /// Layers panel blend-mode filter. #[serde(default = "default_layer_filter_mode")] pub layer_filter_mode: photocraft_color::BlendMode, + /// Layers panel effect filter (#10880). + #[serde(default)] + pub layer_filter_effect: crate::layer_filter_ui::effect::EffectKind, /// Layers panel colour filter (#5898): the label colour listed (None: layers without one). #[serde(default)] pub layer_filter_color: photocraft_doc::LabelColor, @@ -582,6 +585,7 @@ impl Default for UiState { layer_filter_by: Default::default(), layer_filter_name: String::new(), layer_filter_mode: default_layer_filter_mode(), + layer_filter_effect: Default::default(), layer_filter_color: Default::default(), pen: None, pen_doc: None, diff --git a/docs/control-protocol.md b/docs/control-protocol.md index b569e68189f..4a3c55d6ec9 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?, color?, smart?}`, any subset. `by` is `kind`, `name`, `mode`, `color`, `smartObject` or `artboard` (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`); `color` is a layer colour label id (`none`, `red`, `orange`, `yellow`, `green`, `seafoam`, `blue`, `indigo`, `magenta`, `fuchsia`, `violet`, `gray`; #5898); `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 and Color always filter, by Normal and by no colour at first, as in Photoshop. Artboard has no field of its own: it lists the artboards that hold the selected layers, with everything inside them (closed groups stay closed), and does not filter when nothing is selected or a selected layer is in no artboard. 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?, effect?, mode?, color?, smart?}`, any subset. `by` is `kind`, `name`, `effect`, `mode`, `color`, `smartObject` or `artboard` (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; `effect` (#10880) is `bevelEmboss`, `stroke`, `innerShadow`, `innerGlow`, `satin`, `overlay` (Color, Gradient or Pattern Overlay), `outerGlow` or `dropShadow`, and lists the layers with that effect turned on; `mode` is a blend mode name (`Multiply`, `Pass Through`); `color` is a layer colour label id (`none`, `red`, `orange`, `yellow`, `green`, `seafoam`, `blue`, `indigo`, `magenta`, `fuchsia`, `violet`, `gray`; #5898); `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; Effect, Mode and Color always filter, by Bevel & Emboss, by Normal and by no colour at first, as in Photoshop. Artboard has no field of its own: it lists the artboards that hold the selected layers, with everything inside them (closed groups stay closed), and does not filter when nothing is selected or a selected layer is in no artboard. Fields left out keep their value; a bad one is an error and changes nothing. - `ui.set` also accepts the Histogram panel: `histogramPanel` `{view?, channel?, showChannelsInColor?, showStatistics?, source?}` (any subset, kept with the preferences): `view` is `compact`, `expanded` or `allChannels`; `channel` is `composite`, `red`, `green`, `blue`, `cyan`, `magenta`, `yellow`, `black`, `a`, `b`, `luminosity` or `colors` (one the document's mode lacks shows as its composite); `source` is `entireImage`, `selectedLayer` or `adjustmentComposite` (Entire Image is counted in Compact View, when the document has one layer, or when no adjustment layer is selected for Adjustment Composite). `histogramRange` is `[from, to]` (levels 0..255) or `null`: the dragged tonal range whose Count and Percentile the statistics show. `histogramRefresh: true` is Uncached Refresh: the current state is recounted at cache level 1. `ui.inspect` › `histogram` reports the options, the channel and source as they apply, the channels the document offers, whether the shown histogram is `current` (counted for the document's revision, source and cache level the panel wants now), its `cacheLevel`, `maxCacheLevel` (Preferences › Performance › Cache Levels), `preview` (an adjustment's preview is counted) and `stats` (`mean`, `stdDev`, `median`, `pixels`, `level`, `count`, `percentile`, `clipped` percent at 0 and 255). Histograms are counted while the panel is shown. - 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.