A drawing app built for agent/human collaboration
Rust
Pick what you see; shapes take the colour; alt click shows one layer
Indicode BVb413bfef60e1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 81d6cc7..12bf2ce 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -19,6 +19,9 @@ The first builds, and klad's licences.- Messages say what happened and what to do next; when klad itself goes wrong it says so, and that your work is saved.- Bones: a layer or group gets a skeleton (`klad bone`, the bone tool J), weights from the bones or painted (`klad weights`), and poses that bend the drawing (`klad pose`, pose mode); in-betweens of two poses turn the bones. The bone tool lists the skeleton, picks a bone in every mode, and moves ends, joints and whole bones with their children (`klad bone --move` with `--by`).- A first start: the start window welcomes, offers first steps (draw a shape, fill it, hand the drawing to an agent, ticked off as you go; Help > First steps opens them again) and six sample drawings that open as copies (`klad samples` lists and copies them).+- Picking strokes takes what you see: the topmost layer that shows paint under the pen and the mark covering the point, on all layers or this layer only (the S and V options).+- A selected shape takes the colour as its fill or its outline (the shape's bar, Edit > Shape).+- Alt click on a layer's eye shows only that layer, and again the rest as it was (`klad solo`).- Menus: a menu bar (the Mac's own, an in-window one on Windows and Linux) holds every command in File, Edit, Tools, Layer, Frame, Animation, View, Window and Help, with short labels, its keys, ticks for what is on and greyed items for what cannot run now; File has close (cmd W) and recent drawings.- Keys: layers, groups and shapes move, turn, scale and fade between frames with eases (`klad key`, the keys section of layer settings).- Godot: `--godot-rig` exports a Skeleton2D with Polygon2D parts and the poses as animations; `--godot-scene` a parallax scene with a Parallax2D per depth plane.diff --git a/crates/app/src/commands.rs b/crates/app/src/commands.rsindex c23cad5..aa3096d 100644--- a/crates/app/src/commands.rs+++ b/crates/app/src/commands.rs@@ -163,6 +163,10 @@ pub enum Cmd {CloseDocument,Quit,FirstSteps,+ PickAllLayers,+ FillShape,+ OutlineShape,+ SoloLayer,}#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -486,7 +490,7 @@ use Repeat as R;use Trigger as T;impl Cmd {- pub const ALL: [Cmd; 159] = [+ pub const ALL: [Cmd; 163] = [Cmd::Brush,Cmd::Eraser,Cmd::Fill,@@ -631,6 +635,10 @@ impl Cmd {Cmd::CloseDocument,Cmd::Quit,Cmd::FirstSteps,+ Cmd::PickAllLayers,+ Cmd::FillShape,+ Cmd::OutlineShape,+ Cmd::SoloLayer,Cmd::OpenDocument,Cmd::OpenRecent,Cmd::CopyPath,@@ -1901,6 +1909,42 @@ impl Cmd {R::No,"name, loop, own fps, first and last frame, delete, export to Godot",),+ Cmd::PickAllLayers => spec(+ "edit.pick-all",+ "pick from all layers",+ icon::LAYERS,+ G::Edit,+ T::None,+ R::No,+ "a click with S or V picks what you see on any layer; off, it picks on the active layer only",+ ),+ Cmd::FillShape => spec(+ "shape.fill",+ "fill the shape with the colour",+ icon::FILL,+ G::Edit,+ T::None,+ R::No,+ "the selected shape's fill becomes the current colour",+ ),+ Cmd::OutlineShape => spec(+ "shape.outline",+ "outline the shape in the colour",+ icon::PEN,+ G::Edit,+ T::None,+ R::No,+ "the selected shape's outline becomes the current colour (an outline is added at the pen's width when it has none)",+ ),+ Cmd::SoloLayer => spec(+ "layer.solo",+ "show only this layer",+ icon::EYE,+ G::Layers,+ T::None,+ R::No,+ "hide every other layer (alt click an eye does the same); again shows them as they were",+ ),Cmd::FirstSteps => spec("help.first-steps","first steps",@@ -2238,6 +2282,10 @@ impl Cmd {Cmd::CloseDocument => "Close",Cmd::Quit => "Quit klad",Cmd::FirstSteps => "First steps",+ Cmd::PickAllLayers => "Pick from all layers",+ Cmd::FillShape => "Fill with colour",+ Cmd::OutlineShape => "Outline with colour",+ Cmd::SoloLayer => "Show only this",Cmd::Parallax | Cmd::Eyedropper | Cmd::Pan | Cmd::Zoom | Cmd::FlipFrames | Cmd::Roll | Cmd::SizeDrag => {self.spec().name}@@ -2304,6 +2352,7 @@ pub const MENUS: [Menu; 9] = [Run(Cmd::SelectAll),Run(Cmd::Deselect),Run(Cmd::CutLasso),+ Run(Cmd::PickAllLayers),Line,Sub("Transform",@@ -2320,6 +2369,7 @@ pub const MENUS: [Menu; 9] = [],),Sub("Strokes", &[Run(Cmd::Recolour), Run(Cmd::Thinner), Run(Cmd::Thicker)]),+ Sub("Shape", &[Run(Cmd::FillShape), Run(Cmd::OutlineShape)]),Sub("Points",&[@@ -2371,6 +2421,7 @@ pub const MENUS: [Menu; 9] = [Run(Cmd::DeleteLayer),Line,Run(Cmd::ToggleVisible),+ Run(Cmd::SoloLayer),Run(Cmd::ToggleLocked),Run(Cmd::ToggleClip),Run(Cmd::ToggleLockAlpha),diff --git a/crates/app/src/composite.rs b/crates/app/src/composite.rsindex 75fcc00..8496a86 100644--- a/crates/app/src/composite.rs+++ b/crates/app/src/composite.rs@@ -1179,27 +1179,87 @@ impl Scene {Some((&self.cels.get(&cel)?.replay, self.rasters.get(&cel)?))}- pub fn marks_at(&self, at: (f32, f32), slack: f32) -> Option<(Vec<usize>, u32)> {+ fn seen_at(&self, path: &[usize], at: (f32, f32)) -> Option<f32> {+ let doc = &self.bundle.doc;+ let alpha_of = |layer: &Layer| -> Option<f32> {+ let cel = layer.content_at(self.frame)?;+ self.rasters.get(&cel.id).map(|r| r.alpha_at(at.0, at.1))+ };+ let layer = doc.locate_path(path)?;+ let own = alpha_of(layer)?;+ let opacity: f32 = (1..=path.len())+ .map(|n| doc.locate_path(&path[..n]).map_or(1.0, |l| l.opacity))+ .product();+ let unmasked = layer+ .mask+ .as_deref()+ .filter(|m| m.visible)+ .and_then(alpha_of)+ .map_or(1.0, |m| 1.0 - m);+ let based = match (layer.clip, path.split_last()) {+ (true, Some((&i, parent))) => {+ let list = match parent.is_empty() {+ true => &doc.layers[..],+ false => doc.locate_path(parent).map_or(&[][..], |p| p.children()),+ };+ list[..i]+ .iter()+ .rev()+ .find(|l| !l.clip)+ .map_or(Some(1.0), alpha_of)+ .unwrap_or(1.0)+ }+ _ => 1.0,+ };+ Some(own * opacity * unmasked * based)+ }++ pub fn marks_at(+ &self,+ at: (f32, f32),+ slack: f32,+ all: bool,+ hidden: impl Fn(&Mark) -> bool + Copy,+ ) -> Option<(Vec<usize>, u32)> {+ const SEEN: f32 = 0.05;let doc = &self.bundle.doc;let shown = |path: &[usize]| (1..=path.len()).all(|n| doc.locate_path(&path[..n]).is_some_and(|l| l.visible));- let others = doc- .all_layers()+ let paths: Vec<Vec<usize>> = match all {+ false => vec![self.active.clone()],+ true => doc+ .all_layers()+ .into_iter()+ .rev()+ .filter_map(|l| match doc.locate(&l.id) {+ Some(Loc::Layer(path)) => Some(path),+ _ => None,+ })+ .collect(),+ };+ let layers: Vec<(Vec<usize>, &[Mark], Option<f32>)> = paths.into_iter()- .rev()- .filter_map(|l| match doc.locate(&l.id) {- Some(Loc::Layer(path)) => Some(path),- _ => None,- });- std::iter::once(self.active.clone())- .chain(others).filter(|path| path.last() != Some(&MASK) && shown(path))- .find_map(|path| {+ .filter_map(|path| {let layer = doc.locate_path(&path)?;if layer.kind() != Kind::Paint || layer.locked {return None;}let marks = self.cels.get(&layer.content_at(self.frame)?.id)?.marks();- klad_core::markedit::hit(marks, at, slack).map(|id| (path, id))+ let seen = self.seen_at(&path, at);+ Some((path, marks, seen))+ })+ .collect();+ let painted = |marks: &[Mark]| klad_core::markedit::pick(marks, at, 0.0, hidden).is_some();+ layers+ .iter()+ .find(|(_, marks, seen)| seen.map_or_else(|| painted(marks), |a| a > SEEN))+ .and_then(|(path, marks, _)| {+ klad_core::markedit::pick(marks, at, slack, hidden).map(|id| (path.clone(), id))+ })+ .or_else(|| {+ layers.iter().find_map(|(path, marks, _)| {+ klad_core::markedit::pick(marks, at, slack, hidden).map(|id| (path.clone(), id))+ })})}diff --git a/crates/app/src/editor.rs b/crates/app/src/editor.rsindex df64714..2410d3f 100644--- a/crates/app/src/editor.rs+++ b/crates/app/src/editor.rs@@ -592,6 +592,7 @@ pub(crate) struct Editor {swatch_drag: Option<usize>,renaming: Option<layers::Rename>,queued_activate: Option<Vec<usize>>,+ solo_later: Option<String>,layer_drag: Option<(layers::LayerRow, layers::Where)>,canvas_wait: Option<timeline::CanvasWait>,canvas_gen: u64,@@ -623,6 +624,7 @@ pub(crate) struct Editor {first: first::FirstSteps,settings_section: prefs::Section,report_drawing: bool,+ soloed: Option<(String, Vec<(String, bool)>)>,strip_tools: [f32; 2],strip_foot: [f32; 2],key_ease: klad_core::keys::Ease,@@ -765,6 +767,7 @@ impl Editor {swatch_drag: None,renaming: None,queued_activate: None,+ solo_later: None,layer_drag: None,canvas_wait: None,canvas_gen: 0,@@ -796,6 +799,7 @@ impl Editor {first: first::FirstSteps::default(),settings_section: prefs::Section::default(),report_drawing: false,+ soloed: None,strip_tools: [570.0, 480.0],strip_foot: [186.0, 166.0],key_ease: klad_core::keys::Ease::Linear,@@ -1501,8 +1505,36 @@ impl Editor {});}+ fn erased(&self) -> impl Fn(&Mark) -> bool + Copy + '_ {+ let brushes = &self.brushes;+ move |m: &Mark| {+ m.as_stroke().is_some_and(|s| {+ brushes+ .get(&s.brush)+ .is_ok_and(|b| b.blend == klad_brush::brush::StrokeBlend::Erase)+ })+ }+ }++ fn layer_rank(&self, id: &str) -> Option<usize> {+ self.scene.bundle.doc.all_layers().iter().position(|l| l.id == id)+ }++ fn shape_hits(&self, at: Vec2) -> Result<Vec<(String, String)>> {+ let active = self.scene.active_id();+ Ok(overlay::hits(&self.scene.bundle.doc, self.scene.frame, (at.x, at.y))?+ .into_iter()+ .filter(|(_, layer)| self.settings.pick_all_layers || active.as_deref() == Some(layer.as_str()))+ .collect())+ }++ pub(super) fn mark_at(&self, at: Vec2, slack: f32) -> Option<(Vec<usize>, u32)> {+ self.scene+ .marks_at((at.x, at.y), slack, self.settings.pick_all_layers, self.erased())+ }+fn select_at(&mut self, at: Vec2, cycle: bool) -> Result<()> {- let hits = overlay::hits(&self.scene.bundle.doc, self.scene.frame, (at.x, at.y))?;+ let hits = self.shape_hits(at)?;let current = self.selection.as_ref()@@ -1581,11 +1613,23 @@ impl Editor {self.start_drag(key, Grab::Move, corners, c, true);return Ok(());}- let on_active = self- .scene- .active_cel()- .filter(|_| markedit::hit(self.scene.active_marks(), (c.x, c.y), slack).is_some());- if on_active.is_none() {+ let stroke = self.mark_at(c, slack);+ let shape = self+ .shape_hits(c)?+ .first()+ .and_then(|(_, layer)| self.layer_rank(layer));+ let stroke_first = match (&stroke, shape) {+ (Some((path, _)), Some(shape)) => self+ .scene+ .bundle+ .doc+ .locate_path(path)+ .and_then(|l| self.layer_rank(&l.id))+ .is_some_and(|rank| rank > shape),+ (_, None) => true,+ (None, Some(_)) => false,+ };+ if !stroke_first {self.select_at(c, false)?;if let Some((id, corners)) = self.selection_corners() {self.picked = None;@@ -1594,7 +1638,7 @@ impl Editor {}}self.selection = None;- let Some((path, id)) = self.scene.marks_at((c.x, c.y), slack) else {+ let Some((path, id)) = stroke else {self.lasso = Some(Lasso {points: vec![c],start: pos,@@ -1687,12 +1731,21 @@ impl Editor {let Some(lasso) = self.lasso.take() else {return Ok(());};+ let zoom = self.view.map_or(1.0, |v| v.zoom);+ let click = !lasso.far || lasso.points.len() < 3;+ if click+ && !self.modifiers.shift+ && let Some((path, _)) = self.mark_at(lasso.points[0], 5.0 / zoom)+ && path != self.scene.active+ {+ self.activate(path)?;+ }let Some(cel) = self.scene.active_cel() else {self.say(Tone::Refused, "make a paint layer active to select its strokes");return Ok(());};- let zoom = self.view.map_or(1.0, |v| v.zoom);let at = lasso.points[0];+ let erased = self.erased();let polygon: Option<Vec<[f32; 2]>> =(lasso.far && lasso.points.len() >= 3).then(|| lasso.points.iter().map(|p| [p.x, p.y]).collect());let pick = |marks: &[Mark]| -> (Vec<u32>, bool) {@@ -1708,7 +1761,9 @@ impl Editor {(inside, crossing)}None => (- markedit::hit(marks, (at.x, at.y), 5.0 / zoom).into_iter().collect(),+ markedit::pick(marks, (at.x, at.y), 5.0 / zoom, erased)+ .into_iter()+ .collect(),false,),}@@ -1896,7 +1951,7 @@ impl Editor {let zoom = self.view.map_or(1.0, |v| v.zoom);let mut on_stroke = false;if self.under.is_empty()- && let Some((path, mark)) = self.scene.marks_at((c.x, c.y), 5.0 / zoom)+ && let Some((path, mark)) = self.mark_at(c, 5.0 / zoom){if path != self.scene.active {self.activate(path)?;@@ -3185,6 +3240,78 @@ impl Editor {Ok(())}+ pub(super) fn recolourable(&self) -> Option<String> {+ let id = self+ .selection+ .clone()+ .or_else(|| self.direct.as_ref().map(|d| d.node.clone()))?;+ match self.scene.bundle.doc.item(&id) {+ Some(Item::Node(_, _, node))+ if matches!(+ node.shape,+ Shape::Rect { .. } | Shape::Ellipse { .. } | Shape::Path { .. } | Shape::Text(_)+ ) =>+ {+ Some(id)+ }+ _ => None,+ }+ }++ fn recolour_shape(&mut self, outline: bool) -> Result<()> {+ let Some(id) = self.recolourable() else {+ return Ok(());+ };+ let hex = color::hex(self.color);+ let has_outline = matches!(+ self.scene.bundle.doc.item(&id),+ Some(Item::Node(_, _, node)) if node.stroke.is_some()+ );+ let props = match (outline, has_outline) {+ (false, _) => json!({"fill": hex}),+ (true, true) => json!({"stroke.paint": hex}),+ (true, false) => json!({"stroke": {"paint": hex, "width": self.pen_width}}),+ };+ let props = props.as_object().cloned().unwrap_or_default();+ self.apply(vec![Op::Set { id, props }])+ }++ pub(super) fn solo(&mut self, id: &str) -> Result<()> {+ let ops = match self.soloed.take() {+ Some((was, before)) if was == id => before+ .into_iter()+ .filter(|(layer, visible)| {+ self.scene+ .bundle+ .doc+ .layer(layer)+ .is_some_and(|l| l.visible != *visible)+ })+ .map(|(layer, visible)| Op::Set {+ id: layer,+ props: Map::from_iter([("visible".to_string(), json!(visible))]),+ })+ .collect(),+ _ => {+ let before = self+ .scene+ .bundle+ .doc+ .all_layers()+ .iter()+ .map(|l| (l.id.clone(), l.visible))+ .collect();+ let ops = klad_core::ops::solo(&self.scene.bundle.doc, id)?;+ self.soloed = Some((id.to_string(), before));+ ops+ }+ };+ if ops.is_empty() {+ return Ok(());+ }+ self.apply(ops)+ }+fn recolour_picked(&mut self) -> Result<()> {let hex = color::hex(self.color);let sets = self.chosen_marks().map_or(Vec::new(), |(_, chosen)| {diff --git a/crates/app/src/editor/commands.rs b/crates/app/src/editor/commands.rsindex df8156c..566e800 100644--- a/crates/app/src/editor/commands.rs+++ b/crates/app/src/editor/commands.rs@@ -97,6 +97,16 @@ impl Editor {Cmd::SelectAll => (!self.active_paint() || self.scene.active_marks().is_empty()).then(|| "the active layer has no strokes on this frame".to_string()),Cmd::Recolour | Cmd::Thinner | Cmd::Thicker => need_strokes().or(editing),+ Cmd::FillShape | Cmd::OutlineShape => self+ .recolourable()+ .is_none()+ .then(|| "select a rectangle, ellipse, path or text with V first".to_string())+ .or(editing),+ Cmd::SoloLayer => match layer {+ None => pick_layer(),+ Some(_) if self.scene.active_is_mask() => Some("this is a mask: pick the layer it masks".to_string()),+ Some(_) => editing,+ },Cmd::FlipH | Cmd::FlipV | Cmd::TurnLeft90 | Cmd::TurnRight90 | Cmd::DuplicateInPlace => {match self.selected() {Some(Selected::Strokes | Selected::Shape(_)) => editing,@@ -365,6 +375,11 @@ impl Editor {Cmd::NotesPane => layout.dock && layout.is_open(Pane::Notes),Cmd::HistoryPane => layout.dock && layout.is_open(Pane::History),Cmd::Timeline => layout.timeline,+ Cmd::PickAllLayers => self.settings.pick_all_layers,+ Cmd::SoloLayer => self+ .soloed+ .as_ref()+ .is_some_and(|(id, _)| Some(id) == self.scene.active_id().as_ref()),Cmd::FirstSteps => self.first.open,Cmd::Numbers => layout.numbers,Cmd::Settings => self.windows.settings,@@ -539,6 +554,17 @@ impl Editor {Cmd::SelectAll => self.select_all_strokes(),Cmd::CutLasso => self.cut_lasso = !self.cut_lasso,Cmd::Recolour => self.recolour_picked()?,+ Cmd::FillShape => self.recolour_shape(false)?,+ Cmd::OutlineShape => self.recolour_shape(true)?,+ Cmd::SoloLayer => {+ if let Some(id) = self.scene.active_id() {+ self.solo(&id)?;+ }+ }+ Cmd::PickAllLayers => {+ self.settings.pick_all_layers = !self.settings.pick_all_layers;+ self.settings_dirty = true;+ }Cmd::Thinner => self.size_picked(0.8)?,Cmd::Thicker => self.size_picked(1.25)?,Cmd::FlipH => self.flip(true)?,diff --git a/crates/app/src/editor/layers.rs b/crates/app/src/editor/layers.rsindex cc086e0..4b8b583 100644--- a/crates/app/src/editor/layers.rs+++ b/crates/app/src/editor/layers.rs@@ -260,8 +260,19 @@ impl Editor {let mut ops: Vec<Op> = Vec::new();if !row.mask {let eye = if row.visible { icon::EYE } else { icon::EYE_OFF };- if Self::small_toggle(&mut child, eye, row.visible, format!("show or hide {}", row.name)) {- ops.push(set(&row.id, "visible", json!(!row.visible)));+ if Self::small_toggle(+ &mut child,+ eye,+ row.visible,+ format!(+ "show or hide {}; alt click shows only this one, and again the others",+ row.name+ ),+ ) {+ match self.modifiers.alt {+ true => self.solo_later = Some(row.id.clone()),+ false => ops.push(set(&row.id, "visible", json!(!row.visible))),+ }}if Self::small_toggle(&mut child,diff --git a/crates/app/src/editor/options.rs b/crates/app/src/editor/options.rsindex 85af4a8..922638f 100644--- a/crates/app/src/editor/options.rs+++ b/crates/app/src/editor/options.rs@@ -331,16 +331,16 @@ impl Editor {}Tool::Fill => self.fill_panel(ui),Tool::Strokes => {+ self.pick_scope(ui);self.command_check(ui, Cmd::CutLasso, "a lasso cuts strokes at its edge");self.command_button(ui, Cmd::SelectAll, Some("select all"));ui.label(RichText::new("click or lasso strokes; the bar under them edits them").color(theme::WEAK));}Tool::Select => {+ self.pick_scope(ui);ui.label(- RichText::new(- "click a stroke or a shape and drag it; alt drag drags a copy; drag on empty canvas to lasso strokes",- )- .color(theme::WEAK),+ RichText::new("click what you see and drag it; alt drag: a copy; drag on empty canvas: a lasso")+ .color(theme::WEAK),);}Tool::Direct => {@@ -434,6 +434,25 @@ impl Editor {Ok(())}+ fn pick_scope(&mut self, ui: &mut egui::Ui) {+ let all = self.settings.pick_all_layers;+ [+ (false, "this layer", "a click picks strokes on the active layer only"),+ (+ true,+ "all layers",+ "a click picks what you see, on any layer, and makes its layer active",+ ),+ ]+ .into_iter()+ .for_each(|(scope, label, hint)| {+ if ui.selectable_label(all == scope, label).hint(hint).clicked() && all != scope {+ self.queued.push(Cmd::PickAllLayers);+ }+ });+ ui.separator();+ }+pub(super) fn brush_tiles(&mut self, ui: &mut egui::Ui) {ui.horizontal_wrapped(|ui| {ui.label("size");diff --git a/crates/app/src/editor/panels.rs b/crates/app/src/editor/panels.rsindex 5def5d9..eb39efb 100644--- a/crates/app/src/editor/panels.rs+++ b/crates/app/src/editor/panels.rs@@ -143,6 +143,9 @@ impl Editor {if let Some(path) = self.queued_activate.take() {self.check(|e| e.activate(path));}+ if let Some(id) = self.solo_later.take() {+ self.check(|e| e.solo(&id));+ }self.check(|e| e.tend_pick());self.check(|e| e.pin_popover(&ctx));self.check(|e| e.run_queued());diff --git a/crates/app/src/editor/selection.rs b/crates/app/src/editor/selection.rsindex b4d020b..4a5fee1 100644--- a/crates/app/src/editor/selection.rs+++ b/crates/app/src/editor/selection.rs@@ -253,6 +253,8 @@ impl Editor {Cmd::FlipV,Cmd::TurnLeft90,Cmd::TurnRight90,+ Cmd::FillShape,+ Cmd::OutlineShape,Cmd::DuplicateInPlace,Cmd::Delete,Cmd::Deselect,diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rsindex 1a89381..eda658c 100644--- a/crates/app/src/editor/ui_tests.rs+++ b/crates/app/src/editor/ui_tests.rs@@ -251,6 +251,167 @@ fn settings_is_a_modal_with_a_sidebar_and_esc_closes_it_unless_a_key_is_being_selet _ = std::fs::remove_dir_all(&path);}+fn click_with(h: &mut Harness<'static, Editor>, at: egui::Pos2, modifiers: Modifiers) {+ h.event(egui::Event::ModifiersChanged(modifiers));+ h.hover_at(at);+ h.run_steps(1);+ [true, false].into_iter().for_each(|pressed| {+ h.event(egui::Event::PointerButton {+ pos: at,+ button: egui::PointerButton::Primary,+ pressed,+ modifiers,+ });+ h.run_steps(1);+ });+ h.event(egui::Event::ModifiersChanged(Modifiers::NONE));+ h.run_steps(2);+}++#[test]+fn a_click_picks_the_stroke_you_see_on_any_layer_or_only_on_this_one() {+ let path = sample("pick-seen");+ Bundle::open(&path)+ .unwrap()+ .apply(&parse_lines(r#"{"op":"stroke","layer":"l5","path":"M100 100 L250 180","size":40}"#).unwrap())+ .unwrap();+ let mut h = harness(editor(&path), vec2(1440.0, 1000.0));+ ready(&mut h);+ let cel_of = |h: &Harness<'static, Editor>, name: &str| {+ h.state().scene.bundle.doc.find_layer(name).unwrap().cels()[0]+ .id+ .clone()+ };+ let (lines, colour) = (cel_of(&h, "lines"), cel_of(&h, "colour"));+ [Tool::Select, Tool::Strokes].into_iter().for_each(|tool| {+ activate(&mut h, "colour");+ h.state_mut().tool = tool;+ h.state_mut().picked = None;+ h.state_mut().settings.pick_all_layers = true;+ h.run_steps(2);+ let seen = canvas_at(&h, 170.0, 120.0);+ click_with(&mut h, seen, Modifiers::NONE);+ settle(&mut h, |ed| ed.scene.active_layer().is_some_and(|l| l.name == "lines"));+ if h.state().picked.is_none() {+ ready(&mut h);+ click_with(&mut h, seen, Modifiers::NONE);+ }+ assert_eq!(+ h.state().picked.as_ref().map(|p| p.cel.clone()),+ Some(lines.clone()),+ "{tool:?}: the line on top is picked, not the colour stroke under it on the active layer"+ );+ activate(&mut h, "colour");+ h.state_mut().picked = None;+ h.state_mut().settings.pick_all_layers = false;+ h.run_steps(2);+ click_with(&mut h, seen, Modifiers::NONE);+ assert_eq!(h.state().scene.active_layer().unwrap().name, "colour");+ assert_eq!(+ h.state().picked.as_ref().map(|p| p.cel.clone()),+ Some(colour.clone()),+ "{tool:?}: this layer only picks on the active layer"+ );+ });+ let _ = std::fs::remove_dir_all(&path);+}++#[test]+fn a_selected_shape_takes_the_colour_as_its_fill_or_outline() {+ let path = sample("shape-colour");+ let mut h = harness(editor(&path), vec2(1440.0, 1000.0));+ activate(&mut h, "shapes");+ let id = h.state().scene.bundle.doc.find_layer("shapes").unwrap().cels()[0].nodes[0]+ .id+ .clone();+ h.state_mut().tool = Tool::Select;+ assert!(+ h.state().can_run(Cmd::FillShape).is_some(),+ "nothing selected greys it out"+ );+ h.state_mut().selection = Some(id.clone());+ h.state_mut().color = [0.0, 0.5, 1.0, 1.0];+ h.run_steps(2);+ let node = |h: &Harness<'static, Editor>| match h.state().scene.bundle.doc.item(&id) {+ Some(klad_core::doc::Item::Node(_, _, n)) => n.clone(),+ _ => panic!("the shape is gone"),+ };+ assert!(node(&h).stroke.is_none());+ h.state_mut().invoke(Cmd::FillShape).unwrap();+ h.run_steps(2);+ assert_eq!(+ serde_json::to_value(&node(&h).fill).unwrap(),+ serde_json::json!("#0080ff")+ );+ h.state_mut().color = [1.0, 0.0, 0.0, 1.0];+ h.state_mut().invoke(Cmd::OutlineShape).unwrap();+ h.run_steps(2);+ let outline = serde_json::to_value(node(&h).stroke.unwrap()).unwrap();+ assert_eq!(outline["paint"], "#ff0000", "{outline}");+ assert_eq!(+ serde_json::to_value(&node(&h).fill).unwrap(),+ serde_json::json!("#0080ff")+ );+ let _ = std::fs::remove_dir_all(&path);+}++#[test]+fn alt_click_on_an_eye_shows_only_that_layer_and_again_brings_the_rest_back() {+ let path = sample("solo");+ let mut h = harness(editor(&path), vec2(1440.0, 1000.0));+ [Pane::Tool, Pane::Inspector, Pane::Notes, Pane::History]+ .into_iter()+ .for_each(|pane| {+ if let Some(p) = h.state_mut().settings.layout.pane_mut(pane) {+ p.collapsed = true;+ }+ });+ h.state_mut().settings.layout.timeline = false;+ h.run_steps(3);+ let eye_of = |h: &Harness<'static, Editor>, name: &str| {+ let row = h+ .query_all_by_label(name)+ .map(|n| n.rect())+ .max_by(|a, b| a.left().total_cmp(&b.left()))+ .unwrap();+ h.query_all_by_label(theme::icon::EYE)+ .chain(h.query_all_by_label(theme::icon::EYE_OFF))+ .map(|n| n.rect())+ .find(|r| (r.center().y - row.center().y).abs() < 8.0 && r.right() <= row.left())+ .unwrap()+ .center()+ };+ let visible = |h: &Harness<'static, Editor>| -> Vec<String> {+ h.state()+ .scene+ .bundle+ .doc+ .layers+ .iter()+ .filter(|l| l.visible)+ .map(|l| l.name.clone())+ .collect()+ };+ let before = visible(&h);+ let eye = eye_of(&h, "colour");+ click_with(&mut h, eye, Modifiers::ALT);+ assert_eq!(visible(&h), ["colour"], "only colour shows");+ assert_eq!(+ h.state().is_on(Cmd::SoloLayer),+ Some(false),+ "it is not the active layer"+ );+ let eye = eye_of(&h, "colour");+ click_with(&mut h, eye, Modifiers::ALT);+ assert_eq!(visible(&h), before, "again: the rest comes back as it was");+ let eye = eye_of(&h, "colour");+ click_with(&mut h, eye, Modifiers::ALT);+ h.state_mut().invoke(Cmd::Undo).unwrap();+ h.run_steps(3);+ assert_eq!(visible(&h), before, "one undo takes it back too");+ let _ = std::fs::remove_dir_all(&path);+}+#[test]fn every_control_is_pen_sized_and_has_a_hover_hint() {let path = sample("audit");diff --git a/crates/app/src/settings.rs b/crates/app/src/settings.rsindex 2b5462f..6b33b00 100644--- a/crates/app/src/settings.rs+++ b/crates/app/src/settings.rs@@ -85,6 +85,8 @@ pub struct Settings {pub updates_checked: u64,#[serde(default)]pub welcomed: bool,+ #[serde(default = "yes", rename = "pickAllLayers")]+ pub pick_all_layers: bool,}fn yes() -> bool {@@ -107,6 +109,7 @@ impl Default for Settings {check_updates: true,updates_checked: 0,welcomed: false,+ pick_all_layers: true,}}}diff --git a/crates/brush/src/tiles.rs b/crates/brush/src/tiles.rsindex d632b49..2a9be1f 100644--- a/crates/brush/src/tiles.rs+++ b/crates/brush/src/tiles.rs@@ -126,6 +126,15 @@ impl Raster {}}+ pub fn alpha_at(&self, x: f32, y: f32) -> f32 {+ if x < 0.0 || y < 0.0 || x >= self.width as f32 || y >= self.height as f32 {+ return 0.0;+ }+ let (x, y) = (x as usize, y as usize);+ self.get(x / TILE, y / TILE)+ .map_or(0.0, |t| f32::from(t[((y % TILE) * TILE + x % TILE) * 4 + 3]))+ }+pub fn heights(&self) -> Option<&Heights> {self.body.as_ref().filter(|h| h.count() > 0)}diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rsindex 196dcc3..072ae7e 100644--- a/crates/cli/src/main.rs+++ b/crates/cli/src/main.rs@@ -1191,6 +1191,16 @@ enum Command {#[command(flatten)]flags: EditFlags,},+ #[command(+ about = "Show only one layer: hide every other layer (its groups stay shown, its own layers as they are)",+ long_about = "Show only one layer: every other layer is hidden, the groups it is in stay shown and the layers inside it keep their own visibility, in one step that klad undo takes back. The editor's alt click on a layer's eye does the same.\n\n klad solo art.klad lines"+ )]+ Solo {+ bundle: PathBuf,+ layer: String,+ #[command(flatten)]+ flags: EditFlags,+ },#[command(about = "List the skeletons, their bones and weights, and the posed drawings")]Bones {bundle: PathBuf,@@ -2851,6 +2861,15 @@ fn run() -> Result<()> {agent::edit(&bundle, &[Op::Bone(spec)], &output(&flags, 0))?;}Command::Bones { bundle, json } => rig::list(&Bundle::open(&bundle)?, json)?,+ Command::Solo { bundle, layer, flags } => {+ let opened = Bundle::open(&bundle)?;+ let id = opened.doc.find_layer(&layer)?.id.clone();+ let ops = klad_core::ops::solo(&opened.doc, &id)?;+ match ops.is_empty() {+ true => println!("{layer} already shows alone"),+ false => agent::edit(&bundle, &ops, &output(&flags, 0))?,+ }+ }Command::Key {bundle,id,diff --git a/crates/cli/tests/binary.rs b/crates/cli/tests/binary.rsindex f7eb0e9..03a01a7 100644--- a/crates/cli/tests/binary.rs+++ b/crates/cli/tests/binary.rs@@ -224,3 +224,32 @@ fn a_report_holds_the_version_the_log_with_home_hidden_and_zips_the_drawing() {assert!(dir.join("drawings/rock for a report.zip").is_file());std::fs::remove_dir_all(&dir).unwrap();}++#[test]+fn solo_shows_one_layer_and_undo_brings_the_rest_back() {+ let dir = std::env::temp_dir().join(format!("draw-binary-solo-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ let bundle = dir.join("a.klad");+ let path = bundle.to_str().unwrap();+ let run = |args: &[&str]| {+ let out = Command::new(env!("CARGO_BIN_EXE_klad")).args(args).output().unwrap();+ assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));+ String::from_utf8_lossy(&out.stdout).to_string()+ };+ run(&["new", path, "--width", "64", "--height", "64", "--layers", "3"]);+ let shown = || -> Vec<bool> {+ let doc: serde_json::Value = serde_json::from_slice(&std::fs::read(bundle.join("doc.json")).unwrap()).unwrap();+ doc["layers"]+ .as_array()+ .unwrap()+ .iter()+ .map(|l| l["visible"].as_bool().unwrap_or(true))+ .collect()+ };+ run(&["solo", path, "paint 2"]);+ assert_eq!(shown(), [false, true, false]);+ assert!(run(&["solo", path, "paint 2"]).contains("already shows alone"));+ run(&["undo", path]);+ assert_eq!(shown(), [true, true, true]);+ std::fs::remove_dir_all(&dir).unwrap();+}diff --git a/crates/core/src/doc.rs b/crates/core/src/doc.rsindex 0be3206..bfb21dd 100644--- a/crates/core/src/doc.rs+++ b/crates/core/src/doc.rs@@ -715,6 +715,10 @@ pub fn family_paths(doc: &Document, path: &[usize]) -> Vec<Vec<usize>> {.collect()}+pub fn walk_children<'a>(layer: &'a Layer, out: &mut Vec<&'a Layer>) {+ walk_layers(layer.children(), out);+}+fn walk_layers<'a>(layers: &'a [Layer], out: &mut Vec<&'a Layer>) {layers.iter().for_each(|l| {out.push(l);diff --git a/crates/core/src/markedit.rs b/crates/core/src/markedit.rsindex 6c4aba9..54babc2 100644--- a/crates/core/src/markedit.rs+++ b/crates/core/src/markedit.rs@@ -480,11 +480,18 @@ fn touches(mark: &Mark, at: (f32, f32), slack: f32) -> bool {}pub fn hit(marks: &[Mark], at: (f32, f32), slack: f32) -> Option<u32> {- marks- .iter()- .rev()- .find(|m| cut::keeps(m.cuts(), at) && touches(m, at, slack))- .map(Mark::id)+ pick(marks, at, slack, |_| false)+}++pub fn pick(marks: &[Mark], at: (f32, f32), slack: f32, hidden: impl Fn(&Mark) -> bool) -> Option<u32> {+ let found = |slack: f32| {+ marks+ .iter()+ .rev()+ .find(|m| !hidden(m) && cut::keeps(m.cuts(), at) && touches(m, at, slack))+ .map(Mark::id)+ };+ found(0.0).or_else(|| (slack > 0.0).then(|| found(slack)).flatten())}#[derive(Clone, Copy, Debug, PartialEq, Eq)]@@ -775,6 +782,38 @@ mod tests {value.as_object().unwrap().clone()}+ #[test]+ fn a_pick_takes_the_mark_under_the_point_before_one_merely_near_it() {+ let wide: Mark = Stroke::new(1, "ink", [0.0, 0.0, 0.0, 1.0], 20.0, 1)+ .with_points(&[(10.0, 50.0, 1.0), (90.0, 50.0, 1.0)], 4.0)+ .into();+ let thin: Mark = Stroke::new(2, "ink", [0.0, 0.0, 0.0, 1.0], 2.0, 1)+ .with_points(&[(10.0, 46.0, 1.0), (130.0, 46.0, 1.0)], 4.0)+ .into();+ let marks = vec![wide, thin];+ assert_eq!(+ pick(&marks, (50.0, 52.0), 6.0, |_| false),+ Some(1),+ "under the point wins"+ );+ assert_eq!(+ pick(&marks, (50.0, 46.5), 6.0, |_| false),+ Some(2),+ "the top one where both cover"+ );+ assert_eq!(+ pick(&marks, (120.0, 49.0), 6.0, |_| false),+ Some(2),+ "near only the thin one: slack"+ );+ assert_eq!(+ pick(&marks, (50.0, 46.5), 6.0, |m| m.id() == 2),+ Some(1),+ "hidden marks are skipped"+ );+ assert_eq!(pick(&marks, (50.0, 20.0), 6.0, |_| false), None);+ }+#[test]fn addresses_name_a_cel_and_a_mark() {assert_eq!(parse_address("c4:s12"), Some(("c4", 12)));diff --git a/crates/core/src/ops.rs b/crates/core/src/ops.rsindex 68d5591..56d1b46 100644--- a/crates/core/src/ops.rs+++ b/crates/core/src/ops.rs@@ -1628,6 +1628,32 @@ fn parse_inbetween(map: &mut Map<String, Value>) -> Result<InbetweenSpec> {Ok(spec)}+pub fn solo(doc: &Document, id: &str) -> Result<Vec<Op>> {+ let mask = |path: &[usize]| path.last() == Some(&crate::doc::MASK);+ let path = match doc.locate(id) {+ Some(crate::doc::Loc::Layer(path)) if !mask(&path) => path,+ Some(crate::doc::Loc::Layer(_)) => bail!("{id} is a mask: show only the layer it masks"),+ _ => bail!("no layer {id}"),+ };+ let keep: Vec<String> = (1..=path.len()).map(|n| doc.layer_at(&path[..n]).id.clone()).collect();+ let mut inside = Vec::new();+ crate::doc::walk_children(doc.layer_at(&path), &mut inside);+ let inside: Vec<&str> = inside.iter().map(|l| l.id.as_str()).collect();+ Ok(doc+ .all_layers()+ .into_iter()+ .filter(|l| !inside.contains(&l.id.as_str()))+ .filter(|l| matches!(doc.locate(&l.id), Some(crate::doc::Loc::Layer(p)) if !mask(&p)))+ .filter_map(|l| {+ let visible = keep.contains(&l.id);+ (l.visible != visible).then(|| Op::Set {+ id: l.id.clone(),+ props: Map::from_iter([("visible".to_string(), Value::Bool(visible))]),+ })+ })+ .collect())+}+pub fn rig_owner<'a>(doc: &'a Document, id: &str) -> Result<&'a Layer> {let layer = doc.find_layer(id)?;match layer.kind() {@@ -3216,6 +3242,35 @@ mod tests {assert!(sun.stroke.is_none());}+ #[test]+ fn solo_hides_every_other_layer_but_keeps_its_groups_and_its_own_layers() {+ let doc = |lines: &str| {+ let (doc, _) = apply_all(&crate::doc::Document::new(64, 64), &parse_lines(lines).unwrap()).unwrap();+ doc+ };+ let d = doc(r#"{"op":"add","layer":{"id":"sky","kind":"paint","name":"sky"}}+{"op":"add","layer":{"id":"figure","kind":"group","name":"figure"}}+{"op":"add","layer":{"id":"body","kind":"paint","name":"body"},"in":"figure"}+{"op":"add","layer":{"id":"arm","kind":"group","name":"arm"},"in":"figure"}+{"op":"add","layer":{"id":"hand","kind":"paint","name":"hand"},"in":"arm"}+{"op":"add","layer":{"id":"glove","kind":"paint","name":"glove","visible":false},"in":"arm"}"#);+ let id = |name: &str| d.find_layer(name).unwrap().id.clone();+ let (solo_doc, _) = apply_all(&d, &solo(&d, &id("arm")).unwrap()).unwrap();+ let shown: Vec<&str> = solo_doc+ .all_layers()+ .into_iter()+ .filter(|l| l.visible)+ .map(|l| l.name.as_str())+ .collect();+ assert_eq!(+ shown,+ ["figure", "arm", "hand"],+ "its group stays, its own layers keep theirs"+ );+ assert!(solo(&solo_doc, &id("arm")).unwrap().is_empty(), "already alone");+ assert!(solo(&d, "l99").is_err());+ }+#[test]fn failed_batches_change_nothing() {let doc = base();diff --git a/docs/DESIGN.md b/docs/DESIGN.mdindex 2bc00b9..6e19a65 100644--- a/docs/DESIGN.md+++ b/docs/DESIGN.md@@ -1,4 +1,4 @@-_Last updated: 2026-11-07 09:54_+_Last updated: 2026-11-07 10:23_# klad: design@@ -435,17 +435,17 @@ Scripts are any language that prints edit ops as JSON lines into `klad apply`. G- Canvas: pan, zoom, rotate; pen pressure, tilt and eraser end; 120 Hz on Apple Silicon. The window around the canvas is a neutral grey (`theme::SURROUND`), so colours read true.- Layout (M4 batch 1): a tool strip on the left (the tools with their key letter, undo and redo, and at its foot the document and panels menus, the command palette, numbers and settings; the strip only has the height between the menu bar and the timeline, so when both groups do not fit its buttons shrink from 36 to 28 pt, then the foot folds into one menu pinned at the bottom, and last the tools scroll, never overlapping; each size is measured as it is drawn, so the choice does not flicker); a dock on the right holding panes (colour and brush, layers, layer settings (`Pane::Inspector` in code), notes for the agent, history), each with a title row that folds it, closes it and, dragged at its top edge, resizes the pane above; the timeline along the bottom, resizable and foldable to its toolbar; a status line under everything. Panes share the dock's height: they keep the sizes the user gave them, the last open one takes what is left, and when they do not fit they shrink towards their minimums and scroll inside (`layout::Layout::bodies`). Tab hides every panel but the status line, shift Tab the dock. Which panels are open, the dock's width, the timeline's height and each pane's size are kept in the user's settings (`layout`) and restored, clamped to the window. Pen calibration lives in the settings modal (cmd ,); the performance numbers in a numbers window that can stay open over the canvas.- Commands (M4 batch 1): every editor action is a `Cmd` in one list (`commands.rs`): an id (`tool.brush`, `drawing.new`, kept in settings), a name in plain words, a Phosphor icon, a group, its keys or the hold that triggers it, whether a held key repeats it, and a line on what it does. Keys, the strip, panel buttons, the timeline's buttons and context menu, and the palette all run commands through `Editor::invoke`, which first asks `can_run` (a reason when it cannot, shown as a refusal) and remembers the last twelve run. A key matches only with exactly its modifiers (shift K is not K); key repeats run commands that repeat (`=`, `[`, cmd Z) and frame steps only once the frame on screen caught up. cmd K opens the palette: type to filter (name start, then a key, a word, a substring, the letters in order, the group; hyphens ignored, so "inb" finds in-between), arrows and Return run, rows grey out with the reason, recent commands first; `?` opens it too. Every control has a hover hint after 0.35 s (from its command where there is one) and is at least 24 pt high; a test walks every control of every panel and window to keep it so.-- Tool options and selections (M4 batch 2): a bar over the canvas holds the active tool's settings (brush: picker, size, opacity, flow, and a "more" menu for hardness, lightest size, curve, taper, stabiliser and smoothing; fill: reference, gap, tolerance, grow, opacity; strokes: cut at the lasso edge, select all; points: corner, smooth, simplify, make it a path). The strip shows the eraser while the eraser brush or the pen's eraser end is on, and two colours (the current one over the second; X or a click swaps them; picking a colour from a swatch, the hex field or the eyedropper makes the old one the second). cmd alt drag sideways on the canvas sizes the brush (doubling every 120 pt), the circle staying where the drag began. H flips the view left-right (the view's mappings and the GPU matrix mirror; the document does not change); the status line's zoom takes a click for 100% and a double-click to fit, its rotation a click to turn upright. A selection bar sits under (or over) the selection's box: for strokes flips, quarter turns, recolour, thinner, thicker, opacity, copy, paste, duplicate in place, delete, deselect; for a shape flips (sx or sy negated and its rotation mirrored), quarter turns, duplicate in place (an `add` of the node without ids, above it), delete, deselect; for points corner, smooth, nudges, delete. Arrows nudge strokes, a shape or points by 1 px, 10 px with shift. Strokes select across layers (M5 batch 2 round 1): cmd or shift click on rows in the layers panel adds paint layers to the active one (marked with a blue edge); S then lassos, clicks and selects all on all of them, and the selection (one part per layer) moves, turns, scales, flips, recolours, cuts at the lasso edge, copies and deletes as one edit, each layer's marks staying on their layer. A selection on several layers drags as its outline (no GPU lift) and lands on release; copies of several layers paste back into their own layers, a copy of one layer into the active one. The strip's panels button lists the five panels and the timeline with a tick each, so a closed panel always has a way back. U draws rectangles and ellipses on a vector layer (shift for a square or circle, alt from the centre, rounded corners for rectangles; fill, outline and width shared with the pen, the fill in the first colour and the outline in the second, as for the pen's paths) as `rect` and `ellipse` nodes. Mirror painting (the brush bar's "mirror" and its axis) paints every stroke's mirror image as it is drawn, in a second stroke buffer landed after the first, and commits both as plain marks in one history step. Handles are drawn at 12 pt and hit within 12 pt (`grab`); shapes whose rotation is a quarter turn get edge handles too (`lift::stretched` scales their own axis). Pen events that arrive while a shape move or point edit is being written are held and replayed in order after it. The colour and brush pane shows the palette (swatches drag to reorder; the x in a hovered swatch's corner, or a right-click, removes it), recent colours, size presets and the brushes as tiles, each with a sample stroke drawn by `klad-brush` once per brush definition.+- Tool options and selections (M4 batch 2): a bar over the canvas holds the active tool's settings (brush: picker, size, opacity, flow, and a "more" menu for hardness, lightest size, curve, taper, stabiliser and smoothing; fill: reference, gap, tolerance, grow, opacity; strokes: cut at the lasso edge, select all; points: corner, smooth, simplify, make it a path). The strip shows the eraser while the eraser brush or the pen's eraser end is on, and two colours (the current one over the second; X or a click swaps them; picking a colour from a swatch, the hex field or the eyedropper makes the old one the second). cmd alt drag sideways on the canvas sizes the brush (doubling every 120 pt), the circle staying where the drag began. H flips the view left-right (the view's mappings and the GPU matrix mirror; the document does not change); the status line's zoom takes a click for 100% and a double-click to fit, its rotation a click to turn upright. A selection bar sits under (or over) the selection's box: for strokes flips, quarter turns, recolour, thinner, thicker, opacity, copy, paste, duplicate in place, delete, deselect; for a shape flips (sx or sy negated and its rotation mirrored), quarter turns, fill with the colour and outline in the colour (rectangles, ellipses, paths and text: `fill`, or `stroke.paint`, or a new `stroke` at the pen's width when it had none; Edit > Shape; `klad set <id> fill=...` is the CLI form), duplicate in place (an `add` of the node without ids, above it), delete, deselect; for points corner, smooth, nudges, delete. Arrows nudge strokes, a shape or points by 1 px, 10 px with shift. Strokes select across layers (M5 batch 2 round 1): cmd or shift click on rows in the layers panel adds paint layers to the active one (marked with a blue edge); S then lassos, clicks and selects all on all of them, and the selection (one part per layer) moves, turns, scales, flips, recolours, cuts at the lasso edge, copies and deletes as one edit, each layer's marks staying on their layer. A selection on several layers drags as its outline (no GPU lift) and lands on release; copies of several layers paste back into their own layers, a copy of one layer into the active one. The strip's panels button lists the five panels and the timeline with a tick each, so a closed panel always has a way back. U draws rectangles and ellipses on a vector layer (shift for a square or circle, alt from the centre, rounded corners for rectangles; fill, outline and width shared with the pen, the fill in the first colour and the outline in the second, as for the pen's paths) as `rect` and `ellipse` nodes. Mirror painting (the brush bar's "mirror" and its axis) paints every stroke's mirror image as it is drawn, in a second stroke buffer landed after the first, and commits both as plain marks in one history step. Handles are drawn at 12 pt and hit within 12 pt (`grab`); shapes whose rotation is a quarter turn get edge handles too (`lift::stretched` scales their own axis). Pen events that arrive while a shape move or point edit is being written are held and replayed in order after it. The colour and brush pane shows the palette (swatches drag to reorder; the x in a hovered swatch's corner, or a right-click, removes it), recent colours, size presets and the brushes as tiles, each with a sample stroke drawn by `klad-brush` once per brush definition.- First start (S8.7, `start.rs`, `editor/first.rs`, `klad_core::samples`): until the settings say `welcomed` (set when any drawing opens, or by "Not now"), the start window opens with a welcome offering first steps. First steps make `first steps.klad` (1280 by 800 on paper, one paint layer) in the drawings folder and open it with a small window of three steps that tick as they happen: a brush stroke is saved, a fill is saved, the request for an agent is copied (a sentence with the drawing's path asking the agent to read `klad skill`, render the drawing and add a shadow; "install the klad command" sits next to it). Help > First steps opens and closes the window on any drawing. The checklist is the editor's alone: it teaches the hands on the canvas, and an agent's first steps are `klad skill`. Revisit the third step when klad is an MCP server (S8.10). Under the recent drawings the start window shows the samples: the drawings `samples/shipped.json` names (name, bundle, a line on what it shows), each a card with its thumbnail and that line; a click copies it into the drawings folder without its `.cache` (`samples::copy`, `<name>.klad` or `<name> 2.klad`) and opens the copy, so a sample is never changed. `klad samples` lists the same set and `--copy <name> [--into folder]` copies one (default the current folder). Samples are found like the fonts: `KLAD_SAMPLES`, then `samples/` next to the binary, `../Resources/samples`, `../share/klad/samples`, and a source checkout's `samples/` up to five folders above the binary (where they exist after `just samples`; a sample not built is left out). `packaging/samples.sh` puts them in every build: it builds any that are missing with that build's `klad` (through the sample's `build.sh`, `PYTHON` naming the interpreter), copies them without caches, and renders each one's `<name>.thumb.png` next to it at 336 px, so the start window never renders into the app (a thumbnail outside the bundle is used as it is; only recent drawings' `.cache/thumb.png` are remade when the drawing changes). `app.sh` puts them in `Resources/samples`, `archive.sh` in the archive's `samples/` and the AppImage's `usr/share/klad/samples`; the six weigh about 4 MB.- Messages and problem reports (S8.8, `report.rs`): a message says what happened and what to do next ("nothing to fill there: click inside closed lines, or raise the gap so small openings close"); a refusal names the step that makes the command possible. Errors that mean klad itself went wrong (an invariant broken, a picture missing that should be there) are `report::Bug`s: the editor says "something went wrong inside klad (what), everything up to your last edit is saved; Help > Report a problem copies what an issue needs" instead of the bare detail; a job whose CLI crashed reads the same, and a job that failed says "<job> did not finish: <the CLI's reason>". Every error message, job failure and crash of the editor or the CLI is appended to `klad.log` next to the settings (`KLAD_LOG` overrides it; past 512 KB the older half goes), one dated line each. Help > Report a problem opens a window with the report as it will be copied: klad's version and where it ran, the system (macOS version, the Linux distribution, Windows' version, and the processor), a place for what happened, the drawing's size, the last 40 messages and the last 40 lines of the log, with the home folder written as `~` and the drawing's folder as `<the drawing's folder>`. "include the drawing" zips the drawing without its cache next to it (`<name> for a report.zip`, stored entries, written by klad itself) and the report names the file to attach; "copy the report" copies it and "open klad's issues" opens GitHub. Nothing is sent by klad. `klad report [--drawing <bundle>]` prints the same report from the command line (version, system, log, the drawing zipped).- Menus (S8.6, `commands::MENUS`, `menus.rs`): one list of menus holds every command but the holds (pan, zoom, the eyedropper, flipping, rolling, the parallax preview and sizing on the canvas, which are gestures), so the menus, the palette and the keys stay one list; a test fails when a command is in no menu or in two. The menus, in order: File (new, open, recent, close; import; export; the path and the command line tool), Edit (undo; copy, paste, duplicate, delete; selecting; Transform, Strokes and Points submenus), Tools (the tools, the brush, the colours), Layer (new, duplicate, rename, group, delete; show, lock, clip, lock alpha; Mask and Shape generators submenus, paint over; refill and gaps), Frame (stepping, drawings, holds and moves, inserting and removing frames), Animation (playback, onion skin, exposure, Selected frames and Clip submenus, the checks across frames), View (zoom, rotation, flip, the reference), Window (the panels, the message log, numbers) and Help. Each command has a short menu label (`Cmd::menu`: "Show", "Clip to layer below", "Export…"), since the menu says what it acts on, while the palette and hints keep the longer names; "…" marks a command that opens a window. Items show one key each (Backspace for delete); toggles show a tick, except commands that open a window; a command that cannot run now is greyed out (its reason is the palette's). A test keeps labels unique in each menu and under 30 characters. On macOS the list becomes the system menu bar (`menus::install`, rebuilt when the keys or the recent drawings change): an app menu with About, Settings, Services, hide and Quit, then the list, whose Window menu also gets the system's Minimize, Zoom and Bring all to front (it is the app's windows menu). Items target one Objective-C object (`KladMenuTarget`, `define_class!`) whose `kladRun:` queues the command for the next frame (the editor runs it through `Editor::invoke` as any key would) and whose `validateMenuItem:` reads a snapshot of what is off and on that the app refreshes every 0.4 s. The item keys are shown but not claimed: the object is each menu's delegate and answers no to `menuHasKeyEquivalent:forEvent:target:action:`, so a key still reaches the editor's own dispatch (which knows holds, repeats and text fields) and nothing runs twice; only the app menu's own keys (cmd , cmd Q cmd H) and Window's cmd M are AppKit's. On Windows and Linux (and in tests) the same list is an egui menu bar over the window, hidden with the panels (Tab). File > Open recent lists the last ten drawings; File > Close the drawing (cmd W, refused while a job runs) goes back to the start window, where only new, open, recent and quit run. Settings and Quit sit in the app menu on macOS and in Edit and File elsewhere; About (with the licences) is in Help everywhere and also in the macOS app menu.- Messages and jobs (M4 batch 1): every result, refusal and error goes through `Editor::say` with a tone (info, done, refused, error). Done and refused messages show for 3.5 and 6 s as a toast next to the pointer where the user acted (jobs' messages at the bottom right), errors until dismissed, info only in the status line; the status line shows the latest message (a click opens the message log, the last 200 with times), the frame, where the next stroke goes ("draws into c12 on lines, frames 4 to 7"), running jobs with a cancel button, slow internal work (preparing a selection, drawing an edited path, loading a frame), zoom and rotation. Times that used to be status text (stroke, fill, edit, undo, sync, frame step, last play, last job) are kept by name for the numbers window. Background jobs (in-betweens, Godot export) run the same `klad` binary through one job list (`jobs.rs`); when the CLI exits with code 75 (the document changed while it computed) the job runs again, up to three times, so an edit made in the editor meanwhile is never overwritten.- Tools: brush, eraser, smudge, fill (inside lines, gap closing), lasso select and transform, move/rotate/scale handles, path point editing, eyedropper.-- Stroke select (S, M2): click picks the topmost stroke or fill on the active paint layer under the pointer, a dragged loop picks every stroke whose samples are all inside it and every fill whose pixels are, shift adds or toggles. With "a lasso cuts strokes at its edge" (on by default) the loop also takes the parts of strokes and fills crossing it: the selection shows the dashed lasso and the parts that will move, and the first edit (move, recolour, delete, ...) writes one `lasso` op that splits them, after which the selection is the moved marks. The selection shows as thin lines and a box with corner handles (uniform scale), edge handles (stretch one axis; dragging past the other edge flips) and a rotate knob; dragging moves it on the GPU (the selected marks drawn alone, over the cel replayed without them) and release writes one `transform` or `lasso` op. Layer settings recolour (the current colour), makes thinner or thicker, sets opacity, flips left-right or up-down and deletes, each as one history step. The selection is shared with the agent as addresses.+- Stroke select (S, M2): a click picks the mark you see under the pointer. With "all layers" (the S and V options and Edit > Pick from all layers, `pickAllLayers` in the settings, on by default) that is on the topmost visible, unlocked paint layer that shows paint there, which becomes active: a layer shows paint where its raster's alpha, times its own and its groups' opacity, outside its mask and inside its clip base, passes 5%, and a layer whose pixels are not loaded counts by its marks' shapes (`Scene::seen_at`, `Scene::marks_at`); with "this layer" it is the active layer. In that layer the mark is the topmost one covering the point (inside a stroke's painted width or a fill's coverage, never an eraser stroke), and only when none covers it does one within 5 pt of the point count, so a thin line is still easy to take (`markedit::pick`); when no layer shows paint there, the topmost mark within those 5 pt on any of the layers is taken. A shift click adds or removes on the active layer, a dragged loop picks every stroke whose samples are all inside it and every fill whose pixels are, shift adds or toggles. With "a lasso cuts strokes at its edge" (on by default) the loop also takes the parts of strokes and fills crossing it: the selection shows the dashed lasso and the parts that will move, and the first edit (move, recolour, delete, ...) writes one `lasso` op that splits them, after which the selection is the moved marks. The selection shows as thin lines and a box with corner handles (uniform scale), edge handles (stretch one axis; dragging past the other edge flips) and a rotate knob; dragging moves it on the GPU (the selected marks drawn alone, over the cel replayed without them) and release writes one `transform` or `lasso` op. Layer settings recolour (the current colour), makes thinner or thicker, sets opacity, flips left-right or up-down and deletes, each as one history step. The selection is shared with the agent as addresses.- Layers (M2 batch 4): layer settings sets clip to the layer below and lock alpha, adds a mask (empty, or hiding all), turns it on and off, removes it, and "paint on the mask" makes the mask the active layer (it also has its own row under its layer). Painting on a mask hides the layer under the strokes; the eraser shows it again. While a mask is active, what it hides is tinted red ("show the mask in red", on by default), and the brush panel says whether the brush or the eraser is on. The brush and fill tools record lock alpha from the active layer.- Live previews and clipping: the editor composes the active layer between cached images of everything below and above it only when that is exact (the active layer and the groups around it are not clipped, masked or a clip base); otherwise each dirty tile composes the whole stack. The GPU lift of a dragged shape or of selected strokes falls back to the outline (the result appears on release) when the dragged layer is clipped, masked or a clip base, when a group around it is, when a layer above it uses overlay, or when a lock-alpha mark lies at or after the first selected mark in its cel. Clip groups above the dragged layer stay live: they compose as one plane with the base's blend.- Direct select (A, M2): click a path, rect or ellipse (inside groups too) to show its points; clicking the selected shape again steps down to the next shape under the pointer, and layer settings list them all; click or shift click points, drag on empty canvas for a box; drag points or handles; alt click the outline adds a point, alt click a point toggles corner and smooth, alt drag a handle breaks it; delete removes points; layer settings have corner, smooth, delete points, simplify and "make it a path". While dragging, the edited outline is drawn live; on release the edit is one `path` op whose layer is rendered in the background, then swapped in.-- Select and move (V, M4 test): a press picks what is under the pen and drags it at once: a stroke or fill on the active paint layer first, then a vector shape (clicking a shape again steps to the one under it), then the topmost visible, unlocked paint layer with a mark there, which becomes the active layer. A stroke picked this way is the same selection as S makes (its bar, layer settings, nudges, delete, copy), so V is the one tool for "move this". A press on empty canvas lassoes strokes on the active layer. Alt drag drags a copy: the copy is made (duplicate in place, one step) when the drag first moves, and the drag moves the copy (two history steps). A, the point editor, says so when a click lands on a brush stroke: strokes are samples, not paths.+- Select and move (V, M4 test): a press picks what you see under the pen and drags it at once: the mark S would pick and the topmost vector shape there are compared by their layers' places in the stack and the higher one wins (clicking a shape again steps to the one under it); its layer becomes the active layer. With "this layer" only the active layer's marks or shapes are picked. A stroke picked this way is the same selection as S makes (its bar, layer settings, nudges, delete, copy), so V is the one tool for "move this". A press on empty canvas lassoes strokes on the active layer. Alt drag drags a copy: the copy is made (duplicate in place, one step) when the drag first moves, and the drag moves the copy (two history steps). A, the point editor, says so when a click lands on a brush stroke: strokes are samples, not paths.- Pen (P, M4 test): draws vector paths on a vector layer: a click places a corner, a drag pulls out symmetric handles, a click on the first point closes the path, Return finishes it open, Esc drops it, and another tool finishes it. The path is one `add` node op into the layer at the current frame, in the current colour: closed paths are filled (unless "fill" is off) and outlined (unless "outline" is off), open ones always outlined, at the width in the options bar. On other layers it refuses and says why; the brush says so on a vector layer.- Colour (M2): a hue ring with a saturation and value square, hex, alpha; the document palette as swatches (click picks, right-click removes, "add colour" adds the current one with an optional name, all as ops); the last 16 colours used, kept in the user's settings. Alt-click with the brush or fill tool picks the colour of the image under the pointer, shift alt-click that of the active layer.- Fill tool (G, M2): click fills inside the lines of this layer, all visible layers or a chosen layer, with gap, tolerance, expand and opacity settings; drag a loop to lasso fill.@@ -467,7 +467,7 @@ Scripts are any language that prints edit ops as JSON lines into `klad apply`. G- Frame by frame (M3): shift K makes a new drawing right after the current exposure, on ones, twos or threes (the "shift K exposes on" setting), and moves there: an open-ended last drawing first gets a hold that ends where the new one starts, later drawings move back when the new one needs the room, and the timeline grows at the end. Holding Q and moving the pointer sideways flips through the frames around the one where Q went down (one frame per 22 px), from the frame cache; letting go stays there. Holding W shows the previous drawing of the active layer (the whole frame where it starts; in a loop range the first drawing's previous is the range's last) and letting go comes back. While Q or W is held the pen does not paint.- Copy and paste (M3 batch 4): with the stroke tool (S), cmd C keeps the selected marks (with a cut lasso, every mark inside or crossing it, copied with that cut, so only the parts inside show; marks shift-added outside it whole) and puts a line of text on the system clipboard, because egui reports cmd V only when the clipboard holds something. cmd V (any tool) copies them into the active paint layer's drawing at the current frame (on a link, its source; on an empty frame, a new drawing), in place, as one history step (one or two `copy` ops in one batch), then selects the copies with S.- Timeline selection (M3 batch 4): shift click a cell to select from the playhead's cell (or the selection's first corner) to it, or shift drag over cells; the selection is a rectangle of frames over rows, drawn white. A click without shift or Esc clears it. Its context menu retimes it (on ones, twos or threes, fit into n frames, reverse, ping-pong, on the selected rows or on every layer) as one `retime` op, and makes in-betweens: the keys are the first row's drawing at the first selected frame and the last drawing starting inside the selection; count (or one per frame), spacing and pairing are menu fields. In-betweens, and "redo the in-betweens in the selection", run `klad inbetween` as a background process of the same binary, like "export to Godot", and the editor reloads when it ends. In-between cels show lighter, their id starred.-- Layers (M4 batch 3): one layer row (`editor/layers.rs`) is drawn by the layers pane and by the timeline's names column: eye, lock, the kind icon, the name (double-click renames it in that row; Return keeps, Esc leaves), clip and lock alpha marks, a mask chip (click paints on the mask, alt click turns it on or off, right-click opens its row in the timeline), in the timeline the onion dot and a fold caret on groups, in the pane a 40 by 28 thumbnail of the layer at the current frame (box filtered from its tiles, alpha boosted by a square root so thin ink still shows, cached per drawing and document revision, made by a background job: a row shows its last thumbnail until the new one is ready). Dragging a row moves the layer: the top or bottom half of a row puts it above or below, the middle half of a group puts it inside (the row lights up), and a mask, a group into itself or a drop beside a mask is refused with the reason (`drop_at`); the drop is one `mv` op. The pane's buttons: new paint, vector or group layer above the active one, duplicate (the copy becomes active), put in a new group, delete; the active layer's opacity and blend sit in the pane's title row. Each is one history step.+- Layers (M4 batch 3): one layer row (`editor/layers.rs`) is drawn by the layers pane and by the timeline's names column: eye (alt click shows only that layer: every other layer hidden, its groups shown, the layers inside it as they were, one history step from `ops::solo`, also Layer > Show only this and `klad solo`; alt clicking it again restores what was shown before), lock, the kind icon, the name (double-click renames it in that row; Return keeps, Esc leaves), clip and lock alpha marks, a mask chip (click paints on the mask, alt click turns it on or off, right-click opens its row in the timeline), in the timeline the onion dot and a fold caret on groups, in the pane a 40 by 28 thumbnail of the layer at the current frame (box filtered from its tiles, alpha boosted by a square root so thin ink still shows, cached per drawing and document revision, made by a background job: a row shows its last thumbnail until the new one is ready). Dragging a row moves the layer: the top or bottom half of a row puts it above or below, the middle half of a group puts it inside (the row lights up), and a mask, a group into itself or a drop beside a mask is refused with the reason (`drop_at`); the drop is one `mv` op. The pane's buttons: new paint, vector or group layer above the active one, duplicate (the copy becomes active), put in a new group, delete; the active layer's opacity and blend sit in the pane's title row. Each is one history step.- Timeline layout and drags (M4 batch 3): the header is one toolbar row (fold, a frame field, transport, loop range and its fields, onion and its settings, shift K exposure, fps, length, zoom). Under it the selection toolbar (`editor/cells.rs`): new drawing, duplicate, link (the layer's drawings as thumbnails), unlink, delete, hold shorter, the hold as a field, hold longer, insert and remove a frame on this layer or every layer, copy cells, paste cells as copies or as links, retime (a menu: on ones, twos, threes, fit into n, reverse, ping-pong, every layer), in-between, redo in-betweens, new clip. What a press on the grid starts is decided where the press began (`press_at` and `drag_of`, tested): on the ruler it scrubs (shift marks the loop range), near a block's end it changes the hold, on the dot of a block's first cell it moves the block (the cursor is a hand there; since the M4 test only the dot, so a drag from the rest of that cell selects), on any other cell it selects (dragging extends over frames and rows). A hold drag or a move draws the block itself at its new length or place (the moved one faded where it was), not an outline; block labels stop before the grip lines at the block's end. A moved block is a `cel` `move` op, so drawings it lands on are pushed along; alt left and right move the drawing under the playhead by a frame. Clicking a clip's bar opens the clip window (name, loops, own fps, first and last frame as fields, delete, the Godot folder and export). Copied cells are the drawings and holds of the selected rows and frames (or the drawing under the playhead), pasted at the playhead on their own layers as `cel` `dup` or `link` ops in one batch; a drawing that was a link stays a link.- In-between panel (M4 batch 4, `editor/between.rs`): "in-between" (the selection toolbar, the context menu, cmd K) opens a window instead of a menu: the first selected row's two keys as thumbnails with their frames (a frame not loaded yet says so), one on every frame or a count, spacing with the chart an animator draws between keys (key ticks at the ends, a tick per in-between where the spacing puts it), pairing (id, order, nearest shape; parts both keys have are named, they pair first), marks in one key only (leave, pop, fade, draw-on), and "make the in-betweens", which runs `klad inbetween` as a job (`between::args`). When the job ends its output is parsed into rows (`between::report`): each layer's pairs, parts and touching ends; an unpaired mark is a button that goes to the other key's frame, turns on the stroke tool and waits for one stroke to be picked, then makes the in-betweens again with that pair added to `--pair` (`pair_from`); a fill left out goes to its frame. "Check what a redo would remake" lists the in-betweens of the selection (or all) with their state from their marks' hash and authors (`redo_rows`): remade, drawn on by hand (keep them on top, the default; in-between them too; leave it) or edited (in-between it again, or leave it, the default); "redo them" runs one `klad inbetween --redo --only ... --keep-cels ... --force-cels ...`, one history step.- History (M4 batch 4, `editor/history.rs`): the History pane lists the redo stack (as "undone" with who made the step, farthest first), a "the document is here" marker and the undo stack, latest first: who (you for the editor, the agent for the CLI), what, how long ago. Clicking a row undoes or redoes as many steps as it takes to stand right after it (`steps_to`), timed in the status line. The list is read again when the document's revision changes.diff --git a/docs/cli.md b/docs/cli.mdindex 4803047..cb462d6 100644--- a/docs/cli.md+++ b/docs/cli.md@@ -44,6 +44,7 @@ This reference is licensed under the MIT License (`LICENSE-MIT`), unlike klad it- [`klad scatter`](#klad-scatter): Scatter copies of a small mark over a shape: grass, cracks, dots- [`klad foliage`](#klad-foliage): Paint closed shapes as clumps of leaves, lit as forms- [`klad bone`](#klad-bone): Add, remove, rename, move or reparent a bone of a layer's or group's skeleton+- [`klad solo`](#klad-solo): Show only one layer: hide every other layer (its groups stay shown, its own layers as they are)- [`klad bones`](#klad-bones): List the skeletons, their bones and weights, and the posed drawings- [`klad weights`](#klad-weights): Set how much each bone moves each part of the drawing: automatic, painted dabs, a whole part, smoothed- [`klad pose`](#klad-pose): Pose a drawing with its bones: a new drawing at --to, bent from the rest drawing at --from@@ -2177,6 +2178,39 @@ Options:Print help (see a summary with '-h')```+## klad solo++```text+Show only one layer: every other layer is hidden, the groups it is in stay shown and the layers inside it keep their own visibility, in one step that klad undo takes back. The editor's alt click on a layer's eye does the same.++ klad solo art.klad lines++Usage: klad solo [OPTIONS] <BUNDLE> <LAYER>++Arguments:+ <BUNDLE>+++ <LAYER>+++Options:+ --render+ Render a preview after the edit and print its path++ --scale <SCALE>+ Preview scale (default: longest side 1024 px)++ --json+ Print the result as JSON++ --overlay <OVERLAY>+ Draw on the preview: ids, bbox, grid or all (comma separated)++ -h, --help+ Print help (see a summary with '-h')+```+## klad bones```textdiff --git a/docs/skill/SKILL.md b/docs/skill/SKILL.mdindex 7e6831d..a6e91c7 100644--- a/docs/skill/SKILL.md+++ b/docs/skill/SKILL.md@@ -6,7 +6,7 @@ description: Make and edit 2D art with the klad CLI (`klad`) in a `.klad` bundle# klad-A `.klad` bundle is a folder: `doc.json` (layers, cels, vector nodes, palette), `strokes/<layer>/<cel>.strokes` (paint strokes and fills as data), `brushes/<id>.json` (every brush its strokes use) and `.cache/` (renders, history, notes, tiles). The `klad` CLI edits it; the user edits the same bundle in the editor (`klad open`, or the klad app). Both see each other's changes within a second. The user starts and opens drawings from the editor's start window (cmd N, cmd O, recent) and can copy a drawing's path from File (the menu bar) or the document menu at the bottom of the tool strip to hand it to you. To start one yourself: `klad new art.klad --width 1600 --height 1200 --background '#e9e4da' --sketch` (one paint layer, `l1`, and a vector layer named sketch on top, `l3`). If `klad` is not on the path, the user can run "install the klad command" from that menu (or `klad install` from the folder they unpacked); `klad skill` prints these instructions, matching the version installed. When klad itself fails (an error that starts "klad hit a bug"), tell the user and offer `klad report --drawing <bundle>`: it prints a report for an issue and zips the drawing to attach. `klad samples` lists the sample drawings that come with klad, and `klad samples --copy lantern` copies one into the current folder to read, render or draw on: a quick way to see how a finished piece is layered.+A `.klad` bundle is a folder: `doc.json` (layers, cels, vector nodes, palette), `strokes/<layer>/<cel>.strokes` (paint strokes and fills as data), `brushes/<id>.json` (every brush its strokes use) and `.cache/` (renders, history, notes, tiles). The `klad` CLI edits it; the user edits the same bundle in the editor (`klad open`, or the klad app). Both see each other's changes within a second. The user starts and opens drawings from the editor's start window (cmd N, cmd O, recent) and can copy a drawing's path from File (the menu bar) or the document menu at the bottom of the tool strip to hand it to you. To start one yourself: `klad new art.klad --width 1600 --height 1200 --background '#e9e4da' --sketch` (one paint layer, `l1`, and a vector layer named sketch on top, `l3`). If `klad` is not on the path, the user can run "install the klad command" from that menu (or `klad install` from the folder they unpacked); `klad skill` prints these instructions, matching the version installed. When klad itself fails (an error that starts "klad hit a bug"), tell the user and offer `klad report --drawing <bundle>`: it prints a report for an issue and zips the drawing to attach. `klad solo art.klad <layer>` hides every other layer, as an alt click on its eye does in the editor; it changes what the user sees, so use it when asked, and look at one layer alone with `klad export art.klad --layer <layer> -o one.png` instead. `klad samples` lists the sample drawings that come with klad, and `klad samples --copy lantern` copies one into the current folder to read, render or draw on: a quick way to see how a finished piece is layered.Working on klad itself: the repository's `CLAUDE.md`, `CONTRIBUTING.md` and `docs/DESIGN.md` are the source of truth. Build the CLI with `just compile` (`just build` also counts the version up, for the person making a build); the binary is `target/release/klad` on macOS and `target/linux/release/klad` on Linux.