diff --git a/crates/engine/src/eval/mod.rs b/crates/engine/src/eval/mod.rs index bca0d8e52673199cfd5f9d33ec470761f18556a4..3712dec8c5edd5dd0a052a61c0dc3f55b294e984 100644 --- a/crates/engine/src/eval/mod.rs +++ b/crates/engine/src/eval/mod.rs @@ -621,6 +621,7 @@ impl Engine { | "pKill" | "pMerge" | "pBounce" => self.dummy.clone(), + "Custom" if node.connected_node("Image1").and_then(|s| comp.find_node(s)).is_none() => self.dummy.clone(), "Custom" => self.eval_custom(comp, node, time, frame_i, comp_dims, enc, visiting, stats), "Renderer3D" => self.eval_renderer3d(comp, node, time, frame_i, comp_dims, enc, visiting, stats), other => { @@ -816,6 +817,39 @@ Composition { assert!(pl[2] > 240 && pl[0] < 15 && pl[1] < 15, "SwLegacy2 expected blue, got {:?}", &pl[..4]); } + #[test] + fn custom_without_image1_renders_nothing() { + let src = r#" +Composition { + CurrentTime = 0, + RenderRange = { 0, 0 }, + GlobalRange = { 0, 0 }, + Tools = ordered() { + Unwired = Custom { + Inputs = { + RedExpression = Input { Value = "0.7", }, + AlphaExpression = Input { Value = "1", }, + }, + }, + Dangling = Custom { + Inputs = { + Image1 = Input { SourceOp = "NoSuchTool", Source = "Output", }, + RedExpression = Input { Value = "0.7", }, + AlphaExpression = Input { Value = "1", }, + }, + }, + }, +} +"#; + let comp = Comp::from_fusion_str(src).expect("parse custom comp"); + let mut eng = Engine::new_headless().expect("gpu"); + for name in ["Unwired", "Dangling"] { + let (t, _) = eng.evaluate(&comp, comp.find_node(name).unwrap(), 0.0); + let px = eng.readback_rgba(&t).unwrap(); + assert_eq!(&px[..4], &[0, 0, 0, 0], "{name} must be transparent without Image1"); + } + } + #[test] fn frame_memo_distinguishes_subframe_times_within_same_rounded_frame() { // BG1 animates TopLeftRed from 0.0 at t=9.0 to 1.0 at t=10.0.