A drawing app built for agent/human collaboration
Rust
Bones guide: the bones layer workflow, for someone new to klad
Indicode BV7fe32470d4ab
diff --git a/crates/app/src/editor.rs b/crates/app/src/editor.rsindex 7aaa0d3..c4f84f7 100644--- a/crates/app/src/editor.rs+++ b/crates/app/src/editor.rs@@ -4072,6 +4072,18 @@ impl Editor {props.push(("name".into(), json!(name)));}});+ if layer.kind() == Kind::Bones {+ self.command_check(ui, Cmd::ToggleLocked, "locked");+ let linked = klad_core::rig::painted(&self.scene.bundle.doc, &id).len();+ ui.label(+ egui::RichText::new(format!(+ "{} bones, {linked} layers rigged to them; draw and pose them with the bone tool (J)",+ layer.bones.len()+ ))+ .color(crate::theme::WEAK),+ );+ return self.set(&id, props);+ }ui.horizontal_wrapped(|ui| {self.command_check(ui, Cmd::ToggleLocked, "locked");self.command_check(ui, Cmd::ToggleClip, "clip to layer below");diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rsindex 8253aa2..d954245 100644--- a/crates/app/src/editor/ui_tests.rs+++ b/crates/app/src/editor/ui_tests.rs@@ -4200,7 +4200,11 @@ fn guide_pictures() {ed.go_to(16)?;ed.invoke(Cmd::Onion)}),- ("bones", "rig/rig.klad", "figure", |ed| ed.invoke(Cmd::BoneTool)),+ ("bones", "rig/rig.klad", "bones", |ed| {+ ed.invoke(Cmd::BoneTool)?;+ ed.pick_bone(Some("fore".into()));+ Ok(())+ }),("brush", "lemons/lemons.klad", "lemon-a", |ed| {ed.pick("oil");ed.invoke(Cmd::BrushWindow)diff --git a/docs/guide/bones.md b/docs/guide/bones.mdindex 8d521ac..ecc8d9a 100644--- a/docs/guide/bones.md+++ b/docs/guide/bones.md@@ -1,27 +1,48 @@+_Last updated: 2026-11-08_+# Posing with bones-Instead of redrawing a character on every frame, you can draw it once, give it a skeleton and pose it. The skeleton belongs to a layer or a group, and moves every layer in that group together.+Draw a character once, give it a skeleton and pose it on each frame instead of redrawing it. The skeleton goes on a bones layer of its own, and you tell each drawing layer which bone moves it.-+## Draw a skeleton-1. Put the character's layers (lines, colour, shading) in a group and make the group the active layer.-2. Press J for the bone tool, with "draw" picked in the bar over the canvas.-3. Drag on empty canvas to draw the first bone. The chain carries on from its end: each click adds the next bone, and Esc ends the chain.+1. Click **Layer > New bones layer**.+2. Press **J** and pick **draw** in the bar over the canvas.+3. Drag from the hips to draw the first bone, click to add the next one, and press **Esc** to end the chain.++Each bone hangs from the one before it, and turning a bone turns everything that hangs from it, so start in the middle of the body and work outwards. Alt drag from a bone's end to start a branch there, such as an arm off the spine.++## Attach the drawing to the bones++Draw each part that stays stiff, like an upper arm, a forearm or the head, on its own paint layer. The layers can sit anywhere in the layers panel.-Drag a bone's end or middle to move it, and alt drag from a bone's end to start a child chain there. The skeleton list in the bar picks a bone by name, renames it (Return keeps the name) and changes the bone it hangs from.+1. In **draw**, click a bone to pick it.+2. Open **layers: 0** and tick the layers that move with that bone.-## Paint how much each bone moves the drawing+## Bend a layer across a joint-Switch to "weights". "automatic weights" gives every bone a first set of weights by distance. Cmd click a bone to pick it, then paint its weight onto the drawing: size sets the brush's radius and weight how much each dab gives, and alt paints the weight away. "smooth" blurs every bone's weights a little. Hold rigid things, like a head or a hand, with full weight on one bone, so they don't bend.+Optional, for a part drawn in one piece over a joint, like a sleeve or a tail.++1. In the layers panel, click the layer's bone button and pick **bends with bones**.+2. Pick **weights** in the bar and click **automatic weights**.+3. Cmd click a bone, then paint where it should move the drawing. Alt paints weight away.## Pose it-Switch to "pose", go to a frame and drag a bone's end to turn it; its children follow. "make this pose a drawing" bends the drawing on this frame into the pose, and "back to rest" drops the turns, the move and the targets of this pose. Poses of the same drawing in-between on the bones ([Animating](animating.md)), so a limb swings around its joint instead of sliding.+1. Go to a frame and pick **pose**.+2. Drag a bone's end to turn it. The drawing turns with it as you drag.+3. Click **make this pose a drawing** to keep the pose on this frame.++Nothing is kept until you click it. Poses in-between on the bones ([Animating](animating.md)), so a limb swings around its joint instead of sliding.++## Let a leg reach-## Let a limb reach (IK)+1. In **draw**, pick the shin, open **add IK** and click **make it a limb with thigh**.+2. In **pose**, drag the shin's end. Both bones turn so the foot lands where you drag.-Pick the lower bone of a limb, say a shin, and click "make it a limb with" its parent. In pose mode, dragging the shin's end now turns both bones so the end reaches where you drag, bending the way the leg is drawn, or the other way if you switch it to bend clockwise or counterclockwise. Softness keeps the knee from snapping straight near full reach. "make it an aim" turns one bone alone to point at the target instead. For a pose where you'd rather turn the bones by hand, switch the limb off for that pose, or hold alt while you drag.+## If a part doesn't move-A planted foot is a target that stays where it is while the body moves, which is most of a walk cycle.+- **Turning a bone moves nothing:** the layer isn't rigged. Its bone button in the layers panel is grey; attach it to a bone.+- **Turning the head turns the whole body:** the chain started at the head, so everything hangs from it. In **draw**, pick the head bone and set its **parent** to the neck or the body.diff --git a/docs/images/guide-bones.png b/docs/images/guide-bones.pngindex c77a548..7d76128 100644Binary files a/docs/images/guide-bones.png and b/docs/images/guide-bones.png differ