mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-28 09:09:32 +01:00
chore: merge main (timeline and panel fixes) into the outside parity batch (M8)
# Conflicts: # CHANGELOG.md # src/timeline.rs
This commit is contained in:
commit
d52b0f30bb
22 files changed
+954
-114
No files matched your search
@@ -8,6 +8,11 @@ People who have contributed to AniCraft. The repository starts from one initial
|
||||
* lienatanael-dev: the live control port and its MCP bridge (#216).
|
||||
* mypenc: skew in Free Transform (#176).
|
||||
* Davit Matchakhelidze (devius): Georgian in the interface, with Noto Sans Georgian (#160).
|
||||
* Mex (MMexicann): SVG path data, `Math.round` and `Math.min`/`max` signed zeros, affine inverses, documentation; preset files with a byte-order mark, oversized indices, CLI numbers, guide anchors and the Windows build scripts; the Movie Explorer's height (#513) and the layer count clear of the header buttons (#523).
|
||||
* NetterSilver (Silvertree2010): shape tweens that morph a raw shape's line with its fill, dash patterns, colour, easing and script-string parsing; an XFL nested-group regression test; eight-point ovals, smooth anchors that stay smooth when a segment is bent, and non-finite numbers in transforms, paths, scripts and saved files.
|
||||
* Mex (MMexicann): SVG path data, `Math.round` and `Math.min`/`max` signed zeros, affine inverses, documentation.
|
||||
* NetterSilver (Silvertree2010): shape tweens that morph a raw shape's line with its fill, dash patterns, colour, easing and script-string parsing; an XFL nested-group regression test; Trace Bitmap and Convert to Bitmap (#489).
|
||||
* jayzed80: flipped scales in Properties, CLI subcommand help and frame numbering; copy, cut and paste keys on the stage; the frame keys after a click on the ruler (#195).
|
||||
* Mex (MMexicann): SVG path data, `Math.round` and `Math.min`/`max` signed zeros, affine inverses, documentation; preset files with a byte-order mark, oversized indices, CLI numbers, guide anchors and the Windows build scripts.
|
||||
* NetterSilver (Silvertree2010): shape tweens that morph a raw shape's line with its fill, dash patterns, colour, easing and script-string parsing; an XFL nested-group regression test; eight-point ovals, smooth anchors that stay smooth when a segment is bent, and non-finite numbers in transforms, paths, scripts and saved files; the length of very large vectors, a hex colour form that keeps alpha, and a test for SVG path numbers past `f32` (#142, #233, #130).
|
||||
* Mex (MMexicann): SVG path data, `Math.round` and `Math.min`/`max` signed zeros, affine inverses, documentation.
|
||||
|
||||
@@ -52,6 +52,27 @@
|
||||
brings AccessKit 0.27.2 with the fix (AccessKit/accesskit#835). Single-line text fields are now
|
||||
as tall as the buttons beside them, as egui 0.37 draws them.
|
||||
|
||||
* **Timeline and panel bugs from the tracker** (M8, backlog P-009 and P-010, ADR 0131).
|
||||
* **Several layers selected at once** (#512). **Ctrl**-click a layer's name to add it or take
|
||||
it out, **Shift**-click for every layer from the active one, or **Shift+Up** and
|
||||
**Shift+Down** on the focused timeline. Drag any one of them and they all move, landing
|
||||
together in the order they had; the folder button puts them in a new folder; Delete Layer
|
||||
takes them all and asks once. Each is one undo step. Headless: `add: toggle | range` on
|
||||
`layer.select`, `layers: [ids]` on `layer.move` and `layer.delete`, `wrap` on
|
||||
`layer.new_folder`, `layer_selection` in the session state.
|
||||
* **A click on the frame ruler leaves no frames selected** (#195; jayzed80, outside PR #222),
|
||||
also when the playhead stays inside the selection, so **F5** then adds frames on every
|
||||
layer as in Animate. **F6** and **F7** stay on the layer you're on.
|
||||
* **A new mask is locked**, as Animate leaves it (#429): the result shows without the mask's
|
||||
edge in the layer colour. Unlock the mask layer to see the edge and reshape it.
|
||||
* **The "1–9 of 16 layers" count no longer lies over the buttons** in the layer list's header
|
||||
(#523; Mex, outside PR #535). In a column too narrow for it, the heading shows it on hover.
|
||||
* **The Movie Explorer's list uses the whole height of its pane** (#513; Mex, outside PR
|
||||
#532) instead of stopping at about ten rows.
|
||||
* Tests now pin two reports that `main` no longer shows: a click on the fill or stroke square
|
||||
under the tools opens its colour picker (#246), and the docks keep their size while the
|
||||
pointer moves over them at every interface scale (#159, not reproduced; the issue stays
|
||||
open for a retest).
|
||||
* **Text reads right: mixed directions, and letters from a fallback face** (M5, backlog P-008,
|
||||
ADR 0130). With outside pull requests #39 and #40 by SoldierPePe, whose commits are merged
|
||||
here and rebuilt on styled text.
|
||||
|
||||
@@ -382,6 +382,7 @@ pub const NOT_FILES: &[&str] = &[
|
||||
"find.goto",
|
||||
"layer.delete",
|
||||
"layer.move",
|
||||
"layer.new_folder",
|
||||
"layer.set_opacity",
|
||||
"motion.info",
|
||||
"motion.set_path",
|
||||
|
||||
@@ -45,13 +45,13 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
Ok(json!({"frame": f}))
|
||||
}),
|
||||
c("layer.new", "New Layer", "Insert/Timeline", None, "{name?}", true, new_layer),
|
||||
c("layer.new_folder", "New Folder", "Insert/Timeline", None, "{name?}", true, new_folder),
|
||||
c("layer.delete", "Delete Layer", "Modify/Timeline", None, "{layer? (a folder goes with its contents)}", true, delete_layer),
|
||||
c("layer.new_folder", "New Folder", "Insert/Timeline", None, "{name?, wrap?: bool (default: true when several layers are selected: they go into the new folder, which lands where the top one was; false: an empty folder above the active layer)}", true, new_folder),
|
||||
c("layer.delete", "Delete Layer", "Modify/Timeline", None, "{layer? | layers?: [ids] (default: every layer selected in the layer list; a folder goes with its contents)}", true, delete_layer),
|
||||
c("layer.rename", "Rename Layer", "", None, "{name, layer?}", true, rename_layer),
|
||||
c("layer.toggle_visible", "Show/Hide Layer", "", None, "{layer?, on?: bool (default: the other way), all?: true (every layer but the camera, as the eye above the layers: hides them all when all show, else shows them all)}", true, |s, p| toggle(s, p, |l| &mut l.visible, true)),
|
||||
c("layer.toggle_lock", "Lock/Unlock Layer", "", None, "{layer?, on?: bool (default: the other way), all?: true (every layer but the camera, as the padlock above the layers: unlocks them all when all are locked, else locks them all)}", true, |s, p| toggle(s, p, |l| &mut l.locked, false)),
|
||||
c("layer.toggle_outline", "Outline Layer", "", None, "{layer?, on?: bool (default: the other way), all?: true (every layer but the camera, as the square above the layers: back to artwork when all are outlines, else all as outlines)}", true, |s, p| toggle(s, p, |l| &mut l.outline, false)),
|
||||
c("layer.select", "Select Layer", "", None, "{layer: id} or {index}, select?: bool (also select all of its artwork at the playhead, as a click on the layer's name does; nothing on a locked or hidden layer)", false, select_layer),
|
||||
c("layer.select", "Select Layer", "", None, "{layer: id} or {index}, select?: bool (also select all of its artwork at the playhead, as a click on the layer's name does; nothing on a locked or hidden layer), add?: \"toggle\" (Ctrl-click: the layer joins or leaves the layers selected with the active one) | \"range\" (Shift-click: every layer from the active one to this one) → {layer: the active layer, layers: [the selected layers, top to bottom]}", false, select_layer),
|
||||
c("layer.move_up", "Move Layer Up", "Modify/Timeline", None, "{layer?}", true, |s, p| move_layer(s, p, -1)),
|
||||
c("layer.move_down", "Move Layer Down", "Modify/Timeline", None, "{layer?}", true, |s, p| move_layer(s, p, 1)),
|
||||
c(
|
||||
@@ -59,11 +59,11 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Move Layer To",
|
||||
"",
|
||||
None,
|
||||
"{layer?, before?: layer id | after?: layer id | into?: folder id} moves a layer anywhere in the stack, as a drag in the timeline does; a folder, mask or guide moves with everything in it. before / after: it lands just above that layer, or just below it and whatever it holds, beside it (in the same folder, or under the same mask or guide: normal layers only). into: it becomes the first layer in that folder. None of them: the bottom of the stack, outside every folder",
|
||||
"{layer? | layers?: [ids] (default: every layer selected in the layer list; they land together, in the order they had), before?: layer id | after?: layer id | into?: folder id} moves layers anywhere in the stack, as a drag in the timeline does; a folder, mask or guide moves with everything in it. before / after: it lands just above that layer, or just below it and whatever it holds, beside it (in the same folder, or under the same mask or guide: normal layers only). into: it becomes the first layer in that folder. None of them: the bottom of the stack, outside every folder",
|
||||
true,
|
||||
move_layer_to,
|
||||
),
|
||||
c("layer.toggle_mask", "Mask", "Modify/Timeline", None, "{layer?}", true, toggle_mask),
|
||||
c("layer.toggle_mask", "Mask", "Modify/Timeline", None, "{layer?} turns the layer into a mask over the layer below, or back into a normal layer. A new mask is locked: unlocked, its edge shows on the stage in the layer colour, to pick and reshape it", true, toggle_mask),
|
||||
c("layer.set_type", "Layer Type", "", None, "{type: normal|mask|masked|guide|guided, layer?}", true, set_layer_type),
|
||||
c("layer.add_motion_guide", "Add Classic Motion Guide", "Insert/Timeline", None, "{layer?}", true, add_motion_guide),
|
||||
]
|
||||
@@ -87,8 +87,16 @@ fn toggle_mask(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
{
|
||||
Arc::make_mut(below).parent = Some(id);
|
||||
}
|
||||
// The new mask is locked, as Animate leaves it (#429, ADR 0131): the result shows
|
||||
// clean, without the mask's edge in the layer colour. Unlocking it shows the edge, to
|
||||
// pick and reshape the mask.
|
||||
if let Some(mask) = tl.layer_mut(id) {
|
||||
mask.locked = true;
|
||||
}
|
||||
}
|
||||
Ok(layer_type_json(s, id))
|
||||
let mut out = layer_type_json(s, id);
|
||||
out["locked"] = json!(s.timeline().layer(id).is_some_and(|l| l.locked));
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Add Classic Motion Guide: a guide layer above the layer, which the layer then follows.
|
||||
@@ -831,8 +839,62 @@ pub(crate) fn new_layer(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
}
|
||||
|
||||
/// New Folder: an empty folder above the active layer, beside it (never inside a mask).
|
||||
///
|
||||
/// With several layers selected in the layer list (or `wrap`), they go into the new folder,
|
||||
/// which lands where the top one was (#512, ADR 0131).
|
||||
fn new_folder(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
add_layer(s, p, LayerKind::Folder)
|
||||
let selected = s.picked_layers();
|
||||
if !opt_bool(p, "wrap")?.unwrap_or(selected.len() > 1) {
|
||||
return add_layer(s, p, LayerKind::Folder);
|
||||
}
|
||||
let tl = s.timeline();
|
||||
let heads: Vec<LayerId> = block_heads(tl, &selected).into_iter().filter(|id| tl.layer(*id).is_some_and(|l| l.kind != LayerKind::Camera)).collect();
|
||||
let Some(top) = heads.first().copied() else { return add_layer(s, p, LayerKind::Folder) };
|
||||
let was = s.layer;
|
||||
// Above the top one, beside it; then they all move in, in the order they had.
|
||||
s.layer = top;
|
||||
let made = add_layer(s, p, LayerKind::Folder).and_then(|v| {
|
||||
let folder = LayerId(v["layer"].as_u64().unwrap_or(0));
|
||||
let tl = crate::editing::edited_mut(&mut s.doc, s.scene, &s.editing)?;
|
||||
move_blocks(tl, &heads, Landing::Into(folder))?;
|
||||
Ok(json!({"layer": folder.0, "wrapped": heads.len()}))
|
||||
});
|
||||
if made.is_err() {
|
||||
s.layer = was;
|
||||
}
|
||||
made
|
||||
}
|
||||
|
||||
/// The layers a layer command acts on, top to bottom: `layers: [ids]`, else `layer`, else every
|
||||
/// layer selected in the layer list (the active one, and those picked with it; ADR 0131).
|
||||
pub(crate) fn layer_targets(s: &Session, p: &Value) -> Result<Vec<LayerId>> {
|
||||
let ids: Vec<LayerId> = match (opt_u64_list(p, "layers")?, opt_u64(p, "layer")?) {
|
||||
(Some(v), _) if v.is_empty() => return Err(EngineError::Param("param 'layers' must not be empty".into())),
|
||||
(Some(v), _) => v.into_iter().map(LayerId).collect(),
|
||||
(None, Some(id)) => vec![LayerId(id)],
|
||||
(None, None) => return Ok(s.picked_layers()),
|
||||
};
|
||||
let tl = s.timeline();
|
||||
if let Some(gone) = ids.iter().find(|id| tl.layer(**id).is_none()) {
|
||||
return Err(EngineError::State(format!("no layer with id {}", gone.0)));
|
||||
}
|
||||
let ids: std::collections::HashSet<LayerId> = ids.into_iter().collect();
|
||||
Ok(tl.layers.iter().map(|l| l.id).filter(|id| ids.contains(id)).collect())
|
||||
}
|
||||
|
||||
/// Of `ids`, the layers that move on their own: one inside a folder, mask or guide that is also
|
||||
/// in `ids` goes with it. Top to bottom.
|
||||
fn block_heads(tl: &anicraft_doc::Timeline, ids: &[LayerId]) -> Vec<LayerId> {
|
||||
let mut heads = Vec::new();
|
||||
// Rows above this one are inside a block already taken.
|
||||
let mut covered = 0;
|
||||
for (i, l) in tl.layers.iter().enumerate() {
|
||||
if i >= covered && ids.contains(&l.id) {
|
||||
covered = tl.group_range(i).end;
|
||||
heads.push(l.id);
|
||||
}
|
||||
}
|
||||
heads
|
||||
}
|
||||
|
||||
/// The colour the `n`th layer gets (its outline and timeline bar).
|
||||
@@ -881,7 +943,24 @@ fn add_layer(s: &mut Session, p: &Value, kind: LayerKind) -> Result<Value> {
|
||||
/// Deletes a layer; a folder goes with everything in it. A layer masked by a deleted mask
|
||||
/// stays where it is, in the mask's folder.
|
||||
fn delete_layer(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let id = opt_u64(p, "layer")?.map_or(s.layer, LayerId);
|
||||
let ids = layer_targets(s, p)?;
|
||||
let [first, rest @ ..] = ids.as_slice() else { return Err(EngineError::State("no layer to delete".into())) };
|
||||
if rest.is_empty() {
|
||||
return delete_one(s, *first);
|
||||
}
|
||||
// Several at once (the layers selected in the layer list): one undo step, and all or none.
|
||||
let (mut deleted, mut layers) = (Vec::new(), 0);
|
||||
for id in ids {
|
||||
// One inside a folder deleted before it went with the folder.
|
||||
if s.timeline().layer(id).is_some() {
|
||||
layers += delete_one(s, id)?["layers"].as_u64().unwrap_or(0);
|
||||
deleted.push(id.0);
|
||||
}
|
||||
}
|
||||
Ok(json!({"deleted": deleted.first(), "deleted_layers": deleted, "layers": layers}))
|
||||
}
|
||||
|
||||
fn delete_one(s: &mut Session, id: LayerId) -> Result<Value> {
|
||||
let tl = s.timeline();
|
||||
let i = tl.layers.iter().position(|l| l.id == id).ok_or_else(|| EngineError::State(format!("no layer with id {}", id.0)))?;
|
||||
let is_folder = tl.layers.get(i).is_some_and(|l| l.kind == LayerKind::Folder);
|
||||
@@ -957,6 +1036,11 @@ fn select_layer(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if s.timeline().layer(id).is_none() {
|
||||
return Err(EngineError::State(format!("no layer with id {}", id.0)));
|
||||
}
|
||||
if let Some(how) = opt_str(p, "add")? {
|
||||
return extend_layer_selection(s, id, how);
|
||||
}
|
||||
// A plain click: this layer alone.
|
||||
s.layer_sel.clear();
|
||||
// A click on a layer's name in Animate: the layer becomes active with all of its artwork at
|
||||
// the playhead selected (ADR 0044).
|
||||
if opt_bool(p, "select")? == Some(true) {
|
||||
@@ -972,75 +1056,156 @@ fn select_layer(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(json!({"layer": id.0}))
|
||||
}
|
||||
|
||||
/// Ctrl- and Shift-click in the layer list (#512, ADR 0131). `toggle`: the layer joins the
|
||||
/// selected layers or leaves them (the last one stays: a timeline always has an active layer;
|
||||
/// when the active layer leaves, the nearest selected one becomes active). `range`: every layer
|
||||
/// from the active one to this one, the active layer staying the end it is counted from.
|
||||
fn extend_layer_selection(s: &mut Session, id: LayerId, how: &str) -> Result<Value> {
|
||||
let mut sel = s.picked_layers();
|
||||
match how {
|
||||
"toggle" => match sel.iter().position(|l| *l == id) {
|
||||
Some(at) if sel.len() > 1 => {
|
||||
sel.remove(at);
|
||||
if s.layer == id {
|
||||
s.layer = sel.get(at).or(sel.last()).copied().unwrap_or(id);
|
||||
s.selection.clear();
|
||||
}
|
||||
}
|
||||
Some(_) => {}
|
||||
None => sel.push(id),
|
||||
},
|
||||
"range" => {
|
||||
let tl = s.timeline();
|
||||
let at = |l: LayerId| tl.layers.iter().position(|x| x.id == l);
|
||||
let (Some(a), Some(b)) = (at(s.layer), at(id)) else { return Err(EngineError::State("no active layer to count the range from".into())) };
|
||||
sel = tl.layers.iter().skip(a.min(b)).take(a.abs_diff(b) + 1).map(|l| l.id).collect();
|
||||
}
|
||||
other => return Err(EngineError::Param(format!("unknown add '{other}' (toggle or range)"))),
|
||||
}
|
||||
s.layer_sel = sel;
|
||||
Ok(json!({"layer": s.layer.0, "layers": s.picked_layers().iter().map(|l| l.0).collect::<Vec<_>>()}))
|
||||
}
|
||||
|
||||
/// Where moved layers land (`layer.move`).
|
||||
#[derive(Clone, Copy)]
|
||||
enum Landing {
|
||||
/// Just above this layer, beside it.
|
||||
Before(LayerId),
|
||||
/// Just below this layer and whatever it holds, beside it.
|
||||
After(LayerId),
|
||||
/// First inside this folder.
|
||||
Into(LayerId),
|
||||
/// The bottom of the stack, outside every folder.
|
||||
Bottom,
|
||||
}
|
||||
|
||||
/// Moves a layer anywhere in the stack (a drag in the timeline, #407). A folder, mask or guide
|
||||
/// goes with everything in it. The layer lands beside `before` (just above it) or `after` (just
|
||||
/// below it and whatever it holds), with that layer's parent; first inside the folder `into`;
|
||||
/// or at the bottom outside every folder.
|
||||
fn move_layer_to(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let id = opt_u64(p, "layer")?.map_or(s.layer, LayerId);
|
||||
let before = opt_u64(p, "before")?.map(LayerId);
|
||||
let after = opt_u64(p, "after")?.map(LayerId);
|
||||
let into = opt_u64(p, "into")?.map(LayerId);
|
||||
if [before, after, into].iter().flatten().count() > 1 {
|
||||
return Err(EngineError::Param("pass one of before, after and into".into()));
|
||||
}
|
||||
let tl = crate::editing::edited_mut(&mut s.doc, s.scene, &s.editing)?;
|
||||
let pos = |tl: &anicraft_doc::Timeline, l: LayerId| tl.layers.iter().position(|x| x.id == l).ok_or_else(|| EngineError::State(format!("no layer with id {}", l.0)));
|
||||
let i = pos(tl, id)?;
|
||||
let block = tl.group_range(i);
|
||||
let (kind, was_parent) = tl.layers.get(i).map_or((LayerKind::Normal, None), |l| (l.kind, l.parent));
|
||||
if kind == LayerKind::Camera {
|
||||
return Err(EngineError::State("The camera layer stays on top".into()));
|
||||
}
|
||||
// Where it goes: the row it lands above, counted before it leaves (the row count: the
|
||||
// bottom), and its new parent.
|
||||
let (slot, parent) = if let Some(f) = into {
|
||||
let fi = pos(tl, f)?;
|
||||
if tl.layers.get(fi).is_none_or(|l| l.kind != LayerKind::Folder) {
|
||||
return Err(EngineError::State("Only a folder takes layers: pass a folder's id as into".into()));
|
||||
}
|
||||
if block.contains(&fi) {
|
||||
return Err(EngineError::State("A folder can't go inside itself".into()));
|
||||
}
|
||||
(fi + 1, Some(f))
|
||||
} else if let Some(beside) = before.or(after) {
|
||||
let bi = pos(tl, beside)?;
|
||||
if block.contains(&bi) {
|
||||
// Beside itself or something inside it: it is there already.
|
||||
return Ok(json!({"index": i, "parent": was_parent.map(|p| p.0)}));
|
||||
}
|
||||
let parent = tl.layers.get(bi).and_then(|l| l.parent);
|
||||
if kind != LayerKind::Normal && parent.and_then(|p| tl.layer(p)).is_some_and(|p| matches!(p.kind, LayerKind::Mask | LayerKind::Guide)) {
|
||||
return Err(EngineError::State("Only a normal layer can go under a mask or a guide".into()));
|
||||
}
|
||||
(if before.is_some() { bi } else { tl.group_range(bi).end }, parent)
|
||||
} else {
|
||||
(tl.layers.len(), None)
|
||||
let to = match (before, after, into) {
|
||||
(Some(l), None, None) => Landing::Before(l),
|
||||
(None, Some(l), None) => Landing::After(l),
|
||||
(None, None, Some(l)) => Landing::Into(l),
|
||||
(None, None, None) => Landing::Bottom,
|
||||
_ => return Err(EngineError::Param("pass one of before, after and into".into())),
|
||||
};
|
||||
// Folders nest so deep and no deeper: refuse rather than flatten what was dragged.
|
||||
let head = tl.depth(i);
|
||||
let deepest = block.clone().map(|j| tl.depth(j).saturating_sub(head)).max().unwrap_or(0);
|
||||
let ids = layer_targets(s, p)?;
|
||||
let tl = crate::editing::edited_mut(&mut s.doc, s.scene, &s.editing)?;
|
||||
let mut heads = block_heads(tl, &ids);
|
||||
if heads.len() > 1 {
|
||||
// The camera stays on top: selected with others, it is left where it is.
|
||||
heads.retain(|id| tl.layer(*id).is_some_and(|l| l.kind != LayerKind::Camera));
|
||||
}
|
||||
move_blocks(tl, &heads, to)
|
||||
}
|
||||
|
||||
/// Moves the layers `heads` (top to bottom, none inside another), each with everything it
|
||||
/// holds, to `to`: they land together, in the order they had (#512).
|
||||
fn move_blocks(tl: &mut anicraft_doc::Timeline, heads: &[LayerId], to: Landing) -> Result<Value> {
|
||||
let pos = |tl: &anicraft_doc::Timeline, l: LayerId| tl.layers.iter().position(|x| x.id == l).ok_or_else(|| EngineError::State(format!("no layer with id {}", l.0)));
|
||||
let mut blocks = Vec::with_capacity(heads.len());
|
||||
for id in heads {
|
||||
let i = pos(tl, *id)?;
|
||||
if tl.layers.get(i).is_some_and(|l| l.kind == LayerKind::Camera) {
|
||||
return Err(EngineError::State("The camera layer stays on top".into()));
|
||||
}
|
||||
blocks.push(tl.group_range(i));
|
||||
}
|
||||
let Some(first) = blocks.first().cloned() else { return Err(EngineError::State("no layer to move".into())) };
|
||||
let was_parent = tl.layers.get(first.start).and_then(|l| l.parent);
|
||||
// The moved block a row is in, if any.
|
||||
let block_of = |row: usize| blocks.iter().find(|b| b.contains(&row));
|
||||
// Where they go: the row they land above, counted before they leave (the row count: the
|
||||
// bottom), and their new parent.
|
||||
let (slot, parent) = match to {
|
||||
Landing::Into(f) => {
|
||||
let fi = pos(tl, f)?;
|
||||
if tl.layers.get(fi).is_none_or(|l| l.kind != LayerKind::Folder) {
|
||||
return Err(EngineError::State("Only a folder takes layers: pass a folder's id as into".into()));
|
||||
}
|
||||
if block_of(fi).is_some() {
|
||||
return Err(EngineError::State("A folder can't go inside itself".into()));
|
||||
}
|
||||
(fi + 1, Some(f))
|
||||
}
|
||||
Landing::Before(beside) | Landing::After(beside) => {
|
||||
let bi = pos(tl, beside)?;
|
||||
let above = matches!(to, Landing::Before(_));
|
||||
match block_of(bi) {
|
||||
// Beside itself or something inside it: it is there already.
|
||||
Some(_) if blocks.len() == 1 => return Ok(json!({"index": first.start, "parent": was_parent.map(|p| p.0)})),
|
||||
// Beside one of the layers that move: the others gather around it.
|
||||
Some(b) => (if above { b.start } else { b.end }, tl.layers.get(b.start).and_then(|l| l.parent)),
|
||||
None => (if above { bi } else { tl.group_range(bi).end }, tl.layers.get(bi).and_then(|l| l.parent)),
|
||||
}
|
||||
}
|
||||
Landing::Bottom => (tl.layers.len(), None),
|
||||
};
|
||||
let under_mask_or_guide = parent.and_then(|p| tl.layer(p)).is_some_and(|p| matches!(p.kind, LayerKind::Mask | LayerKind::Guide));
|
||||
let new_head = match parent {
|
||||
Some(p) => tl.depth(pos(tl, p)?) + 1,
|
||||
None => 0,
|
||||
};
|
||||
if new_head + deepest >= anicraft_doc::MAX_LAYER_DEPTH {
|
||||
return Err(EngineError::State(format!("Folders nest at most {} deep", anicraft_doc::MAX_LAYER_DEPTH)));
|
||||
for b in &blocks {
|
||||
if under_mask_or_guide && tl.layers.get(b.start).is_some_and(|l| l.kind != LayerKind::Normal) {
|
||||
return Err(EngineError::State("Only a normal layer can go under a mask or a guide".into()));
|
||||
}
|
||||
// Folders nest so deep and no deeper: refuse rather than flatten what was dragged.
|
||||
let head = tl.depth(b.start);
|
||||
let deepest = b.clone().map(|j| tl.depth(j).saturating_sub(head)).max().unwrap_or(0);
|
||||
if new_head + deepest >= anicraft_doc::MAX_LAYER_DEPTH {
|
||||
return Err(EngineError::State(format!("Folders nest at most {} deep", anicraft_doc::MAX_LAYER_DEPTH)));
|
||||
}
|
||||
}
|
||||
// The slot counted among the rows that stay (a slot inside the moved rows is where they
|
||||
// already are: only the parent changes).
|
||||
let at = slot - blocks.iter().map(|b| b.end.min(slot).saturating_sub(b.start.min(slot))).sum::<usize>();
|
||||
let mut moved: Vec<Arc<Layer>> = Vec::new();
|
||||
for b in blocks.iter().rev() {
|
||||
let mut block: Vec<Arc<Layer>> = tl.layers.drain(b.clone()).collect();
|
||||
if let Some(head) = block.first_mut()
|
||||
&& head.parent != parent
|
||||
{
|
||||
Arc::make_mut(head).parent = parent;
|
||||
}
|
||||
block.append(&mut moved);
|
||||
moved = block;
|
||||
}
|
||||
// A slot at the moved rows themselves is where they already are (only the parent changes).
|
||||
let slot = if block.contains(&slot) { block.end } else { slot };
|
||||
let at = if slot >= block.end { slot - block.len() } else { slot };
|
||||
let moved: Vec<Arc<Layer>> = tl.layers.drain(block).collect();
|
||||
let at = at.min(tl.layers.len());
|
||||
tl.layers.splice(at..at, moved);
|
||||
if let Some(l) = tl.layers.get_mut(at)
|
||||
&& l.parent != parent
|
||||
{
|
||||
Arc::make_mut(l).parent = parent;
|
||||
}
|
||||
tl.repair_masks();
|
||||
let Some(id) = heads.first().copied() else { return Ok(json!({})) };
|
||||
let index = pos(tl, id)?;
|
||||
Ok(json!({"index": index, "parent": tl.layers.get(index).and_then(|l| l.parent).map(|p| p.0)}))
|
||||
let mut out = json!({"index": index, "parent": tl.layers.get(index).and_then(|l| l.parent).map(|p| p.0)});
|
||||
if heads.len() > 1 {
|
||||
out["moved"] = json!(heads.len());
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Moves a layer one step. A folder or mask moves with everything in it, past a whole sibling,
|
||||
|
||||
@@ -42,11 +42,6 @@ fn swatches(n: usize) -> String {
|
||||
if n == 1 { "1 swatch".into() } else { format!("{n} swatches") }
|
||||
}
|
||||
|
||||
fn target_layer<'a>(s: &'a Session, p: &Value) -> Option<&'a Layer> {
|
||||
let id = p.get("layer").and_then(Value::as_u64).map_or(s.layer, LayerId);
|
||||
s.timeline().layer(id)
|
||||
}
|
||||
|
||||
fn target_frame(s: &Session, p: &Value) -> u32 {
|
||||
p.get("frame").and_then(Value::as_u64).and_then(|f| u32::try_from(f).ok()).unwrap_or(s.frame)
|
||||
}
|
||||
@@ -361,7 +356,26 @@ pub fn confirmation(s: &Session, id: &str, p: &Value) -> Option<Confirmation> {
|
||||
})
|
||||
}
|
||||
"layer.delete" => {
|
||||
let l = target_layer(s, p)?;
|
||||
// Several layers at once (the layers selected in the layer list, ADR 0131).
|
||||
let ids = crate::cmds_timeline::layer_targets(s, p).ok()?;
|
||||
if ids.len() > 1 {
|
||||
let tl = s.timeline();
|
||||
// Each with what it holds: a folder goes with everything in it.
|
||||
let mut rows = std::collections::BTreeSet::new();
|
||||
for id in &ids {
|
||||
let i = tl.layers.iter().position(|x| x.id == *id)?;
|
||||
let folder = tl.layers.get(i).is_some_and(|l| l.kind == anicraft_doc::LayerKind::Folder);
|
||||
rows.extend(if folder { tl.group_range(i) } else { i..i + 1 });
|
||||
}
|
||||
let (keys, elements) = rows.iter().filter_map(|i| tl.layers.get(*i)).map(|x| layer_content(x)).fold((0, 0), |a, b| (a.0 + b.0, a.1 + b.1));
|
||||
return (elements > 0).then(|| Confirmation {
|
||||
title: "Delete layers?".into(),
|
||||
message: format!("The {} selected hold {} with {}. You can undo this.", plural(rows.len(), "layer"), plural(keys, "keyframe"), plural(elements, "element")),
|
||||
action: "Delete Layers".into(),
|
||||
irreversible: false,
|
||||
});
|
||||
}
|
||||
let l = ids.first().and_then(|id| s.timeline().layer(*id))?;
|
||||
if l.kind == anicraft_doc::LayerKind::Camera {
|
||||
return camera_removal(s, l);
|
||||
}
|
||||
|
||||
@@ -233,3 +233,119 @@ fn the_buttons_above_the_layers_show_lock_and_outline_every_layer() {
|
||||
assert!(s.timeline().layers.iter().filter(|l| l.kind != LayerKind::Camera).all(|l| !l.visible));
|
||||
assert!(s.execute("layer.toggle_visible", &json!({"all": "yes"})).is_err());
|
||||
}
|
||||
|
||||
/// The layers selected in the layer list, by name, top down.
|
||||
fn picked(s: &Session) -> Vec<String> {
|
||||
s.picked_layers().iter().filter_map(|id| s.timeline().layer(*id)).map(|l| l.name.clone()).collect()
|
||||
}
|
||||
|
||||
/// #512: Ctrl-click adds a layer to the selected ones or takes it out, Shift-click takes every
|
||||
/// layer from the active one, and the selection never outlives its active layer.
|
||||
#[test]
|
||||
fn layers_are_selected_together_with_toggle_and_range() {
|
||||
let (mut s, [a, b, c, d, _]) = five();
|
||||
run(&mut s, "layer.select", json!({"layer": b.0}));
|
||||
let r = run(&mut s, "layer.select", json!({"layer": d.0, "add": "range"}));
|
||||
assert_eq!(picked(&s), ["D", "C", "B"]);
|
||||
assert_eq!((r["layer"].as_u64(), r["layers"].as_array().map(Vec::len)), (Some(b.0), Some(3)), "the active layer stays the end the range is counted from");
|
||||
// A second Shift-click counts from the same end, the other way.
|
||||
run(&mut s, "layer.select", json!({"layer": a.0, "add": "range"}));
|
||||
assert_eq!(picked(&s), ["B", "A"]);
|
||||
run(&mut s, "layer.select", json!({"layer": d.0, "add": "toggle"}));
|
||||
run(&mut s, "layer.select", json!({"layer": a.0, "add": "toggle"}));
|
||||
assert_eq!(picked(&s), ["D", "B"]);
|
||||
// The active layer leaves: another selected one becomes active.
|
||||
run(&mut s, "layer.select", json!({"layer": b.0, "add": "toggle"}));
|
||||
assert_eq!((picked(&s), s.layer), (vec!["D".to_string()], d));
|
||||
// The last one stays: there is always an active layer.
|
||||
run(&mut s, "layer.select", json!({"layer": d.0, "add": "toggle"}));
|
||||
assert_eq!((picked(&s), s.layer), (vec!["D".to_string()], d));
|
||||
// A plain click is that layer alone, and so is whatever makes another layer active.
|
||||
run(&mut s, "layer.select", json!({"layer": c.0, "add": "toggle"}));
|
||||
run(&mut s, "layer.select", json!({"layer": d.0}));
|
||||
assert_eq!(picked(&s), ["D"]);
|
||||
run(&mut s, "layer.select", json!({"layer": c.0, "add": "toggle"}));
|
||||
new_layer(&mut s, "F");
|
||||
assert_eq!(picked(&s), ["F"]);
|
||||
assert!(s.execute("layer.select", &json!({"layer": a.0, "add": "sideways"})).is_err());
|
||||
}
|
||||
|
||||
/// #512: the selected layers move as one, landing together in the order they had, wherever the
|
||||
/// drop is: above a layer, below one, on one of themselves, in a folder, or at the bottom.
|
||||
#[test]
|
||||
fn selected_layers_move_together_and_keep_their_order() {
|
||||
let (mut s, [a, b, c, d, e]) = five();
|
||||
run(&mut s, "layer.select", json!({"layer": b.0}));
|
||||
run(&mut s, "layer.select", json!({"layer": d.0, "add": "toggle"}));
|
||||
// No `layer`: the selected ones.
|
||||
let r = run(&mut s, "layer.move", json!({"before": e.0}));
|
||||
assert_eq!(stack(&s), ["D", "B", "E", "C", "A"]);
|
||||
assert_eq!((r["index"].as_u64(), r["moved"].as_u64()), (Some(0), Some(2)));
|
||||
s.undo().unwrap();
|
||||
assert_eq!(stack(&s), ["E", "D", "C", "B", "A"], "one undo step");
|
||||
run(&mut s, "layer.move", json!({"layers": [b.0, d.0], "after": a.0}));
|
||||
assert_eq!(stack(&s), ["E", "C", "A", "D", "B"]);
|
||||
s.undo().unwrap();
|
||||
// Dropped on one of themselves: the others gather around it, still in order.
|
||||
run(&mut s, "layer.move", json!({"layers": [e.0, c.0], "after": c.0}));
|
||||
assert_eq!(stack(&s), ["D", "E", "C", "B", "A"]);
|
||||
s.undo().unwrap();
|
||||
run(&mut s, "layer.move", json!({"layers": [e.0, c.0], "before": c.0}));
|
||||
assert_eq!(stack(&s), ["D", "E", "C", "B", "A"]);
|
||||
s.undo().unwrap();
|
||||
run(&mut s, "layer.move", json!({"layers": [d.0, b.0]}));
|
||||
assert_eq!(stack(&s), ["E", "C", "A", "D", "B"]);
|
||||
s.undo().unwrap();
|
||||
// Into a folder; a folder selected with a layer inside it moves once, with the layer.
|
||||
run(&mut s, "layer.select", json!({"layer": e.0}));
|
||||
let f = new_folder(&mut s, "F");
|
||||
run(&mut s, "layer.move", json!({"layers": [a.0, c.0], "into": f.0}));
|
||||
assert_eq!(stack(&s), ["F", ".C", ".A", "E", "D", "B"]);
|
||||
run(&mut s, "layer.move", json!({"layers": [f.0, a.0, b.0]}));
|
||||
assert_eq!(stack(&s), ["E", "D", "F", ".C", ".A", "B"]);
|
||||
// A folder can't go into itself, and then nothing moves.
|
||||
let before = stack(&s);
|
||||
assert!(s.execute("layer.move", &json!({"layers": [e.0, f.0], "into": f.0})).is_err());
|
||||
assert_eq!(stack(&s), before);
|
||||
}
|
||||
|
||||
/// #512: New Folder with several layers selected puts them in the folder, where the top one
|
||||
/// was; one undo step. With one layer selected the folder is empty, as before.
|
||||
#[test]
|
||||
fn new_folder_takes_the_selected_layers() {
|
||||
let (mut s, [_, b, _, d, _]) = five();
|
||||
run(&mut s, "layer.select", json!({"layer": b.0}));
|
||||
run(&mut s, "layer.select", json!({"layer": d.0, "add": "range"}));
|
||||
let r = run(&mut s, "layer.new_folder", json!({"name": "F"}));
|
||||
assert_eq!(stack(&s), ["E", "F", ".D", ".C", ".B", "A"]);
|
||||
assert_eq!(r["wrapped"], 3);
|
||||
assert_eq!(picked(&s), ["F"], "the folder is the active layer");
|
||||
s.undo().unwrap();
|
||||
assert_eq!(stack(&s), ["E", "D", "C", "B", "A"]);
|
||||
// Asked not to: an empty folder above the active layer.
|
||||
run(&mut s, "layer.select", json!({"layer": b.0}));
|
||||
run(&mut s, "layer.select", json!({"layer": d.0, "add": "toggle"}));
|
||||
run(&mut s, "layer.new_folder", json!({"name": "G", "wrap": false}));
|
||||
assert_eq!(stack(&s), ["E", "D", "C", "G", "B", "A"]);
|
||||
}
|
||||
|
||||
/// #512: Delete Layer takes every selected layer in one undo step, asks once for all of them,
|
||||
/// and refuses as a whole when no layer to draw on would be left.
|
||||
#[test]
|
||||
fn delete_takes_every_selected_layer() {
|
||||
let (mut s, [a, b, c, d, e]) = five();
|
||||
run(&mut s, "draw.rect", json!({"x": 0, "y": 0, "w": 10, "h": 10}));
|
||||
run(&mut s, "layer.select", json!({"layer": b.0}));
|
||||
run(&mut s, "layer.select", json!({"layer": e.0, "add": "toggle"}));
|
||||
let ask = s.confirmation("layer.delete", &json!({})).expect("E holds a rectangle");
|
||||
assert!(ask.message.contains("2 layers"), "{}", ask.message);
|
||||
let r = run(&mut s, "layer.delete", json!({}));
|
||||
assert_eq!(stack(&s), ["D", "C", "A"]);
|
||||
assert_eq!(r["layers"], 2);
|
||||
assert!(s.timeline().layer(s.layer).is_some(), "a layer that is still there is active");
|
||||
s.undo().unwrap();
|
||||
assert_eq!(stack(&s), ["E", "D", "C", "B", "A"]);
|
||||
let all = [a.0, b.0, c.0, d.0, e.0];
|
||||
assert!(s.execute("layer.delete", &json!({"layers": all})).is_err());
|
||||
assert_eq!(stack(&s), ["E", "D", "C", "B", "A"], "all or none");
|
||||
}
|
||||
@@ -401,6 +401,11 @@ pub struct Session {
|
||||
pub frame: u32,
|
||||
/// Active layer.
|
||||
pub layer: LayerId,
|
||||
/// The layers selected together in the layer list (Ctrl- and Shift-click, ADR 0131), the
|
||||
/// active one among them. It counts only while it holds the active layer: anything that
|
||||
/// makes another layer active (a new layer, a click, an undo) leaves the active layer as
|
||||
/// the whole selection. Read it through [`Session::picked_layers`].
|
||||
pub layer_sel: Vec<LayerId>,
|
||||
/// Selected elements at the playhead, each with its layer (ADR 0044).
|
||||
pub selection: Selection,
|
||||
/// Bumped on every document change, undo and redo (UI invalidation).
|
||||
@@ -591,6 +596,7 @@ impl Session {
|
||||
dl_cache: RefCell::new(None),
|
||||
clipboard: cmds_modify::Clipboard::default(),
|
||||
frame_clipboard: cmds_frames::FrameClipboard::default(),
|
||||
layer_sel: Vec::new(),
|
||||
ease_clipboard: None,
|
||||
motion_edit: None,
|
||||
rig_cmd: None,
|
||||
@@ -1126,6 +1132,16 @@ impl Session {
|
||||
self.timeline().layers.iter().position(|l| l.id == self.layer)
|
||||
}
|
||||
|
||||
/// The layers selected in the layer list, top to bottom: the active layer, and those picked
|
||||
/// with it by Ctrl- or Shift-click (ADR 0131) while they are still in this timeline.
|
||||
pub fn picked_layers(&self) -> Vec<LayerId> {
|
||||
if !self.layer_sel.contains(&self.layer) {
|
||||
return vec![self.layer];
|
||||
}
|
||||
let here: Vec<LayerId> = self.timeline().layers.iter().map(|l| l.id).filter(|id| self.layer_sel.contains(id)).collect();
|
||||
if here.contains(&self.layer) { here } else { vec![self.layer] }
|
||||
}
|
||||
|
||||
/// The current scene evaluated at the playhead, cached per `(state, scene, frame)`.
|
||||
pub fn display_list(&self) -> Arc<DisplayList> {
|
||||
let open = self.editing.last().map(|l| (l.open, l.instance, self.editing.len()));
|
||||
@@ -1327,6 +1343,8 @@ impl Session {
|
||||
"scenes": self.doc.scenes.iter().map(|s| json!({"name": s.name, "frames": s.timeline.frame_count()})).collect::<Vec<_>>(),
|
||||
"movie_frames": self.doc.frame_count(),
|
||||
"layer": self.layer.0,
|
||||
// The layers selected in the layer list, the active one among them (ADR 0131).
|
||||
"layer_selection": self.picked_layers().iter().map(|l| l.0).collect::<Vec<_>>(),
|
||||
"selection": self.selection.id_list(),
|
||||
"selection_layers": self.selected_layers().iter().map(|l| l.0).collect::<Vec<_>>(),
|
||||
// The symbols open for editing, outermost first (ADR 0045); `layers` are the open one's.
|
||||
|
||||
@@ -2075,7 +2075,10 @@ fn mask_layers_reveal_hide_pick_and_move_as_a_group() {
|
||||
let bg = px(&s, 500, 500);
|
||||
assert_eq!(px(&s, 10, 10), bg, "masked away");
|
||||
assert_ne!(px(&s, 60, 60), bg, "revealed");
|
||||
run(&mut s, "layer.toggle_lock", json!({"layer": mask.0}));
|
||||
// A new mask is locked, as Animate leaves it (#429): its edge stays off the stage and its
|
||||
// shapes can't be picked until it is unlocked.
|
||||
assert_eq!(r["locked"], true);
|
||||
assert!(s.timeline().layer(mask).is_some_and(|l| l.locked));
|
||||
assert_eq!(s.hit_test(Vec2::new(10.0, 10.0), 0.0), None);
|
||||
assert_eq!(s.hit_test(Vec2::new(60.0, 60.0), 0.0).map(|(l, _)| l), Some(art));
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
# ADR 0131: Several layers selected at once, a ruler that selects no frames, and new masks locked
|
||||
|
||||
* Status: accepted (2026-11-23)
|
||||
* Relates to: backlog items P-009 and P-010 in `docs/roadmap.md`; issues #195, #429, #512, #523,
|
||||
#513, #159, #246, #255; outside pull requests #222, #532 and #535;
|
||||
[ADR 0010](0010-mask-layers.md), [ADR 0044](0044-selection-across-layers.md),
|
||||
[ADR 0061](0061-timeline-polish.md), [ADR 0087](0087-dockable-panels-second-slice.md)
|
||||
|
||||
## Context
|
||||
|
||||
P-009 and P-010 are bug lists. Most of their fixes are small and need no record. Three of them
|
||||
decide how the timeline behaves from now on, and each could reasonably have gone another way.
|
||||
|
||||
1. **#512.** The layer list had one selected layer: the active one. Artists coming from
|
||||
Animate hold Ctrl or Shift to select several, drag them into a folder together, and expect
|
||||
the folder button to gather them.
|
||||
2. **#195.** With frames selected on one layer, a click on the playhead left that selection
|
||||
alone while the playhead stayed inside it, so F5 went on adding frames to one layer. The
|
||||
reference app adds them to every layer after a click on the ruler. Outside PR #222 fixed it
|
||||
by selecting the playhead's frame on every layer.
|
||||
3. **#429.** A new mask shows its edge on the stage in the layer colour, because its layer is
|
||||
unlocked. The reporter read the edge as a rendering fault.
|
||||
|
||||
## Decisions
|
||||
|
||||
### The selected layers are session state, valid only while they hold the active layer
|
||||
|
||||
`Session::layer_sel` lists the layers picked together; `Session::picked_layers()` is how it is
|
||||
read. The list counts only while it contains the active layer and its layers are in the edited
|
||||
timeline; otherwise the active layer alone is selected.
|
||||
|
||||
Many commands set the active layer directly (a new layer, a deleted one, entering a symbol,
|
||||
another scene, undo). Clearing the list in each of them would be a rule every future command
|
||||
has to remember. With the validity rule none of them needs to know the list exists, and a
|
||||
stale list can never make a command act on layers the artist no longer sees as selected.
|
||||
|
||||
The selection is not in the document and not in the undo history, like the active layer and
|
||||
the artwork selection.
|
||||
|
||||
`layer.select` takes `add: "toggle"` (Ctrl-click) and `add: "range"` (Shift-click, counted
|
||||
from the active layer, which stays the anchor, as in a list box). The last layer can't be
|
||||
toggled out: a timeline always has an active layer. The shell adds Shift+Up and Shift+Down on
|
||||
the focused timeline, so the selection can be made without a pointer.
|
||||
|
||||
### Which commands act on the selection
|
||||
|
||||
`layer.move` and `layer.delete` act on `layers: [ids]`, else `layer`, else the selected layers.
|
||||
Both stay one undo step and are all or none. Moved layers land together in the order they had;
|
||||
a layer selected along with the folder or mask that holds it moves once, inside it; the camera
|
||||
layer, selected with others, stays on top.
|
||||
|
||||
`layer.new_folder` puts several selected layers into the new folder, which lands where the top
|
||||
one was. **This departs from the reference app**, where New Folder always makes an empty
|
||||
folder. The reporter of #512 asked for it, it is what the button does in most layer lists
|
||||
artists also use, and an empty folder above a multi-selection is rarely what was meant.
|
||||
`wrap: false` gives the empty folder; with one layer selected nothing changes.
|
||||
|
||||
The row toggles (eye, padlock, outline, onion) and Move Layer Up and Down still act on one
|
||||
layer. Layer Properties for several layers is P-027.
|
||||
|
||||
### A click on the ruler leaves no frames selected
|
||||
|
||||
The ruler is not a frame of any one layer, so a click or a drag on it drops the frame
|
||||
selection, also when the playhead stays inside it. The frame keys then follow the rule `main`
|
||||
already had for "no frames selected" (#242, #438): F5, Shift+F5 and Shift+F6 act on every layer
|
||||
that reaches the playhead, and F6 and F7 on the active layer.
|
||||
|
||||
PR #222's approach (select the playhead's frame on every layer) is merged for its test and
|
||||
credit and then changed, for two reasons:
|
||||
|
||||
* After any scrub, F7 would have put a blank keyframe on every layer and Shift+F6 cleared a
|
||||
keyframe on every layer. Scrubbing is the most common thing done on a timeline; a key
|
||||
pressed after it must not empty the stage.
|
||||
* It also sent Ctrl+C and Ctrl+X to the frames instead of the selected artwork after a scrub.
|
||||
|
||||
### A new mask is locked
|
||||
|
||||
`layer.toggle_mask` locks the mask layer it makes, as the reference app does and as the SVG
|
||||
importer already did. The rule of [ADR 0010](0010-mask-layers.md) stays: an unlocked mask
|
||||
shows its edge in the layer colour, so it can be seen, picked and reshaped; a locked one shows
|
||||
only its result. The masked layer is not locked: in AniCraft the mask applies whether or not
|
||||
the layers are locked, so locking the artwork would only be in the way.
|
||||
|
||||
Hiding the edge unless the mask layer is active was considered and rejected: an unlocked
|
||||
mask's shapes can be picked on the stage, and something that can be picked must be visible.
|
||||
|
||||
`layer.set_type` and Layer Properties do not lock: there the type is one field among several
|
||||
the artist is setting by hand.
|
||||
|
||||
## Not reproduced
|
||||
|
||||
* **#159** (a side dock that grows under the pointer at interface scales of 85, 95, 110, 135,
|
||||
160, 170 and 185 %, reported on 0.2.1). On `main` the stage's rectangle did not move in 54
|
||||
combinations of screen density, window size and interface scale, nor with content wider
|
||||
than the dock. A dock's size comes from egui's panel state, which grows only when what is
|
||||
inside is wider than the panel; [ADR 0087](0087-dockable-panels-second-slice.md) holds every
|
||||
panel's content to the dock's width. A test now pins that at the reported scales. The issue
|
||||
stays open for the reporters to retest on a current build.
|
||||
* **#255** (the window flickers after it regains focus, Intel Arc). It needs the machine.
|
||||
Preferences › Window graphics was added for it earlier; nothing changes here.
|
||||
|
||||
## Consequences
|
||||
|
||||
* Commands that take `layer?` and should act on several layers have one helper,
|
||||
`cmds_timeline::layer_targets`.
|
||||
* Scripts that ran `layer.toggle_mask` and then edited the mask layer must unlock it first
|
||||
(`layer.toggle_lock {on: false}`); the command's result says `locked: true`.
|
||||
* `anicraft-cli info` and the MCP state report `layer_selection`.
|
||||
@@ -17,7 +17,9 @@ wipe, or text that reveals a picture.
|
||||
2. Make a new layer right above it and draw the mask shape there, with a fill.
|
||||
3. Right-click the mask layer and choose **Mask** (or choose **Modify › Timeline › Mask**).
|
||||
|
||||
The layer below becomes **masked**: it's indented under the mask, which gets a stencil icon. To
|
||||
The layer below becomes **masked**: it's indented under the mask, which gets a stencil icon.
|
||||
The new mask layer is **locked**, as Animate leaves it, so you see the result and nothing else.
|
||||
Click its padlock when you want to move or reshape the mask. To
|
||||
mask more layers with the same mask, right-click each layer right under the group and choose
|
||||
**Masked**, or move it in under the mask with the up and down buttons. Moving a layer out of the
|
||||
group takes it out of the mask.
|
||||
@@ -27,8 +29,10 @@ group takes it out of the mask.
|
||||
* Only the mask's **fills** count. Strokes, and the mask artwork's opacity, are ignored.
|
||||
* The mask always applies, on the stage and in every export, so what you see is what you get.
|
||||
If you're coming from Animate, there's no need to lock both layers to preview it.
|
||||
* While the mask layer is unlocked, its shapes' edges show in the layer colour, so you can select
|
||||
and reshape them. Lock the mask layer to hide the edge.
|
||||
* While the mask layer is unlocked, its shapes' edges show on the stage in the layer colour, so
|
||||
you can select and reshape them. Lock the mask layer to hide the edge: a mask you've just
|
||||
made, or one that came in with an SVG, is locked already. The edge is only there while you
|
||||
edit; it's never in Test Movie or an export.
|
||||
* Parts of the masked artwork that are hidden can't be picked on the stage.
|
||||
* Hiding the mask layer turns the mask off.
|
||||
* The mask layer's artwork can have keyframes and tweens like any other layer, for moving
|
||||
|
||||
@@ -255,7 +255,8 @@ Elements on locked layers are listed but can't be selected.
|
||||
### The timeline with the keyboard
|
||||
|
||||
With the timeline focused, **Left** and **Right** move the playhead one frame, and **Up** and
|
||||
**Down** move to the layer above or below. Each move is announced, for example "Frame 12 · Ball ·
|
||||
**Down** move to the layer above or below. **Shift+Up** and **Shift+Down** select one more layer
|
||||
(or one fewer), and the status bar says how many are selected. Each move is announced, for example "Frame 12 · Ball ·
|
||||
Frames 1–24: keyframe · motion tween". The usual keys work too: **,** and **.** for the previous
|
||||
and next frame, **Home** and **End**, and **F5**, **F6** and **F7** to insert.
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ This page is generated from the command registry, so it always matches the versi
|
||||
- **New Layer** `layer.new` · Insert › Timeline · changes the document
|
||||
Parameters: `{name?}`
|
||||
- **New Folder** `layer.new_folder` · Insert › Timeline · changes the document
|
||||
Parameters: `{name?}`
|
||||
Parameters: `{name?, wrap?: bool (default: true when several layers are selected: they go into the new folder, which lands where the top one was; false: an empty folder above the active layer)}`
|
||||
- **Add Classic Motion Guide** `layer.add_motion_guide` · Insert › Timeline · changes the document
|
||||
Parameters: `{layer?}`
|
||||
- **Add Camera** `camera.add` · Insert › Timeline · changes the document
|
||||
@@ -161,13 +161,13 @@ This page is generated from the command registry, so it always matches the versi
|
||||
- **Envelope** `modify.envelope` · Modify › Transform
|
||||
Parameters: `{} opens an envelope around the selected shapes and drawing objects on the active layer (ADR 0080): a mesh of 4 × 4 Bézier control points over their bounds, at rest → {points: [[x, y] × 16] (row by row from the top-left), bounds: [x, y, w, h], shapes}. Then modify.envelope_move bends them. Symbols, text, groups and bitmaps can't be bent: break them apart first`
|
||||
- **Delete Layer** `layer.delete` · Modify › Timeline · changes the document
|
||||
Parameters: `{layer? (a folder goes with its contents)}`
|
||||
Parameters: `{layer? | layers?: [ids] (default: every layer selected in the layer list; a folder goes with its contents)}`
|
||||
- **Move Layer Up** `layer.move_up` · Modify › Timeline · changes the document
|
||||
Parameters: `{layer?}`
|
||||
- **Move Layer Down** `layer.move_down` · Modify › Timeline · changes the document
|
||||
Parameters: `{layer?}`
|
||||
- **Mask** `layer.toggle_mask` · Modify › Timeline · changes the document
|
||||
Parameters: `{layer?}`
|
||||
Parameters: `{layer?} turns the layer into a mask over the layer below, or back into a normal layer. A new mask is locked: unlocked, its edge shows on the stage in the layer colour, to pick and reshape it`
|
||||
- **Layer Properties** `layer.set_properties` · Modify › Timeline · changes the document
|
||||
Parameters: `{layer?, name?, type?: normal|mask|masked|guide|guided, mask?: coverage|alpha|luminance (a mask layer's mask type), color?, outline?: bool (view as outlines), height?: 100|200|300, opacity?: 0..100 (percent), visible?, locked?, onion?} sets several at once, as one undo step; answers with the layer's properties`
|
||||
- **Remove Camera** `camera.remove` · Modify › Timeline · changes the document
|
||||
@@ -384,9 +384,9 @@ These commands have no menu item: the panels, the stage and the timeline use the
|
||||
- **Outline Layer** `layer.toggle_outline` · changes the document
|
||||
Parameters: `{layer?, on?: bool (default: the other way), all?: true (every layer but the camera, as the square above the layers: back to artwork when all are outlines, else all as outlines)}`
|
||||
- **Select Layer** `layer.select`
|
||||
Parameters: `{layer: id} or {index}, select?: bool (also select all of its artwork at the playhead, as a click on the layer's name does; nothing on a locked or hidden layer)`
|
||||
Parameters: `{layer: id} or {index}, select?: bool (also select all of its artwork at the playhead, as a click on the layer's name does; nothing on a locked or hidden layer), add?: "toggle" (Ctrl-click: the layer joins or leaves the layers selected with the active one) | "range" (Shift-click: every layer from the active one to this one) → {layer: the active layer, layers: [the selected layers, top to bottom]}`
|
||||
- **Move Layer To** `layer.move` · changes the document
|
||||
Parameters: `{layer?, before?: layer id | after?: layer id | into?: folder id} moves a layer anywhere in the stack, as a drag in the timeline does; a folder, mask or guide moves with everything in it. before / after: it lands just above that layer, or just below it and whatever it holds, beside it (in the same folder, or under the same mask or guide: normal layers only). into: it becomes the first layer in that folder. None of them: the bottom of the stack, outside every folder`
|
||||
Parameters: `{layer? | layers?: [ids] (default: every layer selected in the layer list; they land together, in the order they had), before?: layer id | after?: layer id | into?: folder id} moves layers anywhere in the stack, as a drag in the timeline does; a folder, mask or guide moves with everything in it. before / after: it lands just above that layer, or just below it and whatever it holds, beside it (in the same folder, or under the same mask or guide: normal layers only). into: it becomes the first layer in that folder. None of them: the bottom of the stack, outside every folder`
|
||||
- **Layer Type** `layer.set_type` · changes the document
|
||||
Parameters: `{type: normal|mask|masked|guide|guided, layer?}`
|
||||
- **Onion Skin Layer** `layer.set_onion` · changes the document
|
||||
|
||||
+29
-5
@@ -48,6 +48,25 @@ wheel.
|
||||
Clicking a layer's name makes it the active layer and selects its artwork, as you'd expect from
|
||||
Animate. Right-click a layer for a menu with nearly everything in this section.
|
||||
|
||||
### Selecting several layers
|
||||
|
||||
* **Ctrl**-click a layer's name to add it to the selected layers, or to take it out again.
|
||||
* **Shift**-click a name to select every layer from the active one to it. With the timeline
|
||||
focused, **Shift+Up** and **Shift+Down** do the same one layer at a time.
|
||||
* Click a name without a key to go back to one layer.
|
||||
|
||||
The selected layers are highlighted. Together they can be:
|
||||
|
||||
* **moved**: drag any one of them by its name and they all go, landing together in the order
|
||||
they had. Drop them on a folder to put them all inside;
|
||||
* **put in a new folder**: click the folder button under the list (or **Insert › Timeline › New
|
||||
Folder**). The folder appears where the top one was, with the selected layers in it;
|
||||
* **deleted**: the delete button and **Modify › Timeline › Delete Layer** take them all, after
|
||||
asking once if they hold artwork.
|
||||
|
||||
Each of these is one undo step. The eye, the padlock and the other buttons on a row still act
|
||||
on that row alone, and the up and down buttons move the active layer.
|
||||
|
||||
### Show, lock and outline
|
||||
|
||||
Each layer row has three toggles:
|
||||
@@ -115,7 +134,8 @@ Layer Properties works on one layer at a time. Editing several layers at once is
|
||||
Folders keep big timelines tidy.
|
||||
|
||||
1. Click the folder button under the layer list, or choose **Insert › Timeline › New Folder**.
|
||||
The folder appears above the active layer.
|
||||
The folder appears above the active layer. With
|
||||
[several layers selected](#selecting-several-layers) they go straight into it.
|
||||
2. Drag a layer by its name onto the folder to put it inside, or between two layers of an open
|
||||
folder. Drag it above or below a layer outside the folder to take it out again. (With the up
|
||||
and down buttons: move a layer in under the folder, and off either end to take it out.)
|
||||
@@ -208,10 +228,11 @@ As in Animate, the keys keep you moving along the timeline:
|
||||
* **F6** or **F7** on a frame that is already a keyframe adds the new keyframe on the *next*
|
||||
frame and moves there, so you can draw, press **F6**, draw again, and so on. On any other
|
||||
frame they key the frame you're on.
|
||||
* With no frames selected (for example after scrubbing the playhead), **F5** adds a frame on
|
||||
every layer that has frames at or after the playhead, so the layers stay in step. Layers that
|
||||
end before the playhead are left alone. When no layer reaches the playhead, it lengthens the
|
||||
layer you're on up to it.
|
||||
* With no frames selected (for example after clicking the frame ruler or dragging the
|
||||
playhead), **F5** adds a frame on every layer that has frames at or after the playhead, so
|
||||
the layers stay in step. Layers that end before the playhead are left alone. When no layer
|
||||
reaches the playhead, it lengthens the layer you're on up to it. **Shift+F5** and
|
||||
**Shift+F6** act on every layer there too; **F6** and **F7** key the layer you're on.
|
||||
* With a frame selected, the keys act on that frame's layer, and the selection moves with the
|
||||
playhead.
|
||||
* With several frames selected, **F6** makes every one of them a keyframe of what it showed, and
|
||||
@@ -226,6 +247,9 @@ An empty frame shows a hint in **Properties › Frame**: press **F7** to start d
|
||||
* Click a frame to select it and move the playhead there.
|
||||
* **Shift**-click, or drag across frames, to select a range. A selection can span several
|
||||
layers.
|
||||
* Click the frame ruler, or drag the playhead, to deselect the frames, as in Animate: the
|
||||
ruler isn't a frame of any one layer. **F5** then adds frames on every layer, until you
|
||||
click a frame of one layer again.
|
||||
* **Ctrl+Alt+A** selects every frame.
|
||||
|
||||
The frame keys, the header buttons and the right-click menu all act on the whole selection.
|
||||
|
||||
+3
-3
@@ -233,7 +233,7 @@ not this table, says what matters most.
|
||||
| Feature | Status | Notes |
|
||||
|---|---|---|
|
||||
| Frames, keyframes, blank keyframes: insert, remove, clear | **done** | [timeline](guide/timeline.md). |
|
||||
| Frame selection, drag to move, cut, copy and paste frames | **done** | Open bug: a click on the playhead should act on every layer ([#195](https://github.com/storytold/anicraft/issues/195), outside PR [#222](https://github.com/storytold/anicraft/issues/222), P-009). |
|
||||
| Frame selection, drag to move, cut, copy and paste frames | **done** | A click on the ruler leaves no frames selected, so F5 acts on every layer ([#195](https://github.com/storytold/anicraft/issues/195), [ADR 0131](adr/0131-layer-selection-the-ruler-and-new-masks.md)). |
|
||||
| Span length by dragging | **done** | [ADR 0083](adr/0083-motion-editor-and-timeline-retiming.md). |
|
||||
| Convert to Keyframes | **done** | [#272](https://github.com/storytold/anicraft/issues/272). |
|
||||
| Reverse Frames | **missing** | P-021. |
|
||||
@@ -318,11 +318,11 @@ not this table, says what matters most.
|
||||
|---|---|---|
|
||||
| Normal layers: add, delete, rename, reorder by drag, show, lock, outline | **done** | [#54](https://github.com/storytold/anicraft/issues/54), [#59](https://github.com/storytold/anicraft/issues/59) and [#61](https://github.com/storytold/anicraft/issues/61) can close. |
|
||||
| Layer folders | **done** | |
|
||||
| Mask and masked layers | **done** | Open bug: the mask edge shows in the layer colour when it shouldn't ([#429](https://github.com/storytold/anicraft/issues/429), P-009). |
|
||||
| Mask and masked layers | **done** | A new mask is locked, as in the reference app, so its edge in the layer colour shows only while it is unlocked for editing ([#429](https://github.com/storytold/anicraft/issues/429), [ADR 0131](adr/0131-layer-selection-the-ruler-and-new-masks.md)). |
|
||||
| Soft masks (alpha, luminance) | **ours** | [ADR 0070](adr/0070-soft-masks-and-text-on-a-path.md). |
|
||||
| Guide and motion guide layers | **done** | |
|
||||
| Layer Properties dialog | **done** | [ADR 0061](adr/0061-timeline-polish.md). One layer at a time (P-027; [#464](https://github.com/storytold/anicraft/issues/464)). |
|
||||
| Selecting several layers; acting on them together | **partial** | Open bug [#512](https://github.com/storytold/anicraft/issues/512) (P-009). Dragging several at once is missing. |
|
||||
| Selecting several layers; acting on them together | **partial** | Ctrl-click, Shift-click and Shift+Up/Down select; drag, Delete Layer and New Folder act on them all ([#512](https://github.com/storytold/anicraft/issues/512), [ADR 0131](adr/0131-layer-selection-the-ruler-and-new-masks.md)). Missing: the row toggles and Move Layer Up and Down on several layers, Layer Properties for several (P-027). |
|
||||
| Layer colour, layer height | **done** | |
|
||||
| Layer opacity | **done** | [ADR 0111](adr/0111-the-transformation-point-a-turning-box-and-layer-opacity.md). It shows in exports; an authoring-only transparency is missing. |
|
||||
| Layer parenting | **done** | [ADR 0113](adr/0113-layer-parenting.md). |
|
||||
|
||||
+7
-2
@@ -50,8 +50,11 @@ the changelog.
|
||||
| P-005 | Free Transform works everywhere: rotation on Windows and FreeBSD ([#479](https://github.com/storytold/anicraft/issues/479)), which did not reproduce on Windows 10 (the curved pointer shows outside a corner in the real window; the headless press-and-drag tests pass) and needs the reporter's build number and steps. Done: handles on a skewed symbol ([#117](https://github.com/storytold/anicraft/issues/117), tested end to end), and [#193](https://github.com/storytold/anicraft/issues/193) decided by [ADR 0111](adr/0111-the-transformation-point-a-turning-box-and-layer-opacity.md) with the rule in the guide | Tools | S | the reporter's answer | stage |
|
||||
| P-006 | Animate files open right: lines missing or filled in ([#498](https://github.com/storytold/anicraft/issues/498)), a `.fla` refused on macOS ([#347](https://github.com/storytold/anicraft/issues/347)); each fixed file joins the corpus | Import | M | the reporters' files | xfl |
|
||||
| P-007 | The web build is usable: import, export and save ([#55](https://github.com/storytold/anicraft/issues/55)), preferences kept ([#56](https://github.com/storytold/anicraft/issues/56)), a web asset on each release ([#316](https://github.com/storytold/anicraft/issues/316), [#210](https://github.com/storytold/anicraft/issues/210)), a run in a real browser in CI | Preferences, platforms | M | | platform |
|
||||
| P-008 | Text reads right: mixed directions (outside PR [#39](https://github.com/storytold/anicraft/issues/39)), then letters from a fallback face (outside PR [#40](https://github.com/storytold/anicraft/issues/40)) | Text | M | [#39](https://github.com/storytold/anicraft/issues/39) before [#40](https://github.com/storytold/anicraft/issues/40) | text |
|
||||
| P-010 | Panel bugs still open: a side dock that grows under the pointer ([#159](https://github.com/storytold/anicraft/issues/159): not reproduced on `main`, which a test now pins at the reported interface scales; needs the reporters to retest a current build) and the flicker in [#255](https://github.com/storytold/anicraft/issues/255) (needs the machine; Preferences › Window graphics is the way round it). Fixed: [#513](https://github.com/storytold/anicraft/issues/513), [#246](https://github.com/storytold/anicraft/issues/246) | Workspace | S each | the reporters | shell |
|
||||
| P-011 | Shape tweens morph a raw shape's outline with its fill (outside PR [#238](https://github.com/storytold/anicraft/issues/238)) | Tweens | S | | doc |
|
||||
| P-012 | Small hardening fixes from outside: overflow in `Vec2::length` ([#142](https://github.com/storytold/anicraft/issues/142)), alpha kept by `Rgba::to_hex` ([#233](https://github.com/storytold/anicraft/issues/233)), a test for path numbers past `f32` ([#130](https://github.com/storytold/anicraft/issues/130)), private-use language tags ([#486](https://github.com/storytold/anicraft/issues/486)), a test of SVG link sanitising ([#500](https://github.com/storytold/anicraft/issues/500)) | (robustness) | S each | | several |
|
||||
| P-009 | Timeline bugs: a click on the playhead acts on every layer ([#195](https://github.com/storytold/anicraft/issues/195), outside PR [#222](https://github.com/storytold/anicraft/issues/222)), several layers selected with Ctrl and Shift ([#512](https://github.com/storytold/anicraft/issues/512)), the layer count over the header icons ([#523](https://github.com/storytold/anicraft/issues/523)), the mask edge drawn in the layer colour ([#429](https://github.com/storytold/anicraft/issues/429)) | Timeline, layers | S each | | timeline |
|
||||
| P-010 | Panel bugs: empty space in the Movie Explorer ([#513](https://github.com/storytold/anicraft/issues/513)), a side dock that grows under the pointer ([#159](https://github.com/storytold/anicraft/issues/159)), fill and stroke squares that don't answer ([#246](https://github.com/storytold/anicraft/issues/246)), the flicker in [#255](https://github.com/storytold/anicraft/issues/255) | Workspace | S each | | shell |
|
||||
| P-013 | No hairline between merged curved fills ([#182](https://github.com/storytold/anicraft/issues/182)) | Drawing model | M | | geom |
|
||||
| P-014 | Pen pressure on every desktop: Linux Wayland (outside PR [#320](https://github.com/storytold/anicraft/issues/320)), reports from tablets ([#290](https://github.com/storytold/anicraft/issues/290)) | Tools | M | a tablet to test with | platform |
|
||||
| P-015 | Verified by hand on real machines: the Mac checklist of [ADR 0062](adr/0062-test-movie-window-and-macos-document-opening.md), a hybrid-GPU laptop, passes with Narrator, VoiceOver and Orca ([ADR 0064](adr/0064-accessibility-second-pass.md)), launcher icons on Fedora ([#348](https://github.com/storytold/anicraft/issues/348)) | Accessibility, platforms | M | the machines; the person | platform |
|
||||
@@ -141,7 +144,9 @@ As of 2026-11-24 (46 open):
|
||||
| [#13](https://github.com/storytold/anicraft/issues/13) | Bound the work of evaluating nested symbols | (done) | **superseded by** | The P-002 change ([ADR 0128](adr/0128-one-work-allowance-and-frames-that-say-what-they-left-out.md)), which took its ideas into the allowance `main` already had: layers, symbol lookups and outline sizes count as work, and a frame that ran out says so. Its commits were not merged: they rewrite what [#497](https://github.com/storytold/anicraft/issues/497) rewrote, and its charge of one unit per library entry would cut honest documents with large libraries. Credited in `AUTHORS.md`. |
|
||||
| [#39](https://github.com/storytold/anicraft/issues/39) | Text that mixes directions | (P-008, done) | **superseded by** | Its commits are merged in the P-008 pull request, which rebuilds it on the styled-text layout ([ADR 0130](adr/0130-mixed-directions-and-fallback-faces.md)): lines found in reading order and never inside a cluster, and its tests, are kept; levels and reordering come from `craft-text`. Nothing in it is left out. |
|
||||
| [#40](https://github.com/storytold/anicraft/issues/40) | Letters from a fallback face | (P-008, done) | **superseded by** | Merged and rebuilt with [#39](https://github.com/storytold/anicraft/issues/39) ([ADR 0130](adr/0130-mixed-directions-and-fallback-faces.md)): its family list, the cluster that moves whole with its marks, invisible characters that are never missing and the note about boxes are kept; installed faces outside the list, which it left for later, are searched too. |
|
||||
| [#222](https://github.com/storytold/anicraft/issues/222) | A click on the playhead makes the frame keys act on every layer | P-009 | **planned** | Mergeable and green. Needs a check by hand of the ruler click with a screenshot, since no reviewer ran it. |
|
||||
| [#222](https://github.com/storytold/anicraft/issues/222) | A click on the playhead makes the frame keys act on every layer | P-009 | **merged, changed** | Merged with its commits and its test. The ruler now leaves no frames selected instead of selecting the playhead's frame on every layer, so F6, F7 and Ctrl+C keep acting on one layer and on artwork ([ADR 0131](adr/0131-layer-selection-the-ruler-and-new-masks.md)). |
|
||||
| [#532](https://github.com/storytold/anicraft/issues/532) | The Movie Explorer uses its pane's height | P-010 | **merged** | With a test that fails without it. |
|
||||
| [#535](https://github.com/storytold/anicraft/issues/535) | The layer count clear of the header buttons | P-009 | **merged, fixed** | Its checks failed on a raw size call the typography guideline test refuses; fixed on top, with a test. |
|
||||
| [#238](https://github.com/storytold/anicraft/issues/238) | Morph a shape's stroke with its fill | (done) | **superseded by** | Merged with its commits in the P-011 change. The design question is answered with pictures there: a stroke run belongs to the fill whose edge its middle lies on, and an edge two fills share goes with the lower one. On top of it, a guided shape tween now joins the runs even when both keys have as many. |
|
||||
| [#142](https://github.com/storytold/anicraft/issues/142) | `Vec2::length` overflow | (done) | **superseded by** | Merged with its commit in the P-012 change, then narrowed after measuring: `hypot` alone cost 1.9 ns against 0.83 ns a call, so it is taken only where the squares leave `f32` (0.85 ns, the same results in range). |
|
||||
| [#233](https://github.com/storytold/anicraft/issues/233) | Keep alpha in `Rgba::to_hex` | (done) | **superseded by** | Merged with its commit in the P-012 change, as a function of its own: `to_hex` keeps its six digits for the SVG, HTML and Lottie writers (as merged, the four callers that add their own alpha digits would have written ten), and `to_hex_alpha` is the form that reads back. The Eyedropper's result uses it. |
|
||||
|
||||
+1
-1
@@ -415,7 +415,7 @@ mod tests {
|
||||
#[test]
|
||||
fn the_layer_footer_buttons_fit_and_are_named() {
|
||||
let (t, _, _) = tree(|_, _| {});
|
||||
let names = ["New layer", "Delete layer", "New folder above the active layer (move layers in under it with Up and Down)", "Move layer up", "Move layer down"];
|
||||
let names = ["New layer", "Delete layer", "New folder above the active layer (several selected layers go into it)", "Move layer up", "Move layer down"];
|
||||
let rects: Vec<egui::accesskit::Rect> = names
|
||||
.iter()
|
||||
.map(|n| {
|
||||
|
||||
+44
-2
@@ -1732,6 +1732,24 @@ impl App {
|
||||
}
|
||||
Some("animator") => self.switch_workspace("animator"),
|
||||
Some("designer") => self.switch_workspace("designer"),
|
||||
Some("layerselect") => {
|
||||
// Timeline and panel fixes together (ADR 0131): a new mask (locked, so no edge in
|
||||
// the layer colour on the stage, #429), more layers than rows (the count in the
|
||||
// header, clear of its buttons, #523), three layers picked with Shift and one with
|
||||
// Ctrl (#512), and the Movie Explorer using its pane's height (#513).
|
||||
if let Some(sun) = self.s.timeline().layers.iter().find(|l| l.name == "Sun").map(|l| l.id.0) {
|
||||
self.run("layer.toggle_mask", json!({"layer": sun}));
|
||||
}
|
||||
self.run("layer.select", json!({"index": 0}));
|
||||
for _ in 0..9 {
|
||||
self.run("layer.new", json!({}));
|
||||
}
|
||||
self.run("layer.select", json!({"index": 1}));
|
||||
self.run("layer.select", json!({"index": 3, "add": "range"}));
|
||||
self.run("layer.select", json!({"index": 5, "add": "toggle"}));
|
||||
crate::movie_explorer::open(self);
|
||||
crate::movie_explorer::expand_to(self, 2);
|
||||
}
|
||||
Some("explorer") => {
|
||||
// The Movie Explorer tab (ADR 0058), its first rows open: scene, layers, keyframes
|
||||
// and the instances on them, opening into their symbols.
|
||||
@@ -3729,7 +3747,17 @@ impl App {
|
||||
"edit.undo" => self.status_ok(tr!("Undid {action}", action = crate::i18n::t_dyn(v["undone"].as_str().unwrap_or("")))),
|
||||
"edit.redo" => self.status_ok(tr!("Redid {action}", action = crate::i18n::t_dyn(v["redone"].as_str().unwrap_or("")))),
|
||||
"edit.delete" => self.status_ok(trn!("Deleted {n} element — {undo} to undo", "Deleted {n} elements — {undo} to undo", selected, undo = self.undo_key())),
|
||||
"layer.delete" => self.status_ok(tr!("Deleted layer — {undo} to undo", undo = self.undo_key())),
|
||||
"layer.delete" => match v["deleted_layers"].as_array().map(Vec::len) {
|
||||
Some(n) => self.status_ok(trn!("Deleted {n} layer — {undo} to undo", "Deleted {n} layers — {undo} to undo", n, undo = self.undo_key())),
|
||||
None => self.status_ok(tr!("Deleted layer — {undo} to undo", undo = self.undo_key())),
|
||||
},
|
||||
"layer.new_folder" => {
|
||||
if let Some(n) = v["wrapped"].as_u64() {
|
||||
self.status_ok(trn!("Put {n} layer in a new folder — {undo} to undo", "Put {n} layers in a new folder — {undo} to undo", n, undo = self.undo_key()));
|
||||
}
|
||||
}
|
||||
// A new mask is locked, as Animate leaves it (#429): say how to get at its shape.
|
||||
"layer.toggle_mask" if v["type"] == "mask" && v["locked"] == true => self.status_ok(tr!("Mask made and locked. Unlock the mask layer to see its edge and reshape it.")),
|
||||
"draw.erase_all" => {
|
||||
let n = v["erased"].as_u64().unwrap_or(0);
|
||||
self.status_ok(trn!("Erased everything at frame {frame} ({n} element). {undo} to undo.", "Erased everything at frame {frame} ({n} elements). {undo} to undo.", n, frame = self.s.frame + 1, undo = self.undo_key()));
|
||||
@@ -4365,7 +4393,7 @@ impl App {
|
||||
// On the focused timeline the arrows move the playhead (Left, Right) and the active
|
||||
// layer (Up, Down) instead of nudging artwork (ADR 0064).
|
||||
let on_timeline = surface_focused && crate::a11y::focused_region(ctx) == Some(crate::a11y::Region::Timeline);
|
||||
let (mut frame_step, mut layer_step) = (0i64, 0i64);
|
||||
let (mut frame_step, mut layer_step, mut layer_extend) = (0i64, 0i64, 0i64);
|
||||
ctx.input_mut(|i| {
|
||||
for (m, k, id) in &self.shortcuts {
|
||||
if i.consume_key(*m, *k) {
|
||||
@@ -4392,6 +4420,9 @@ impl App {
|
||||
Key::ArrowUp => layer_step -= 1,
|
||||
_ => layer_step += 1,
|
||||
}
|
||||
} else if on_timeline && matches!(k, Key::ArrowUp | Key::ArrowDown) && i.consume_key(Modifiers::SHIFT, k) {
|
||||
// Shift+Up/Down: one more layer selected, or one fewer (#512).
|
||||
layer_extend += if k == Key::ArrowUp { -1 } else { 1 };
|
||||
} else if i.key_pressed(k) && !i.modifiers.command {
|
||||
nudge += d;
|
||||
}
|
||||
@@ -4454,6 +4485,17 @@ impl App {
|
||||
}
|
||||
}
|
||||
}
|
||||
if layer_extend != 0 {
|
||||
// The selected layers run from the active one to their far end: that end moves.
|
||||
let layers = &self.s.timeline().layers;
|
||||
let picked = self.s.picked_layers();
|
||||
let row = |id: &anicraft_engine::doc::LayerId| layers.iter().position(|l| l.id == *id);
|
||||
if let (Some(at), Some(top), Some(bottom)) = (row(&self.s.layer), picked.first().and_then(row), picked.last().and_then(row)) {
|
||||
let far = if at == top { bottom } else { top };
|
||||
let to = (far as i64 + layer_extend).clamp(0, layers.len() as i64 - 1);
|
||||
timeline::pick_layers(self, json!({"index": to, "add": "range"}));
|
||||
}
|
||||
}
|
||||
if play {
|
||||
self.toggle_play();
|
||||
}
|
||||
|
||||
@@ -1501,6 +1501,44 @@ mod tests {
|
||||
settle(ctx, app);
|
||||
}
|
||||
|
||||
/// #159: the docks keep their size while the pointer moves over them, whatever the interface
|
||||
/// scale. The report names the scales where the right-hand dock crept wider with each
|
||||
/// pointer move (on a 5K screen at 200 %); a dock is only ever as wide as its edge was
|
||||
/// dragged, also when what it shows is wider than it is.
|
||||
#[test]
|
||||
fn the_docks_keep_their_size_under_the_pointer_at_every_interface_scale() {
|
||||
let long: String = "A name far too long for any dock to show on one line. ".repeat(3);
|
||||
for (native, pixels) in [(2.0f32, vec2(5120.0, 2880.0)), (1.0, vec2(1919.0, 1037.0))] {
|
||||
for scale in [0.85f32, 0.95, 1.1, 1.35, 1.6, 1.7, 1.85] {
|
||||
let (mut app, ctx) = app();
|
||||
app.prefs.ui_scale = scale;
|
||||
app.apply_prefs(&ctx);
|
||||
let screen = Rect::from_min_size(egui::Pos2::ZERO, pixels / (native * scale));
|
||||
let run = |app: &mut App, events: Vec<egui::Event>| {
|
||||
let mut input = egui::RawInput { screen_rect: Some(screen), events, ..Default::default() };
|
||||
input.viewports.entry(egui::ViewportId::ROOT).or_default().native_pixels_per_point = Some(native);
|
||||
ctx.run_ui(input, |ui| app.frame(ui)).textures_delta.clear();
|
||||
};
|
||||
// Something wide in every panel: long layer and symbol names, a selection.
|
||||
for l in app.s.timeline().layers.iter().map(|l| l.id).collect::<Vec<_>>() {
|
||||
app.run("layer.rename", serde_json::json!({"layer": l.0, "name": long}));
|
||||
}
|
||||
app.run("edit.select_all", serde_json::json!({}));
|
||||
for _ in 0..6 {
|
||||
run(&mut app, Vec::new());
|
||||
}
|
||||
let stage = app.dock_view.stage.expect("the stage is drawn");
|
||||
assert!(stage.width() > 100.0 && stage.right() < screen.right() - MIN_SIDE + 1.0, "a dock is beside the stage at {scale}: {stage:?} in {screen:?}");
|
||||
// Across the right-hand dock and down it, as a hand moves.
|
||||
for i in 0..30 {
|
||||
let at = egui::pos2(stage.right() + 10.0 + (i % 7) as f32 * 25.0, stage.top() + 20.0 + (i % 11) as f32 * 30.0);
|
||||
run(&mut app, vec![egui::Event::PointerMoved(at)]);
|
||||
assert_eq!(app.dock_view.stage, Some(stage), "the docks moved under the pointer at scale {scale} on a ×{native} screen (move {i})");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn drawn(app: &App, over: Over) -> Option<Drawn> {
|
||||
app.dock_view.drawn.iter().find(|d| d.over == over).copied()
|
||||
}
|
||||
|
||||
@@ -268,3 +268,153 @@ fn brush_settings_come_back_with_the_next_start() {
|
||||
assert!(p.paint_brush_tool.is_some_and(|b| b.size <= 2000.0));
|
||||
assert!(crate::prefs::Prefs::from_json("{}").brush_tool.is_none());
|
||||
}
|
||||
|
||||
/// A click with modifier keys held.
|
||||
fn click_with(ctx: &egui::Context, app: &mut App, at: Pos2, modifiers: Modifiers) {
|
||||
let step = |app: &mut App, events: Vec<Event>| {
|
||||
let mut all = vec![Event::ModifiersChanged(modifiers)];
|
||||
all.extend(events);
|
||||
let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1600.0, 940.0))), events: all, ..Default::default() };
|
||||
ctx.run_ui(input, |ui| app.frame(ui)).textures_delta.clear();
|
||||
};
|
||||
step(app, vec![Event::PointerMoved(at)]);
|
||||
step(app, vec![Event::PointerButton { pos: at, button: PointerButton::Primary, pressed: true, modifiers }]);
|
||||
step(app, vec![Event::PointerButton { pos: at, button: PointerButton::Primary, pressed: false, modifiers }]);
|
||||
settle(ctx, app);
|
||||
}
|
||||
|
||||
/// The layers selected in the layer list, by name, top down.
|
||||
fn picked(app: &App) -> Vec<String> {
|
||||
app.s.picked_layers().iter().filter_map(|id| app.s.timeline().layer(*id)).map(|l| l.name.clone()).collect()
|
||||
}
|
||||
|
||||
/// #512: Ctrl-click and Shift-click on layer names select several layers, a drag that starts on
|
||||
/// one of them moves them all in one undo step, and a plain click is one layer again.
|
||||
#[test]
|
||||
fn several_layers_are_picked_with_ctrl_and_shift_and_dragged_together() {
|
||||
let (mut app, ctx) = opened();
|
||||
assert_eq!(names(&app), ["Ball", "Star", "Sun", "Hills", "Sky"]);
|
||||
let at = on_name(&app, "Star", 0.5);
|
||||
click(&ctx, &mut app, at);
|
||||
let at = on_name(&app, "Hills", 0.5);
|
||||
click_with(&ctx, &mut app, at, Modifiers::COMMAND);
|
||||
assert_eq!(picked(&app), ["Star", "Hills"]);
|
||||
assert_eq!(app.s.active_layer().map(|l| l.name.as_str()), Some("Star"), "the layer clicked first stays the active one");
|
||||
// Dragged by Hills, the one that is not active: both land under Sky, Star first.
|
||||
let undo_before = app.s.history_len();
|
||||
let (from, to) = (on_name(&app, "Hills", 0.5), on_name(&app, "Sky", 0.8));
|
||||
drag(&ctx, &mut app, from, to);
|
||||
assert_eq!(names(&app), ["Ball", "Sun", "Sky", "Star", "Hills"]);
|
||||
assert_eq!(app.s.history_len(), undo_before + 1, "one step");
|
||||
assert_eq!(picked(&app), ["Star", "Hills"], "still selected where they landed");
|
||||
// Ctrl-click again takes a layer out; Shift-click takes every layer from the active one.
|
||||
let at = on_name(&app, "Hills", 0.5);
|
||||
click_with(&ctx, &mut app, at, Modifiers::COMMAND);
|
||||
assert_eq!(picked(&app), ["Star"]);
|
||||
let at = on_name(&app, "Ball", 0.5);
|
||||
click_with(&ctx, &mut app, at, Modifiers::SHIFT);
|
||||
assert_eq!(picked(&app), ["Ball", "Sun", "Sky", "Star"]);
|
||||
// A drag that starts on a layer outside the selection moves that layer alone.
|
||||
let (from, to) = (on_name(&app, "Hills", 0.5), on_name(&app, "Ball", 0.2));
|
||||
drag(&ctx, &mut app, from, to);
|
||||
assert_eq!(names(&app), ["Hills", "Ball", "Sun", "Sky", "Star"]);
|
||||
assert_eq!(picked(&app), ["Hills"]);
|
||||
let at = on_name(&app, "Sun", 0.5);
|
||||
click(&ctx, &mut app, at);
|
||||
assert_eq!(picked(&app), ["Sun"], "a plain click is one layer again");
|
||||
}
|
||||
|
||||
/// The sample with the accessibility tree on.
|
||||
fn opened_with_tree() -> (App, egui::Context) {
|
||||
let (mut app, ctx) = opened();
|
||||
ctx.enable_accesskit();
|
||||
settle(&ctx, &mut app);
|
||||
(app, ctx)
|
||||
}
|
||||
|
||||
/// One more frame (with `events`, in a window `height` tall): every named node, or label with
|
||||
/// its text, and where it is, in points.
|
||||
fn nodes_after(ctx: &egui::Context, app: &mut App, height: f32, events: Vec<Event>) -> Vec<(String, Rect)> {
|
||||
let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1600.0, height))), events, ..Default::default() };
|
||||
let mut out = ctx.run_ui(input, |ui| app.frame(ui));
|
||||
out.textures_delta.clear();
|
||||
let ppp = ctx.pixels_per_point();
|
||||
let nodes = out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default();
|
||||
nodes.into_iter().filter_map(|(_, n)| Some((n.label().or(n.value())?.to_string(), n.bounds().map(|b| Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32) / ppp, pos2(b.x1 as f32, b.y1 as f32) / ppp))?))).collect()
|
||||
}
|
||||
|
||||
fn named_nodes(ctx: &egui::Context, app: &mut App) -> Vec<(String, Rect)> {
|
||||
nodes_after(ctx, app, 940.0, Vec::new())
|
||||
}
|
||||
|
||||
/// #523: the "1–9 of 17 layers" count in the layer list's header never lies over the buttons
|
||||
/// there: the parenting toggle beside the heading and the eye, padlock and square that head
|
||||
/// their columns. In a column too narrow for it the heading carries it instead.
|
||||
#[test]
|
||||
fn the_layer_count_clears_the_header_buttons() {
|
||||
let (mut app, ctx) = opened_with_tree();
|
||||
for _ in 0..12 {
|
||||
app.run("layer.new", serde_json::json!({}));
|
||||
}
|
||||
for width in [crate::prefs::LAYER_W_DEFAULT, *crate::prefs::LAYER_W_RANGE.start(), *crate::prefs::LAYER_W_RANGE.end()] {
|
||||
app.prefs.timeline_layer_w = width;
|
||||
settle(&ctx, &mut app);
|
||||
let nodes = named_nodes(&ctx, &mut app);
|
||||
let find = |name: &str| nodes.iter().find(|(l, _)| l == name).map(|(_, r)| *r).unwrap_or_else(|| panic!("no {name}"));
|
||||
let (count, at) = nodes.iter().find(|(l, _)| l.ends_with("of 17 layers")).cloned().unwrap_or_else(|| panic!("more layers than rows, and no count at width {width}"));
|
||||
for button in ["Parenting view", "Hide all layers", "Lock all layers", "Show all layers as outlines"] {
|
||||
assert!(!at.intersects(find(button)), "{count:?} at {at:?} is over {button} at {:?} (layer column {width} wide)", find(button));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// #513: the Movie Explorer's list uses the height its pane has. With the dock to itself and
|
||||
/// more rows than fit, the last row shown is at the bottom of the pane, not half-way down.
|
||||
#[test]
|
||||
fn the_movie_explorer_list_reaches_the_bottom_of_its_pane() {
|
||||
use crate::dock::Panel;
|
||||
let (mut app, ctx) = opened_with_tree();
|
||||
for _ in 0..60 {
|
||||
app.run("layer.new", serde_json::json!({}));
|
||||
}
|
||||
crate::movie_explorer::open(&mut app);
|
||||
for p in [Panel::Properties, Panel::Align, Panel::Library, Panel::History, Panel::Swatches, Panel::Colour] {
|
||||
app.dock.close(p);
|
||||
}
|
||||
app.dock_changed();
|
||||
settle(&ctx, &mut app);
|
||||
let pane = app.dock_view.drawn.iter().find(|d| d.first == Panel::MovieExplorer).map(|d| d.rect).expect("the Movie Explorer is docked");
|
||||
assert!(pane.height() > 600.0, "the pane has the dock to itself: {pane:?}");
|
||||
let rows: Vec<Rect> = named_nodes(&ctx, &mut app).into_iter().filter(|(l, r)| l.starts_with("Layer: ") && pane.contains(r.center())).map(|(_, r)| r).collect();
|
||||
let row_h = rows.first().map_or(0.0, |r| r.height());
|
||||
let last = rows.iter().map(|r| r.bottom()).fold(0.0, f32::max);
|
||||
assert!(rows.len() < 60, "more rows than fit, so the list scrolls: {} shown", rows.len());
|
||||
assert!(pane.bottom() - last < 2.0 * row_h, "the list ends at {last}, the pane at {} ({} rows of {row_h})", pane.bottom(), rows.len());
|
||||
}
|
||||
|
||||
/// #246: a click on the fill square or the stroke square under the tools opens its colour
|
||||
/// picker (the stroke's square lies over a corner of the fill's, and each takes its own clicks).
|
||||
#[test]
|
||||
fn the_fill_and_stroke_squares_open_their_colour_pickers() {
|
||||
for (square, corner, picker) in [("Fill colour", 1.0, "Fill colour picker"), ("Stroke colour", 0.0, "Colour picker")] {
|
||||
let (mut app, ctx) = opened_with_tree();
|
||||
// A window tall enough to show the squares under the last tool.
|
||||
let tall = 1400.0;
|
||||
let mut nodes = Vec::new();
|
||||
for _ in 0..3 {
|
||||
nodes = nodes_after(&ctx, &mut app, tall, Vec::new());
|
||||
}
|
||||
assert!(!nodes.iter().any(|(l, _)| l == picker), "no picker is open yet");
|
||||
let r = nodes.iter().find(|(l, _)| l == square).map(|(_, r)| *r).unwrap_or_else(|| panic!("no {square} square"));
|
||||
assert!(r.bottom() < tall, "the squares are on screen: {r:?}");
|
||||
// The corner of the square that the other one does not cover.
|
||||
let at = pos2(r.left() + 4.0 + (r.width() - 8.0) * corner, r.top() + 4.0 + (r.height() - 8.0) * corner);
|
||||
nodes_after(&ctx, &mut app, tall, vec![Event::PointerMoved(at)]);
|
||||
nodes_after(&ctx, &mut app, tall, vec![button(at, true)]);
|
||||
nodes_after(&ctx, &mut app, tall, vec![button(at, false)]);
|
||||
for _ in 0..3 {
|
||||
nodes = nodes_after(&ctx, &mut app, tall, Vec::new());
|
||||
}
|
||||
assert!(nodes.iter().any(|(l, _)| l == picker), "a click on {square} opens its picker");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -304,7 +304,7 @@ fn parse_args(args: impl IntoIterator<Item = String>) -> Result<Args, String> {
|
||||
/// `--help` (the console's text, in English).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
// i18n-exempt: the --help console text
|
||||
const HELP: &str = "anicraft [file.anicraft|file.fla|file.xfl] [--version] [--screenshot out.png [--shot-width <px>]] [--renderer gl|wgpu|vulkan|dx12|metal] [--theme dark|light|high-contrast|<file>.json] [--check-theme <file>.json] [--scale <percent>] [--lang <code>|auto|pseudo] [--control <port>] [--open palette|shortcuts|helpbone|lastscene|start|drop|droplibrary|select|selectzoom|about|files|confirm|transform|shapecommands|expandfill|softenfill|tracebitmap|docsettings|origins|pivot|layeropacity|points|merge|rawparts|rawedit|rawsub|rawpoints|rawsnap|rulers|editguides|editgrid|symboledit|groups|combine|nineslice|nineslicedit|brush|brushing|polystar|paintinside|drawingedit|shapeenvelope|brushlibrary|brushcurve|paintbrush|eraser|erasing|erasemerge|tiltbrush|eyedropper|pen|frames|span|bucket|tlzoom|tlwide|motion|motionspan|motionpath|motionpoints|motionedit|motionpins|motionpinsspan|hints|hintsend|camera|cameraview|bones|springbones|shapebones|shapeweights|mixedbones|layerdepth|layerdepthview|filters|strokes|prefs|licenses|zoom|recovery|plugins|actions|script|scriptproblems|testmovie|testmovieinside|testscript|textfields|testtext|htmltext|embedfield|richtext|softmask|pathtext|pathedit|button|testhits|exporthtml|publish|publishreport|publishanim|sound|envelope|ease|easepreset|plugineases|pluginexport|pluginexportwindow|library|librarymenu|libraryfolders|colour|layerprops|frameview|layercolour|timelinepolish|dock|dockicons|floattabs|docknarrow|workspaces|animator|designer|gradient|gradientbucket|swatches|swatchpanel|video|videoimport|datachart|datatable]\n\
|
||||
const HELP: &str = "anicraft [file.anicraft|file.fla|file.xfl] [--version] [--screenshot out.png [--shot-width <px>]] [--renderer gl|wgpu|vulkan|dx12|metal] [--theme dark|light|high-contrast|<file>.json] [--check-theme <file>.json] [--scale <percent>] [--lang <code>|auto|pseudo] [--control <port>] [--open palette|shortcuts|helpbone|lastscene|start|drop|droplibrary|select|selectzoom|about|files|confirm|transform|shapecommands|expandfill|softenfill|tracebitmap|docsettings|origins|pivot|layeropacity|points|merge|rawparts|rawedit|rawsub|rawpoints|rawsnap|rulers|editguides|editgrid|symboledit|groups|combine|nineslice|nineslicedit|brush|brushing|polystar|paintinside|drawingedit|shapeenvelope|brushlibrary|brushcurve|paintbrush|eraser|erasing|erasemerge|tiltbrush|eyedropper|pen|frames|span|bucket|tlzoom|tlwide|motion|motionspan|motionpath|motionpoints|motionedit|motionpins|motionpinsspan|hints|hintsend|camera|cameraview|bones|springbones|shapebones|shapeweights|mixedbones|layerdepth|layerdepthview|filters|strokes|prefs|licenses|zoom|recovery|plugins|actions|script|scriptproblems|testmovie|testmovieinside|testscript|textfields|testtext|htmltext|embedfield|richtext|softmask|pathtext|pathedit|button|testhits|exporthtml|publish|publishreport|publishanim|sound|envelope|ease|easepreset|plugineases|pluginexport|pluginexportwindow|library|librarymenu|libraryfolders|colour|layerprops|frameview|layercolour|timelinepolish|layerselect|dock|dockicons|floattabs|docknarrow|workspaces|animator|designer|gradient|gradientbucket|swatches|swatchpanel|video|videoimport|datachart|datatable]\n\
|
||||
--renderer the window's graphics (also ANICRAFT_RENDERER); default automatic, falling back to OpenGL\n\
|
||||
--theme a built-in look, or a theme file of your own, for this run only\n\
|
||||
--check-theme says whether a theme file would be used (exit 0) or why it is refused (exit 1)\n\
|
||||
|
||||
@@ -228,7 +228,7 @@ fn list(app: &mut App, ui: &mut egui::Ui, t: &Tree) {
|
||||
let mut toggle: Option<String> = None;
|
||||
let mut select: Option<String> = None;
|
||||
let mut go: Option<usize> = None;
|
||||
let room = (ui.available_height() - 8.0).clamp(140.0, 320.0);
|
||||
let room = (ui.available_height() - 8.0).max(0.0);
|
||||
let filtering = !app.explorer.filter.trim().is_empty();
|
||||
egui::ScrollArea::vertical().id_salt("explorer_rows").max_height(room).auto_shrink([false, true]).show_rows(ui, TARGET, t.rows.len(), |ui, range| {
|
||||
for i in range {
|
||||
|
||||
+149
-24
@@ -300,6 +300,14 @@ pub fn join_motion(app: &mut App, to: Option<u32>) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Ctrl- or Shift-click on a layer's name, or Shift+Up/Down on the timeline (#512): runs
|
||||
/// `layer.select` with `add`, and says how many layers are selected now.
|
||||
pub fn pick_layers(app: &mut App, params: serde_json::Value) {
|
||||
if let Some(n) = app.run("layer.select", params).and_then(|v| v["layers"].as_array().map(Vec::len)) {
|
||||
app.status_ok(trn!("{n} layer selected", "{n} layers selected", n));
|
||||
}
|
||||
}
|
||||
|
||||
/// Range params for the frame commands when frames are selected: `{layers, frame, count}`.
|
||||
pub fn range_params(app: &App) -> Option<serde_json::Value> {
|
||||
let sel = app.frame_sel?;
|
||||
@@ -349,6 +357,12 @@ pub fn follow_playhead(app: &mut App) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the "1–9 of 16 layers" count, starting at `left`, clears the parenting toggle that
|
||||
/// ends at `toggle_right` (#523). Otherwise it is not drawn: nothing in the header overlaps.
|
||||
fn layer_count_fits(left: f32, toggle_right: f32) -> bool {
|
||||
left >= toggle_right + 4.0
|
||||
}
|
||||
|
||||
/// The width a layer's name may take: from where it starts to where the row's toggles begin,
|
||||
/// less the room its "has selected artwork" mark needs. Never negative.
|
||||
fn name_room(name_x: f32, toggles_left: f32, mark: f32) -> f32 {
|
||||
@@ -608,22 +622,25 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
painter.rect_filled(Rect::from_min_max(body.left_top(), pos2(grid.left(), ruler.bottom())), 0.0, T.panel_alt);
|
||||
let heading = painter.text(pos2(body.left() + 10.0, ruler.center().y), Align2::LEFT_CENTER, tr!("Layers"), font(Type::Heading), color(Type::Heading));
|
||||
// The parenting view's toggle sits beside the heading, as in Animate (ADR 0113).
|
||||
let header_side = TOGGLE.min(RULER_H);
|
||||
let parent_toggle = Rect::from_center_size(pos2(heading.right() + 8.0 + header_side * 0.5, ruler.center().y), vec2(header_side, header_side));
|
||||
crate::parenting::head_toggle(app, ui, &painter, parent_toggle);
|
||||
// View Only the Active Layer (#529), after it: the other rows go until it is clicked again.
|
||||
let only_toggle = parent_toggle.translate(vec2(header_side + 2.0, 0.0));
|
||||
{
|
||||
let side = TOGGLE.min(RULER_H);
|
||||
crate::parenting::head_toggle(app, ui, &painter, Rect::from_center_size(pos2(heading.right() + 8.0 + side * 0.5, ruler.center().y), vec2(side, side)));
|
||||
// View Only the Active Layer (#529): the other rows go until it is clicked again.
|
||||
let rect = Rect::from_center_size(pos2(heading.right() + 8.0 + side * 1.5 + 2.0, ruler.center().y), vec2(side, side));
|
||||
let on = app.tl_only_active;
|
||||
let r = ui.interact(rect, ui.scope_id().with("only_active_layer"), Sense::click());
|
||||
let r = ui.interact(only_toggle, ui.scope_id().with("only_active_layer"), Sense::click());
|
||||
if r.hovered() || on {
|
||||
painter.rect_filled(rect, T.rc(), if on { T.accent_dim } else { T.hover });
|
||||
painter.rect_filled(only_toggle, T.rc(), if on { T.accent_dim } else { T.hover });
|
||||
}
|
||||
icons::paint(&painter, Rect::from_center_size(rect.center(), vec2(15.0, 15.0)), Icon::ActiveLayer, if on { T.accent_text } else { T.text_dim });
|
||||
icons::paint(&painter, Rect::from_center_size(only_toggle.center(), vec2(15.0, 15.0)), Icon::ActiveLayer, if on { T.accent_text } else { T.text_dim });
|
||||
a11y::control(ui, &r, Role::CheckBox, tr!("View only the active layer"), Some(on));
|
||||
if r.on_hover_text(tr!("View only the active layer: hide the other layers' rows here (they stay on the stage). Click again to show every layer")).clicked() {
|
||||
app.tl_only_active = !on;
|
||||
}
|
||||
}
|
||||
let all_layers_head =
|
||||
|k: f32| Rect::from_center_size(pos2(grid.left() - 16.0 - k * (TOGGLE + 2.0), ruler.center().y), vec2(header_side, header_side));
|
||||
// The eye, the padlock and the square above the columns they head show, lock or outline
|
||||
// every layer at once, as in Animate (#422). Each shows its other face once every layer
|
||||
// is that way, and the next click brings them all back.
|
||||
@@ -634,15 +651,13 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
let any = plain().next().is_some();
|
||||
(any && plain().all(|l| !l.visible), any && plain().all(|l| l.locked), any && plain().all(|l| l.outline))
|
||||
};
|
||||
let side = TOGGLE.min(RULER_H);
|
||||
let head = |k: f32| Rect::from_center_size(pos2(grid.left() - 16.0 - k * (TOGGLE + 2.0), ruler.center().y), vec2(side, side));
|
||||
let hover = ui.input(|inp| inp.pointer.hover_pos());
|
||||
for (k, id, salt, name, away) in [
|
||||
(2.0, "layer.toggle_visible", "eye", if all_hidden { tr!("Show all layers") } else { tr!("Hide all layers") }, all_hidden),
|
||||
(1.0, "layer.toggle_lock", "lock", if all_locked { tr!("Unlock all layers") } else { tr!("Lock all layers") }, all_locked),
|
||||
(0.0, "layer.toggle_outline", "outline", if all_outline { tr!("Show all layers as artwork") } else { tr!("Show all layers as outlines") }, all_outline),
|
||||
] {
|
||||
let r = head(k);
|
||||
let r = all_layers_head(k);
|
||||
if hover.is_some_and(|h| r.contains(h)) {
|
||||
painter.rect_filled(r, T.rc(), T.hover);
|
||||
}
|
||||
@@ -698,6 +713,12 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
&& let Some(p) = ruler_resp.interact_pointer_pos() {
|
||||
app.playing = false;
|
||||
app.run("timeline.goto", json!({"frame": playhead_target(frame_at(p.x), app.s.frame_count())}));
|
||||
// The ruler is no layer's frame: a click or drag on it leaves no frames selected,
|
||||
// also when the playhead stays inside the selection (#195, after outside PR #222).
|
||||
// The frame keys then act as they do with no selection, as in Animate: F5, Shift+F5
|
||||
// and Shift+F6 on every layer that reaches the playhead, F6 and F7 on the active
|
||||
// layer (ADR 0131).
|
||||
app.frame_sel = None;
|
||||
}
|
||||
// The onion menu on a right-click, as the markers live here (ADR 0047).
|
||||
ruler_resp.context_menu(|ui| crate::onion::menu(app, ui));
|
||||
@@ -717,6 +738,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
// rows
|
||||
let layers = app.s.timeline().layers.clone();
|
||||
let active = app.s.layer;
|
||||
// The layers selected together (Ctrl- and Shift-click, #512): the active one among them.
|
||||
let picked = app.s.picked_layers();
|
||||
// Layers with selected artwork show a square in their colour after the name, as in
|
||||
// Animate: a selection can span layers (ADR 0044).
|
||||
let holding = app.s.selection.layers();
|
||||
@@ -749,7 +772,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
drop_rows.push((row, layer.id));
|
||||
let left = Rect::from_min_max(row.left_top(), pos2(grid.left(), row.bottom()));
|
||||
let is_active = layer.id == active;
|
||||
painter.rect_filled(left, 0.0, if is_active { T.accent_dim } else if r % 2 == 0 { T.panel } else { T.panel_alt });
|
||||
let is_picked = is_active || picked.contains(&layer.id);
|
||||
painter.rect_filled(left, 0.0, if is_picked { T.accent_dim } else if r % 2 == 0 { T.panel } else { T.panel_alt });
|
||||
// The layer's colour as a full-height edge bar.
|
||||
painter.rect_filled(Rect::from_min_size(left.left_top(), vec2(4.0, rh)), 0.0, to_color32(layer.color));
|
||||
// Layers are indented under the folders and masks that hold them. Folders carry a
|
||||
@@ -855,7 +879,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
if let Some(col) = parent_col {
|
||||
// The name gives way to the column: what is under it is painted over.
|
||||
let until = attach_t.or(speaker).or(onion_t).unwrap_or(eye).left() - 1.0;
|
||||
painter.rect_filled(Rect::from_min_max(pos2(col.left - 2.0, left.top()), pos2(until.max(col.right), left.bottom())), 0.0, if is_active { T.accent_dim } else if r % 2 == 0 { T.panel } else { T.panel_alt });
|
||||
painter.rect_filled(Rect::from_min_max(pos2(col.left - 2.0, left.top()), pos2(until.max(col.right), left.bottom())), 0.0, if is_picked { T.accent_dim } else if r % 2 == 0 { T.panel } else { T.panel_alt });
|
||||
parent_dots.extend(crate::parenting::row(app, ui, &tl_now, layer, col, left.center().y, tg));
|
||||
}
|
||||
// The name is the row's handle too: drag it to move the layer (#407). The camera stays
|
||||
@@ -863,11 +887,12 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
let nr = ui.interact(name_rect, ui.scope_id().with(("lname", layer.id.0)), if layer.kind == LayerKind::Camera { Sense::click() } else { Sense::click_and_drag() });
|
||||
if nr.drag_started_by(egui::PointerButton::Primary) && layer.kind != LayerKind::Camera {
|
||||
app.tl_layer_drag = Some(layer.id);
|
||||
if app.s.layer != layer.id {
|
||||
// A drag that starts on one of several selected layers takes them all.
|
||||
if !is_picked {
|
||||
app.run("layer.select", json!({"layer": layer.id.0}));
|
||||
}
|
||||
}
|
||||
if app.tl_layer_drag == Some(layer.id) {
|
||||
if app.tl_layer_drag.is_some_and(|d| d == layer.id || (is_picked && picked.contains(&d))) {
|
||||
painter.rect_filled(left, 0.0, T.accent.gamma_multiply(0.18));
|
||||
}
|
||||
// Screen readers hear the row as a selectable item, "Ball · layer", then its toggles.
|
||||
@@ -888,7 +913,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
if faded < 100 && !is_camera {
|
||||
painter.text(pos2(name_rect.right() - 2.0, name_rect.center().y), egui::Align2::RIGHT_CENTER, format!("{faded}%"), crate::theme::font(Type::DataSmall), T.text_faint);
|
||||
}
|
||||
a11y::control(ui, &nr, Role::Button, &row_name, Some(is_active));
|
||||
a11y::control(ui, &nr, Role::Button, &row_name, Some(is_picked));
|
||||
// Ctrl+F6 lands on the active layer, or on the top row shown when it is scrolled away
|
||||
// (rows are drawn top down, so the active row, when drawn, has the last word).
|
||||
if is_active || r == first_row {
|
||||
@@ -960,10 +985,19 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
// As in Animate: a click on the name makes the layer active and selects its artwork.
|
||||
// Ctrl-click adds the layer to the selected ones or takes it out, Shift-click takes
|
||||
// every layer from the active one to it (#512).
|
||||
if nr.clicked() {
|
||||
app.run("layer.select", json!({"layer": layer.id.0, "select": true}));
|
||||
let add = ui.input(|inp| if inp.modifiers.shift { Some("range") } else if inp.modifiers.command { Some("toggle") } else { None });
|
||||
match add {
|
||||
Some(how) => pick_layers(app, json!({"layer": layer.id.0, "add": how})),
|
||||
None => {
|
||||
app.run("layer.select", json!({"layer": layer.id.0, "select": true}));
|
||||
}
|
||||
}
|
||||
}
|
||||
if nr.secondary_clicked() && app.s.layer != layer.id {
|
||||
// A right-click on one of the selected layers keeps them, for the menu to act on.
|
||||
if nr.secondary_clicked() && !is_picked {
|
||||
app.run("layer.select", json!({"layer": layer.id.0}));
|
||||
}
|
||||
if nr.double_clicked() {
|
||||
@@ -1044,7 +1078,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
ui.separator();
|
||||
// Layer type, as check items: Mask (masks the layer below) and Masked.
|
||||
if menus::check_item(ui, tr!("Mask"), layer.kind == LayerKind::Mask, !is_folder) {
|
||||
app.run("layer.toggle_mask", json!({"layer": layer.id.0}));
|
||||
app.request("layer.toggle_mask", json!({"layer": layer.id.0}));
|
||||
}
|
||||
let can_mask = layer.kind == LayerKind::Normal && app.s.timeline().mask_above(i).is_some();
|
||||
if menus::check_item(ui, tr!("Masked"), masked, can_mask || masked) {
|
||||
@@ -1524,6 +1558,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
if let Some(dragged) = app.tl_layer_drag {
|
||||
let (pointer, down, cancel) = ui.input(|i| (i.pointer.latest_pos(), i.pointer.primary_down(), i.key_pressed(egui::Key::Escape)));
|
||||
let index_of = |id: LayerId| tl_now.layers.iter().position(|l| l.id == id);
|
||||
// One of several selected layers takes the others along (#512).
|
||||
let moving: Vec<LayerId> = if picked.contains(&dragged) { picked.clone() } else { vec![dragged] };
|
||||
let targets: Vec<DropRow> = drop_rows
|
||||
.iter()
|
||||
.enumerate()
|
||||
@@ -1536,7 +1572,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
id: *id,
|
||||
folder: tl_now.layers.get(i).is_some_and(|l| l.kind == LayerKind::Folder),
|
||||
first_child: next.filter(|c| index_of(*c).is_some_and(|ci| tl_now.is_inside(ci, *id))),
|
||||
dragged: *id == dragged || tl_now.is_inside(i, dragged),
|
||||
dragged: moving.iter().any(|m| *id == *m || tl_now.is_inside(i, *m)),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -1547,7 +1583,13 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
} else if !down {
|
||||
app.tl_layer_drag = None;
|
||||
if let Some(t) = target {
|
||||
app.run("layer.move", t.params(dragged));
|
||||
let mut p = t.params(dragged);
|
||||
if let [_, _, ..] = moving.as_slice() {
|
||||
p["layers"] = json!(moving.iter().map(|l| l.0).collect::<Vec<_>>());
|
||||
}
|
||||
if let Some(n) = app.run("layer.move", p).and_then(|v| v["moved"].as_u64()) {
|
||||
app.status_ok(trn!("Moved {n} layer — {undo} to undo", "Moved {n} layers — {undo} to undo", n, undo = app.undo_key()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui.ctx().set_cursor_icon(if target.is_some() { egui::CursorIcon::Grabbing } else { egui::CursorIcon::NoDrop });
|
||||
@@ -1662,8 +1704,23 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
let footer = Rect::from_min_max(pos2(body.left(), body.bottom() - FOOTER_H), pos2(grid.left(), body.bottom()));
|
||||
if n_layers > rows_visible {
|
||||
let more = trn!("{first}–{last} of {n} layer", "{first}–{last} of {n} layers", n_layers, first = first_row + 1, last = (first_row + rows_visible).min(n_layers));
|
||||
// In the "Layers" header row, never over a layer row.
|
||||
painter.text(pos2(grid.left() - 8.0, ruler.center().y), Align2::RIGHT_CENTER, more, font(Type::Caption), color(Type::Caption));
|
||||
// In the "Layers" header row, never over a layer row, and in the gap between the
|
||||
// parenting toggle and the buttons that head the columns (#523, outside PR #535). In a
|
||||
// column too narrow for it, the heading says it on hover and to screen readers.
|
||||
let tint = color(Type::Caption);
|
||||
let label = painter.layout_no_wrap(more.clone(), font(Type::Caption), tint);
|
||||
let (lw, lh) = (label.rect.width(), label.rect.height());
|
||||
let at = pos2(all_layers_head(2.0).left() - 4.0 - lw, ruler.center().y - lh * 0.5);
|
||||
let fits = layer_count_fits(at.x, only_toggle.right());
|
||||
let label_rect = Rect::from_min_max(at, pos2(at.x + lw, at.y + lh));
|
||||
if fits {
|
||||
painter.galley(at, label, tint);
|
||||
}
|
||||
let response = ui.interact(if fits { label_rect } else { heading }, ui.scope_id().with("layer_range"), Sense::hover());
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(Role::Label, true, &more));
|
||||
if !fits {
|
||||
response.on_hover_text(more);
|
||||
}
|
||||
}
|
||||
{
|
||||
painter.rect_filled(footer, 0.0, T.panel_alt);
|
||||
@@ -1700,10 +1757,10 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
for (icon, id, tip) in [
|
||||
(Icon::ChevronDown, "layer.move_down", tr!("Move layer down")),
|
||||
(Icon::ChevronUp, "layer.move_up", tr!("Move layer up")),
|
||||
(Icon::FolderPlus, "layer.new_folder", tr!("New folder above the active layer (move layers in under it with Up and Down)")),
|
||||
(Icon::FolderPlus, "layer.new_folder", tr!("New folder above the active layer (several selected layers go into it)")),
|
||||
] {
|
||||
if footer_button(ui, icon, tip, true) {
|
||||
app.run(id, json!({}));
|
||||
app.request(id, json!({}));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2360,6 +2417,74 @@ mod tests {
|
||||
assert!(FrameSel { anchor: (LayerId(9), 0), head: (LayerId(1), 0) }.layers(&ls).is_empty());
|
||||
}
|
||||
|
||||
/// Each layer's length, in frames.
|
||||
fn ends(app: &App) -> Vec<(LayerId, u32)> {
|
||||
app.s.timeline().layers.iter().map(|l| (l.id, l.end_frame())).collect()
|
||||
}
|
||||
|
||||
/// Issue 195: a click on the playhead (the frame ruler) leaves no frames selected, also
|
||||
/// when the playhead stays inside the selection, so F5 adds a frame to every layer; a click
|
||||
/// on one layer's frame goes back to that layer. (Outside PR #222's test, for the behaviour
|
||||
/// ADR 0131 settles on.)
|
||||
#[test]
|
||||
fn a_click_on_the_playhead_makes_frame_keys_act_on_every_layer() {
|
||||
let ctx = egui::Context::default();
|
||||
ctx.enable_accesskit();
|
||||
let mut app = App::with_context(&ctx, anicraft_engine::Session::new(anicraft_engine::doc::sample::demo()), Some(std::path::PathBuf::from("unused.png")));
|
||||
let screen = Rect::from_min_size(egui::Pos2::ZERO, vec2(1600.0, 940.0) / app.prefs.ui_scale);
|
||||
let frame = |app: &mut App, events: Vec<egui::Event>| {
|
||||
let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), events, ..Default::default() }, |ui| app.frame(ui));
|
||||
out.textures_delta.clear();
|
||||
out.platform_output.accesskit_update
|
||||
};
|
||||
let mut tree = None;
|
||||
for _ in 0..3 {
|
||||
tree = frame(&mut app, Vec::new()).or(tree);
|
||||
}
|
||||
let layers: Vec<LayerId> = app.s.timeline().layers.iter().filter(|l| l.kind != LayerKind::Folder).map(|l| l.id).collect();
|
||||
assert!(layers.len() >= 2, "the sample has several layers: {layers:?}");
|
||||
// The second layer is the active one, as after a click on its name, with a stretch of
|
||||
// its frames selected that the click on the ruler lands inside.
|
||||
app.s.layer = layers[1];
|
||||
app.frame_sel = Some(FrameSel { anchor: (layers[1], 0), head: (layers[1], 40) });
|
||||
frame(&mut app, Vec::new());
|
||||
assert!(app.frame_sel.is_some(), "the playhead is inside the selection");
|
||||
// The frame ruler, found by its name for screen readers.
|
||||
let ppp = ctx.pixels_per_point();
|
||||
let ruler = tree
|
||||
.and_then(|t| t.nodes.into_iter().find(|(_, n)| n.label() == Some("Playhead (frame ruler)")))
|
||||
.and_then(|(_, n)| n.bounds())
|
||||
.map(|b| Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32) / ppp, pos2(b.x1 as f32, b.y1 as f32) / ppp))
|
||||
.unwrap_or_else(|| panic!("no frame ruler on screen"));
|
||||
// Click the ruler a little way in (frame 3 or so).
|
||||
let at = pos2(ruler.left() + 40.0, ruler.center().y);
|
||||
let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE };
|
||||
frame(&mut app, vec![egui::Event::PointerMoved(at)]);
|
||||
frame(&mut app, vec![press(true)]);
|
||||
frame(&mut app, vec![press(false)]);
|
||||
frame(&mut app, Vec::new());
|
||||
let f = app.s.frame;
|
||||
assert!(f > 0 && f < 40, "the click moved the playhead, inside the selected stretch: {f}");
|
||||
assert!(app.frame_sel.is_none(), "a click on the ruler leaves no frames selected");
|
||||
let before = ends(&app);
|
||||
let steps = app.s.history_len();
|
||||
app.invoke("timeline.insert_frame");
|
||||
assert_eq!(app.s.history_len(), steps + 1, "one undo step");
|
||||
// The same as F5 on every layer at the playhead.
|
||||
let all = ends(&app);
|
||||
app.s.undo().expect("undo");
|
||||
assert_eq!(ends(&app), before, "one undo takes it all back");
|
||||
app.run("timeline.insert_frame", json!({"layers": layers.iter().map(|l| l.0).collect::<Vec<_>>(), "frame": f}));
|
||||
assert_eq!(all, ends(&app), "F5 after a click on the playhead adds a frame on every layer");
|
||||
app.s.undo().expect("undo");
|
||||
assert!(before.iter().zip(&all).filter(|(b, a)| b != a).count() >= 2, "more than one layer grew: {before:?} → {all:?}");
|
||||
// A click on one layer's frame (what the grid does) acts on that layer only again.
|
||||
app.frame_sel = Some(FrameSel::cell(layers[1], f));
|
||||
app.invoke("timeline.insert_frame");
|
||||
let one = ends(&app);
|
||||
assert_eq!(before.iter().zip(&one).filter(|(b, a)| b != a).map(|(b, _)| b.0).collect::<Vec<_>>(), vec![layers[1]]);
|
||||
}
|
||||
|
||||
use egui::{Event, Modifiers, PointerButton, Pos2};
|
||||
|
||||
/// One frame of the whole app with these events; the cursor it asked for.
|
||||
|
||||
Reference in new issue
Block a user