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:
co-authored by
Claude Opus 5.5
parent
567a947fd8
commit
e6fd1461d7
@@ -86,6 +86,10 @@ fn enable_time_remap(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if !comp.layers.iter().filter(|l| ids.contains(&l.id)).any(remappable) {
|
||||
return Err(bad("layer.enableTimeRemap", "time remapping needs a footage or composition layer"));
|
||||
}
|
||||
// Each layer's source duration (stills have none): a layer extended past it ends its remap
|
||||
// at the source's end, where its last frame starts to hold (After Effects).
|
||||
let src_end: Vec<(LayerId, Tick)> =
|
||||
comp.layers.iter().filter(|l| ids.contains(&l.id)).filter_map(|l| Some((l.id, l.source.item().and_then(|i| s.project.item(i))?.duration()?))).collect();
|
||||
let on = s.edit("Enable Time Remapping", None, |proj, _| {
|
||||
let mut next = proj.next_id;
|
||||
let comp = proj.comp_mut(cid).ok_or(EngineError::NoComp)?;
|
||||
@@ -97,7 +101,13 @@ fn enable_time_remap(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if target && !has {
|
||||
let mut pr = remap_prop(&mut Ids(&mut next));
|
||||
let (lin, lout) = (l.layer_time(l.in_point), l.layer_time(l.out_point));
|
||||
let (a, b) = (lin.min(lout), lin.max(lout));
|
||||
let (a, mut b) = (lin.min(lout), lin.max(lout));
|
||||
if let Some((_, end)) = src_end.iter().find(|(id, _)| *id == l.id)
|
||||
&& lin <= lout
|
||||
&& *end > a
|
||||
{
|
||||
b = b.min(*end);
|
||||
}
|
||||
pr.value = KV::Scalar(source_secs(l, l.in_point));
|
||||
pr.keys = vec![Keyframe::new(a, KV::Scalar(a.seconds())), Keyframe::new(b, KV::Scalar(b.seconds()))];
|
||||
if lin > lout {
|
||||
|
||||
@@ -573,6 +573,22 @@ fn deleting_time_remap_turns_time_remapping_off() {
|
||||
assert_eq!(prop(&s, l, "timeRemap").keys.len(), 1);
|
||||
}
|
||||
|
||||
/// Enable Time Remapping on a layer extended past its source's end (its last frame frozen) puts
|
||||
/// the end key at the source's end, not at the extended out point (#290).
|
||||
#[test]
|
||||
fn time_remap_on_an_extended_layer_ends_at_the_source_end() {
|
||||
let mut s = Session::default();
|
||||
s.execute("comp.new", json!({"name": "Inner", "width": 100, "height": 100, "frameRate": 30, "duration": 2})).unwrap();
|
||||
s.execute("comp.new", json!({"name": "Outer", "width": 100, "height": 100, "frameRate": 30, "duration": 4})).unwrap();
|
||||
let l = s.execute("layer.addItem", json!({"item": "Inner"})).unwrap()["layer"].as_u64().unwrap();
|
||||
s.execute("layer.timing", json!({"layers": [l], "out": 4.0})).unwrap();
|
||||
s.execute("layer.enableTimeRemap", json!({"layers": [l]})).unwrap();
|
||||
let p = prop(&s, l, "timeRemap");
|
||||
let keys: Vec<(f64, KV)> = p.keys.iter().map(|k| (k.time.seconds(), k.value.clone())).collect();
|
||||
assert_eq!(keys, vec![(0.0, KV::Scalar(0.0)), (2.0, KV::Scalar(2.0))]);
|
||||
assert_eq!(s.active_comp().unwrap().layers[0].out_point.seconds(), 4.0, "the layer stays extended");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn freeze_on_last_frame_extends_the_layer() {
|
||||
let (mut s, l) = precomp_setup();
|
||||
|
||||
Reference in New Issue
Block a user