Interpret Footage: looped footage lasts its loops on new and re-timed layers (fixes #1045)

This commit is contained in:
Marco Arnulfo
2026-10-12 17:13:33 +02:00
parent e2f314f753
commit a50e49df73
4 changed files with 26 additions and 5 deletions
+2 -2
View File
@@ -771,9 +771,9 @@ fn interpret(s: &mut Session, p: &Value) -> Result<Value> {
s.edit("Interpret Footage", None, |proj, _| {
for (i, g) in items.iter().zip(&guesses) {
let Some(ItemKind::Footage(f)) = proj.item_mut(*i).map(|x| &mut x.kind) else { continue };
let old = f.duration;
let old = f.looped_duration();
it.apply(f, *g);
let new = f.duration;
let new = f.looped_duration();
if new == old {
continue;
}
+2 -2
View File
@@ -283,7 +283,7 @@ fn add_item(s: &mut Session, p: &Value) -> Result<Value> {
&serde_json::json!({"comp": cid.0, "item": item.0, "time": f_p(p, "time"), "index": p.get("index"), "position": p.get("position")}),
);
}
ItemKind::Footage(f) => (LayerSource::Footage { item }, (f.width, f.height), Some(f.duration)),
ItemKind::Footage(f) => (LayerSource::Footage { item }, (f.width, f.height), Some(f.looped_duration())),
ItemKind::Solid(so) => (LayerSource::Solid { item }, (so.width, so.height), None),
ItemKind::Folder => return Err(bad("layer.addItem", "folders can't be layers")),
};
@@ -972,7 +972,7 @@ fn slip(s: &mut Session, p: &Value) -> Result<Value> {
}
let dur = match &l.source {
LayerSource::Footage { item } => match s.project.item(*item).map(|i| &i.kind) {
Some(ItemKind::Footage(f)) if f.kind != effectcraft_project::FootageKind::Still => Some(Tick(f.duration.0 * f.loop_count.max(1) as i64)),
Some(ItemKind::Footage(f)) if f.kind != effectcraft_project::FootageKind::Still => Some(f.looped_duration()),
_ => None,
},
LayerSource::Comp { item } => s.project.comp(*item).map(|c| c.duration),