EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
engine: a keyframe on the out point no longer warns (#2084)
Madhav Agarwal3f4ffdc0fc7a
diff --git a/crates/engine/src/commands/prop.rs b/crates/engine/src/commands/prop.rsindex 3af877d34..24598a3a7 100644--- a/crates/engine/src/commands/prop.rs+++ b/crates/engine/src/commands/prop.rs@@ -179,7 +179,9 @@ pub(crate) fn key_time(layer: &Layer, frame_rate: FrameRate, p: &Value, param: &pub(crate) fn key_timing(layer: &Layer, t: Tick) -> Value {let ct = layer.comp_time(t);let mut out = json!({"time": t.seconds(), "layerTime": t.seconds(), "compTime": ct.seconds()});- if !layer.is_active_at(ct) {+ // A key exactly on the out point ends a fade normally: it is outside the half-open visible+ // range, but it is not a caller mistake, so it does not warn (#2084).+ if ct < layer.in_point || ct > layer.out_point {out["warning"] = json!(format!("Keyframe at comp time {} s is outside the layer's active range [{} s, {} s).",ct.seconds(),diff --git a/crates/engine/src/tests_key_time.rs b/crates/engine/src/tests_key_time.rsindex 4d4ab367b..d42d6d4a0 100644--- a/crates/engine/src/tests_key_time.rs+++ b/crates/engine/src/tests_key_time.rs@@ -57,7 +57,10 @@ fn default_layer_times_are_preserved_and_outside_keys_warn() {assert!(selected.get("warning").is_some());let moved = s.execute("keys.set", json!({"layer": layer, "path": "transform/opacity", "time": 15.3, "newTime": 9.5, "timeBase": "layer"})).unwrap();assert_seconds(&moved["compTime"], 20.0);- assert!(moved.get("warning").is_some(), "out point is exclusive");+ assert!(moved.get("warning").is_none(), "a key on the out point is accepted");+ let past = s.execute("prop.addKey", json!({"layer": layer, "path": "transform/rotation", "time": 20.1, "timeBase": "comp", "value": 45})).unwrap();+ assert_seconds(&past["compTime"], 20.1);+ assert!(past.get("warning").is_some(), "a key past the out point warns");}#[test]