Keep footage dropped on the timeline at its full length (#795)
This commit is contained in:
parent
9a7d3e7699
commit
db11dffa18
|
|
@ -295,7 +295,10 @@ fn add_item(s: &mut Session, p: &Value) -> Result<Value> {
|
|||
let mut l = build::layer(proj, &comp, &it.name, src, size, dur);
|
||||
l.start_time = start;
|
||||
l.in_point = start;
|
||||
l.out_point = fr.snap_nearest((start + dur.unwrap_or(comp.duration)).min(comp.duration)).max(start + fr.frame_duration());
|
||||
// Footage and precomps keep their full length past the comp's end (After Effects); items
|
||||
// without a duration (solids, comp-length stills) end with the comp.
|
||||
let end = dur.map_or((start + comp.duration).min(comp.duration), |d| start + d);
|
||||
l.out_point = fr.snap_nearest(end).max(start + fr.frame_duration());
|
||||
place(&mut l, position);
|
||||
insert_layer_at(proj, st, cid, l, index)
|
||||
})?;
|
||||
|
|
|
|||
|
|
@ -883,3 +883,20 @@ fn property_edits_apply_to_every_selected_layer() {
|
|||
s.execute("prop.set", json!({"layer": a, "path": "transform/rotation", "value": 30})).unwrap();
|
||||
assert_eq!(prop(&s, b, "transform/rotation").value.as_f64(), 0.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_item_keeps_footage_longer_than_the_comp_at_full_length() {
|
||||
let mut s = Session::default();
|
||||
s.execute("comp.new", json!({"name": "T", "width": 400, "height": 300, "frameRate": 30, "duration": 4})).unwrap();
|
||||
let f = effectcraft_project::Footage {
|
||||
width: 100,
|
||||
height: 100,
|
||||
has_video: true,
|
||||
duration: effectcraft_time::Tick::from_seconds_f64(10.0),
|
||||
..Default::default()
|
||||
};
|
||||
let item = std::sync::Arc::make_mut(&mut s.project).add_item("long.mp4", effectcraft_color::Label::None, None, effectcraft_project::ItemKind::Footage(f));
|
||||
let l = s.execute("layer.addItem", json!({"item": item.0})).unwrap()["layer"].as_u64().unwrap();
|
||||
let layer = s.active_comp().unwrap().layer(effectcraft_project::LayerId(l)).unwrap();
|
||||
assert_eq!(layer.out_point.seconds(), 10.0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue