Footage cache (#3271): channel selection is static, and only the channels picked are read

The parameters that pick which channels or Cryptomatte layer an effect reads (EXtractoR's Red/Green/Blue/Alpha, Cryptomatte's Layer and Layer Name, 3D Channel Extract's 3D Channel, ID Matte's Aux. Channel and Use Coverage, IDentifier's Channel Type) are static, as in After Effects where they have no stopwatch: no keyframes, no expression (prop.addKey, prop.toggleKey, prop.toggleAnimation and prop.setExpression refuse; prop.set changes the value). A document or an import that animated one keeps its first value and says so (a toast on open, a loss on .aep import). With that, what a frame reads is known from the values alone: the 'all channels' fallbacks for moving parameters and for effects that don't declare are gone (every channel effect declares; a test holds them to it), and a layer whose effects read no channels asks for none. Tests: the parameters refuse keys and expressions and the need is exactly the channel picked; a keyed channel selection opens static with its first value and is reported (both fail on the old code); the migration keeps the first key's value.
This commit is contained in:
vangel76 committed 2026-11-08 13:24:22 +01:00
1 parent f21b7d2a8f
commit c3464f640f
12 files changed
+231 -29

No files matched your search

+3 -4
View File
@@ -522,11 +522,10 @@ impl CryptoProbe {
let params = effectcraft_effects::flatten_params(g, &mut |pr| ctx.value(layer, pr));
// The channels the layer's effects read and this effect's (it may be switched off).
let own = match &g.kind {
effectcraft_project::GroupKind::Effect { effect } => effectcraft_effects::aux_needs(effect, &params),
_ => None,
effectcraft_project::GroupKind::Effect { effect } => effectcraft_effects::aux_need(effect, &params),
_ => effectcraft_raster::channels3d::AuxNeed::Lookups(vec![]),
};
let need =
r.layer_aux_need(&ctx, layer).union(own.map_or(effectcraft_raster::channels3d::AuxNeed::All, effectcraft_raster::channels3d::AuxNeed::Lookups));
let need = r.layer_aux_need(&ctx, layer).union(own);
let aux = r.layer_aux_with(&ctx, layer, &need).ok_or(NO_CRYPTO)?;
if !live() {
return Ok(None);
+13 -2
View File
@@ -461,7 +461,7 @@ fn toggle_key_selected(s: &mut Session, p: &Value) -> Result<Value> {
let want = added.as_bool().unwrap_or(true);
for (olid, ouid) in twins {
let _ = with_prop(s, "Add/Remove Keyframe", None, cid, olid, ouid, |pr, lt| {
if key_at(&pr.keys, lt).is_some() != want {
if !pr.static_only && key_at(&pr.keys, lt).is_some() != want {
toggle_key_at(pr, lt);
}
Ok(())
@@ -589,6 +589,9 @@ fn add_key(s: &mut Session, p: &Value) -> Result<Value> {
let at = snapped_key_time(s, cid, lid, p, "prop.addKey")?;
let value = p.get("value").cloned();
let count = with_prop(s, "Add Keyframe", None, cid, lid, uid, |pr, lt| {
if pr.static_only {
return Err(bad("prop.addKey", "this property can't be animated"));
}
let t = at.unwrap_or(lt);
let cur = pr.value_at(t);
let v = match &value {
@@ -611,7 +614,12 @@ fn add_key(s: &mut Session, p: &Value) -> Result<Value> {
fn toggle_key(s: &mut Session, p: &Value) -> Result<Value> {
let (cid, lid, uid) = prop_ref(s, p, "prop.toggleKey")?;
with_prop(s, "Add/Remove Keyframe", None, cid, lid, uid, |pr, lt| Ok(json!(toggle_key_at(pr, lt))))
with_prop(s, "Add/Remove Keyframe", None, cid, lid, uid, |pr, lt| {
if pr.static_only {
return Err(bad("prop.toggleKey", "this property can't be animated"));
}
Ok(json!(toggle_key_at(pr, lt)))
})
}
/// Add a keyframe at layer time `lt` (true), or remove the one there (false).
@@ -723,6 +731,9 @@ fn set_expr(s: &mut Session, p: &Value) -> Result<Value> {
let mut changed_types = vec![];
for (((cid, lid, uid), def), time) in targets.iter().zip(&defs).zip(&times) {
let pr = layer_mut(proj, *cid, *lid)?.props.find_mut(*uid).ok_or_else(|| bad(C, "property vanished"))?;
if pr.static_only && text.as_deref().is_some_and(|t| !t.trim().is_empty()) {
return Err(bad(C, format!("{} can't have an expression", pr.name)));
}
apply_expr(pr, &text, enabled, def);
out.push(json!(pr.expr.as_ref().map(|e| e.text.clone())));
if pr.match_id == "type" {