Timeline: the bar past a layer's source is striped; time remapping it ends at the source's end (#290)

A footage or precomp layer dragged out past its source's end holds its
last frame, but its bar looked the same all the way, so the source's
end couldn't be seen. That part of the bar (and any part before the
source's start) is now darkened and striped in the label colour, with
an automation id (timeline.layer.<id>.bar.afterSource / beforeSource);
with time remapping on, the remap decides what shows there, so it isn't.

Enable Time Remapping on such a layer put its end key at the extended
out point; it now ends at the source's end, where the last frame starts
to hold (After Effects). Trimmed and reversed layers keep their keys.

Tests: time_remap_on_an_extended_layer_ends_at_the_source_end (engine),
the_bar_past_the_source_end_is_striped (ui_timeline_switches).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-09 17:20:42 +07:00
co-authored by Claude Opus 5.5
parent 567a947fd8
commit e6fd1461d7
4 changed files with 81 additions and 2 deletions
+23 -1
View File
@@ -1,6 +1,7 @@
//! Timeline layer switches with real pointer input (egui_kittest): pressing a switch and
//! dragging over other layers gives them all the state the first one got, in one undo step, as
//! in After Effects (#227).
//! in After Effects (#227); stopwatches the same way (#284). Also the layer bar past its source
//! (#290).
use effectcraft_engine::Session;
use effectcraft_engine::project::LayerId;
@@ -144,3 +145,24 @@ fn dragging_over_stopwatches_sets_them_all() {
h.run_steps(2);
assert_eq!(animated(&h), [true; 5], "each drag was one step");
}
/// A layer extended past its source's end (its last frame held) has that part of its bar
/// striped, so the source's own span shows (#290); with time remapping it isn't.
#[test]
fn the_bar_past_the_source_end_is_striped() {
let mut s = Session::default();
s.execute("comp.new", json!({"name": "Inner", "width": 64, "height": 64, "frameRate": 30, "duration": 2})).unwrap();
s.execute("comp.new", json!({"name": "Outer", "width": 64, "height": 64, "frameRate": 30, "duration": 4})).unwrap();
let l = s.execute("layer.addItem", json!({"item": "Inner"})).unwrap()["layer"].as_u64().unwrap();
let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).build_eframe(|_| EffectcraftApp::new(s));
h.run_steps(3);
let past = format!("timeline.layer.{l}.bar.afterSource");
assert!(h.state().auto.find(&past).is_none(), "the source fills the whole bar");
h.state_mut().session.execute("layer.timing", json!({"layers": [l], "out": 4.0})).unwrap();
h.run_steps(2);
let (bar, after) = (rect(&h, &format!("timeline.layer.{l}.bar")), rect(&h, &past));
assert!((after.min.x - bar.center().x).abs() < 2.0 && (after.max.x - bar.max.x).abs() < 1.0, "{bar:?} {after:?}");
h.state_mut().session.execute("layer.enableTimeRemap", json!({"layers": [l]})).unwrap();
h.run_steps(2);
assert!(h.state().auto.find(&past).is_none(), "time remapping decides what shows");
}