| author | |
| committer | |
| log | b1f52e3193b8a300ec518e5c74b547b4c52922d0 |
| tree | f1797bb1c139acfb17b3c96db865b3628f72d2a8 |
| parent | ed61cc49ec6096291f4e15915bd6cc130c9a65af |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU |
3 files changed, 260 insertions(+), 18 deletions(-)
crates/engine/src/eval/io.rs+129-5| ... | @@ -216,7 +216,7 @@ impl Engine { | ... | @@ -216,7 +216,7 @@ impl Engine { |
| 216 | } | 216 | } |
| 217 | tex | 217 | tex |
| 218 | } else { | 218 | } else { |
| 219 | let tex = create_texture(&self.device, img.size, if need_post { 0 } else { key }); | 219 | let tex = self.alloc_tex(img.size, BitDepth::Int8, if need_post { 0 } else { key }); |
| 220 | self.queue.write_texture( | 220 | self.queue.write_texture( |
| 221 | tex.texture.as_image_copy(), | 221 | tex.texture.as_image_copy(), |
| 222 | &img.rgba, | 222 | &img.rgba, |
| ... | @@ -561,11 +561,36 @@ impl Engine { | ... | @@ -561,11 +561,36 @@ impl Engine { |
| 561 | return self.dummy.clone(); | 561 | return self.dummy.clone(); |
| 562 | }; | 562 | }; |
| 563 | let src = self.eval_node(comp, src_id, time, enc, visiting, stats); | 563 | let src = self.eval_node(comp, src_id, time, enc, visiting, stats); |
| 564 | let x_size = comp.eval_number(node, "XSize", time, src.size[0] as f64, &self.expr).round().max(1.0) as u32; | 564 | let keep_aspect = comp.eval_number(node, "KeepAspect", time, 0.0, &self.expr) > 0.5; |
| 565 | let y_size = comp.eval_number(node, "YSize", time, src.size[1] as f64, &self.expr).round().max(1.0) as u32; | 565 | let keep_centered = comp.eval_number(node, "KeepCentered", time, 0.0, &self.expr) > 0.5; |
| 566 | let ps = self.proxy_scale.max(1) as f64; | ||
| 567 | let x_size_f = comp | ||
| 568 | .eval_number(node, "XSize", time, src.canvas_size[0] as f64 * ps, &self.expr) | ||
| 569 | .round() | ||
| 570 | .max(1.0); | ||
| 571 | let y_size_f = if keep_aspect { | ||
| 572 | (x_size_f * src.canvas_size[1].max(1) as f64 / src.canvas_size[0].max(1) as f64) | ||
| 573 | .round() | ||
| 574 | .max(1.0) | ||
| 575 | } else { | ||
| 576 | comp.eval_number(node, "YSize", time, src.canvas_size[1] as f64 * ps, &self.expr) | ||
| 577 | .round() | ||
| 578 | .max(1.0) | ||
| 579 | }; | ||
| 580 | let x_size = x_size_f as u32; | ||
| 581 | let y_size = y_size_f as u32; | ||
| 566 | let dst_size = self.scaled_dims(x_size, y_size); | 582 | let dst_size = self.scaled_dims(x_size, y_size); |
| 567 | let x_off = comp.eval_number(node, "XOffset", time, 0.0, &self.expr) as f32 / self.proxy_scale.max(1) as f32; | 583 | let (x_off, y_off) = if keep_centered { |
| 568 | let y_off = comp.eval_number(node, "YOffset", time, 0.0, &self.expr) as f32 / self.proxy_scale.max(1) as f32; | 584 | ( |
| 585 | (src.size[0] as f32 - dst_size[0] as f32) * 0.5, | ||
| 586 | (src.size[1] as f32 - dst_size[1] as f32) * 0.5, | ||
| 587 | ) | ||
| 588 | } else { | ||
| 589 | ( | ||
| 590 | comp.eval_number(node, "XOffset", time, 0.0, &self.expr) as f32 / ps as f32, | ||
| 591 | comp.eval_number(node, "YOffset", time, 0.0, &self.expr) as f32 / ps as f32, | ||
| 592 | ) | ||
| 593 | }; | ||
| 569 | 594 | ||
| 570 | let mut u = UniformParams::default(); | 595 | let mut u = UniformParams::default(); |
| 571 | u.p[0] = [x_off, y_off, 1.0, 1.0]; | 596 | u.p[0] = [x_off, y_off, 1.0, 1.0]; |
| ... | @@ -1115,4 +1140,103 @@ Composition {{ | ... | @@ -1115,4 +1140,103 @@ Composition {{ |
| 1115 | 1140 | ||
| 1116 | let _ = std::fs::remove_dir_all(&dir); | 1141 | let _ = std::fs::remove_dir_all(&dir); |
| 1117 | } | 1142 | } |
| 1143 | |||
| 1144 | #[test] | ||
| 1145 | fn crop_keep_aspect_matches_fusion_height_and_centered_offset() { | ||
| 1146 | let src = r#" | ||
| 1147 | Composition { | ||
| 1148 | CurrentTime = 0, | ||
| 1149 | RenderRange = { 0, 1 }, | ||
| 1150 | GlobalRange = { 0, 1 }, | ||
| 1151 | Tools = ordered() { | ||
| 1152 | BG = Background { | ||
| 1153 | Inputs = { | ||
| 1154 | Width = Input { Value = 640, }, | ||
| 1155 | Height = Input { Value = 360, }, | ||
| 1156 | TopLeftRed = Input { Value = 0.8, }, | ||
| 1157 | TopLeftAlpha = Input { Value = 1.0, }, | ||
| 1158 | }, | ||
| 1159 | }, | ||
| 1160 | CropAspect = Crop { | ||
| 1161 | Inputs = { | ||
| 1162 | XOffset = Input { Value = 67, }, | ||
| 1163 | YOffset = Input { Value = 104, }, | ||
| 1164 | XSize = Input { Value = 2563, }, | ||
| 1165 | YSize = Input { Value = 2563, }, | ||
| 1166 | KeepAspect = Input { Value = 1, }, | ||
| 1167 | Input = Input { SourceOp = "BG", Source = "Output", }, | ||
| 1168 | }, | ||
| 1169 | }, | ||
| 1170 | CropCentered = Crop { | ||
| 1171 | Inputs = { | ||
| 1172 | XSize = Input { Value = 320, }, | ||
| 1173 | YSize = Input { Value = 320, }, | ||
| 1174 | KeepAspect = Input { Value = 1, }, | ||
| 1175 | KeepCentered = Input { Value = 1, }, | ||
| 1176 | Input = Input { SourceOp = "BG", Source = "Output", }, | ||
| 1177 | }, | ||
| 1178 | }, | ||
| 1179 | }, | ||
| 1180 | } | ||
| 1181 | "#; | ||
| 1182 | let comp = Comp::from_fusion_str(src).expect("parse crop comp"); | ||
| 1183 | let mut eng = Engine::new_headless().expect("gpu"); | ||
| 1184 | let (t_aspect, _) = eng.evaluate(&comp, comp.find_node("CropAspect").unwrap(), 0.0); | ||
| 1185 | assert_eq!(t_aspect.size, [2563, 1442]); | ||
| 1186 | |||
| 1187 | let (t_centered, _) = eng.evaluate(&comp, comp.find_node("CropCentered").unwrap(), 0.0); | ||
| 1188 | assert_eq!(t_centered.size, [320, 180]); | ||
| 1189 | } | ||
| 1190 | |||
| 1191 | #[test] | ||
| 1192 | fn loader_reuses_pooled_textures_across_gpu_cache_bust() { | ||
| 1193 | let dir = std::env::temp_dir().join("fission_loader_pool_test"); | ||
| 1194 | let _ = std::fs::create_dir_all(&dir); | ||
| 1195 | let png_path = dir.join("plate.png"); | ||
| 1196 | write_solid_png(&png_path, 256, 256, [120, 180, 240, 255]); | ||
| 1197 | |||
| 1198 | let comp_src = format!( | ||
| 1199 | r#" | ||
| 1200 | Composition {{ | ||
| 1201 | CurrentTime = 0, | ||
| 1202 | RenderRange = {{ 0, 1 }}, | ||
| 1203 | GlobalRange = {{ 0, 1 }}, | ||
| 1204 | Tools = ordered() {{ | ||
| 1205 | LD = Loader {{ | ||
| 1206 | Clips = {{ | ||
| 1207 | Clip {{ | ||
| 1208 | ID = "Clip1", | ||
| 1209 | Filename = "{}", | ||
| 1210 | FormatID = "PNGFormat", | ||
| 1211 | StartFrame = 0, | ||
| 1212 | Length = 1, | ||
| 1213 | }} | ||
| 1214 | }}, | ||
| 1215 | }}, | ||
| 1216 | }}, | ||
| 1217 | }} | ||
| 1218 | "#, | ||
| 1219 | png_path.display() | ||
| 1220 | ); | ||
| 1221 | let comp = Comp::from_fusion_str(&comp_src).expect("parse"); | ||
| 1222 | let ld = comp.find_node("LD").expect("LD"); | ||
| 1223 | let mut eng = Engine::new_headless().expect("gpu"); | ||
| 1224 | |||
| 1225 | let (t1, _) = eng.evaluate(&comp, ld, 0.0); | ||
| 1226 | assert_eq!(t1.size, [256, 256]); | ||
| 1227 | drop(t1); | ||
| 1228 | |||
| 1229 | eng.bust_gpu_cache(); | ||
| 1230 | assert!(eng.cache.pool_stats().pooled_count >= 1); | ||
| 1231 | |||
| 1232 | let before_hits = eng.cache.pool_stats().hits; | ||
| 1233 | let (t2, _) = eng.evaluate(&comp, ld, 0.0); | ||
| 1234 | assert_eq!(t2.size, [256, 256]); | ||
| 1235 | assert!( | ||
| 1236 | eng.cache.pool_stats().hits > before_hits, | ||
| 1237 | "expected Loader texture to recycle from TexturePool on bust" | ||
| 1238 | ); | ||
| 1239 | |||
| 1240 | let _ = std::fs::remove_dir_all(&dir); | ||
| 1241 | } | ||
| 1118 | } | 1242 | } |
crates/engine/src/eval/mod.rs+114-3| ... | @@ -1065,9 +1065,27 @@ impl Engine { | ... | @@ -1065,9 +1065,27 @@ impl Engine { |
| 1065 | return self.dummy.clone(); | 1065 | return self.dummy.clone(); |
| 1066 | } | 1066 | } |
| 1067 | if node.kind == "Switch" || node.kind == "Fuse.Switch" { | 1067 | if node.kind == "Switch" || node.kind == "Fuse.Switch" { |
| 1068 | let which = comp.eval_number(node, "Which", time, 1.0, &self.expr).round().max(1.0) as usize; | 1068 | let is_native_zero_indexed = node.kind == "Switch" |
| 1069 | let port = format!("Input{which}"); | 1069 | && (node.inputs.contains_key("Source") |
| 1070 | let src_name = node.connected_node(&port).or_else(|| node.connected_node("Input1")); | 1070 | || node.inputs.contains_key("Input0") |
| 1071 | || !node.inputs.contains_key("Which")); | ||
| 1072 | let src_name = if is_native_zero_indexed { | ||
| 1073 | let source = comp | ||
| 1074 | .eval_number(node, "Source", time, 0.0, &self.expr) | ||
| 1075 | .round() | ||
| 1076 | .max(0.0) as usize; | ||
| 1077 | let port = format!("Input{source}"); | ||
| 1078 | node.connected_node(&port) | ||
| 1079 | .or_else(|| node.connected_node("Input0")) | ||
| 1080 | } else { | ||
| 1081 | let which = comp | ||
| 1082 | .eval_number(node, "Which", time, 1.0, &self.expr) | ||
| 1083 | .round() | ||
| 1084 | .max(1.0) as usize; | ||
| 1085 | let port = format!("Input{which}"); | ||
| 1086 | node.connected_node(&port) | ||
| 1087 | .or_else(|| node.connected_node("Input1")) | ||
| 1088 | }; | ||
| 1071 | if let Some(src_id) = src_name.and_then(|s| comp.find_node(s)) { | 1089 | if let Some(src_id) = src_name.and_then(|s| comp.find_node(s)) { |
| 1072 | return self.eval_node(comp, src_id, time, enc, visiting, stats); | 1090 | return self.eval_node(comp, src_id, time, enc, visiting, stats); |
| 1073 | } | 1091 | } |
| ... | @@ -1395,4 +1413,97 @@ mod lazy_shader_verify { | ... | @@ -1395,4 +1413,97 @@ mod lazy_shader_verify { |
| 1395 | assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().modules.len(), 7); | 1413 | assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().modules.len(), 7); |
| 1396 | assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().pipelines.len(), 45); | 1414 | assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().pipelines.len(), 45); |
| 1397 | } | 1415 | } |
| 1416 | |||
| 1417 | #[test] | ||
| 1418 | fn switch_supports_native_zero_indexed_source_and_legacy_one_indexed_which() { | ||
| 1419 | let src = r#" | ||
| 1420 | Composition { | ||
| 1421 | CurrentTime = 0, | ||
| 1422 | RenderRange = { 0, 5 }, | ||
| 1423 | GlobalRange = { 0, 5 }, | ||
| 1424 | Tools = ordered() { | ||
| 1425 | Red = Background { | ||
| 1426 | Inputs = { | ||
| 1427 | Width = Input { Value = 16, }, | ||
| 1428 | Height = Input { Value = 16, }, | ||
| 1429 | TopLeftRed = Input { Value = 1.0, }, | ||
| 1430 | TopLeftAlpha = Input { Value = 1.0, }, | ||
| 1431 | }, | ||
| 1432 | }, | ||
| 1433 | Green = Background { | ||
| 1434 | Inputs = { | ||
| 1435 | Width = Input { Value = 16, }, | ||
| 1436 | Height = Input { Value = 16, }, | ||
| 1437 | TopLeftGreen = Input { Value = 1.0, }, | ||
| 1438 | TopLeftAlpha = Input { Value = 1.0, }, | ||
| 1439 | }, | ||
| 1440 | }, | ||
| 1441 | Blue = Background { | ||
| 1442 | Inputs = { | ||
| 1443 | Width = Input { Value = 16, }, | ||
| 1444 | Height = Input { Value = 16, }, | ||
| 1445 | TopLeftBlue = Input { Value = 1.0, }, | ||
| 1446 | TopLeftAlpha = Input { Value = 1.0, }, | ||
| 1447 | }, | ||
| 1448 | }, | ||
| 1449 | SwNative0 = Switch { | ||
| 1450 | Inputs = { | ||
| 1451 | Source = Input { Value = 0, }, | ||
| 1452 | Input0 = Input { SourceOp = "Red", Source = "Output", }, | ||
| 1453 | Input1 = Input { SourceOp = "Green", Source = "Output", }, | ||
| 1454 | }, | ||
| 1455 | }, | ||
| 1456 | SwNative1 = Switch { | ||
| 1457 | Inputs = { | ||
| 1458 | Source = Input { Value = 1, }, | ||
| 1459 | Input0 = Input { SourceOp = "Red", Source = "Output", }, | ||
| 1460 | Input1 = Input { SourceOp = "Green", Source = "Output", }, | ||
| 1461 | }, | ||
| 1462 | }, | ||
| 1463 | SwNativeOmittedSource = Switch { | ||
| 1464 | Inputs = { | ||
| 1465 | Input0 = Input { SourceOp = "Red", Source = "Output", }, | ||
| 1466 | Input1 = Input { SourceOp = "Green", Source = "Output", }, | ||
| 1467 | }, | ||
| 1468 | }, | ||
| 1469 | SwFuse2 = Fuse.Switch { | ||
| 1470 | Inputs = { | ||
| 1471 | Which = Input { Value = 2, }, | ||
| 1472 | Input1 = Input { SourceOp = "Red", Source = "Output", }, | ||
| 1473 | Input2 = Input { SourceOp = "Blue", Source = "Output", }, | ||
| 1474 | }, | ||
| 1475 | }, | ||
| 1476 | SwLegacy2 = Switch { | ||
| 1477 | Inputs = { | ||
| 1478 | Which = Input { Value = 2, }, | ||
| 1479 | Input1 = Input { SourceOp = "Red", Source = "Output", }, | ||
| 1480 | Input2 = Input { SourceOp = "Blue", Source = "Output", }, | ||
| 1481 | }, | ||
| 1482 | }, | ||
| 1483 | }, | ||
| 1484 | } | ||
| 1485 | "#; | ||
| 1486 | let comp = Comp::from_fusion_str(src).expect("parse switch comp"); | ||
| 1487 | let mut eng = Engine::new_headless().expect("gpu"); | ||
| 1488 | |||
| 1489 | let (t0, _) = eng.evaluate(&comp, comp.find_node("SwNative0").unwrap(), 0.0); | ||
| 1490 | let p0 = eng.readback_rgba(&t0).unwrap(); | ||
| 1491 | assert!(p0[0] > 240 && p0[1] < 15 && p0[2] < 15, "SwNative0 expected red, got {:?}", &p0[..4]); | ||
| 1492 | |||
| 1493 | let (t1, _) = eng.evaluate(&comp, comp.find_node("SwNative1").unwrap(), 0.0); | ||
| 1494 | let p1 = eng.readback_rgba(&t1).unwrap(); | ||
| 1495 | assert!(p1[1] > 240 && p1[0] < 15 && p1[2] < 15, "SwNative1 expected green, got {:?}", &p1[..4]); | ||
| 1496 | |||
| 1497 | let (to, _) = eng.evaluate(&comp, comp.find_node("SwNativeOmittedSource").unwrap(), 0.0); | ||
| 1498 | let po = eng.readback_rgba(&to).unwrap(); | ||
| 1499 | assert!(po[0] > 240 && po[1] < 15 && po[2] < 15, "SwNativeOmittedSource expected red, got {:?}", &po[..4]); | ||
| 1500 | |||
| 1501 | let (tf, _) = eng.evaluate(&comp, comp.find_node("SwFuse2").unwrap(), 0.0); | ||
| 1502 | let pf = eng.readback_rgba(&tf).unwrap(); | ||
| 1503 | assert!(pf[2] > 240 && pf[0] < 15 && pf[1] < 15, "SwFuse2 expected blue, got {:?}", &pf[..4]); | ||
| 1504 | |||
| 1505 | let (tl, _) = eng.evaluate(&comp, comp.find_node("SwLegacy2").unwrap(), 0.0); | ||
| 1506 | let pl = eng.readback_rgba(&tl).unwrap(); | ||
| 1507 | assert!(pl[2] > 240 && pl[0] < 15 && pl[1] < 15, "SwLegacy2 expected blue, got {:?}", &pl[..4]); | ||
| 1508 | } | ||
| 1398 | } | 1509 | } |
crates/model/src/comp.rs+17-10| ... | @@ -628,6 +628,7 @@ impl Comp { | ... | @@ -628,6 +628,7 @@ impl Comp { |
| 628 | for &(nid, _) in &instanced_from { | 628 | for &(nid, _) in &instanced_from { |
| 629 | let mut visited = HashSet::new(); | 629 | let mut visited = HashSet::new(); |
| 630 | visited.insert(nid); | 630 | visited.insert(nid); |
| 631 | let mut blocked: HashSet<String> = HashSet::new(); | ||
| 631 | let mut cur = nid; | 632 | let mut cur = nid; |
| 632 | for _depth in 0..8 { | 633 | for _depth in 0..8 { |
| 633 | let Some(&pid) = parent_of.get(&cur) else { | 634 | let Some(&pid) = parent_of.get(&cur) else { |
| ... | @@ -642,16 +643,19 @@ impl Comp { | ... | @@ -642,16 +643,19 @@ impl Comp { |
| 642 | { | 643 | { |
| 643 | continue; | 644 | continue; |
| 644 | } | 645 | } |
| 646 | if blocked.contains(inp_name) { | ||
| 647 | continue; | ||
| 648 | } | ||
| 645 | if parent_binding.value.is_none() | 649 | if parent_binding.value.is_none() |
| 646 | && parent_binding.source_op.is_none() | 650 | && parent_binding.source_op.is_none() |
| 647 | && parent_binding.expression.is_none() | 651 | && parent_binding.expression.is_none() |
| 648 | { | 652 | { |
| 653 | // An empty `Param = Input {}` on an ancestor marks a de-instanced | ||
| 654 | // override to default and stops further inheritance up the chain. | ||
| 655 | blocked.insert(inp_name.clone()); | ||
| 649 | continue; | 656 | continue; |
| 650 | } | 657 | } |
| 651 | let child_empty = inst_inputs.get(inp_name).is_none_or(|b| { | 658 | if !inst_inputs.contains_key(inp_name) { |
| 652 | b.value.is_none() && b.source_op.is_none() && b.expression.is_none() | ||
| 653 | }); | ||
| 654 | if child_empty { | ||
| 655 | inst_inputs.insert(inp_name.clone(), parent_binding.clone()); | 659 | inst_inputs.insert(inp_name.clone(), parent_binding.clone()); |
| 656 | } | 660 | } |
| 657 | } | 661 | } |
| ... | @@ -3053,9 +3057,10 @@ mod expression_modifier_tests { | ... | @@ -3053,9 +3057,10 @@ mod expression_modifier_tests { |
| 3053 | let expr = ExprEngine::new(); | 3057 | let expr = ExprEngine::new(); |
| 3054 | 3058 | ||
| 3055 | let inst = comp.node(comp.find_node("Instance_ColorCorrector1_6").unwrap()); | 3059 | let inst = comp.node(comp.find_node("Instance_ColorCorrector1_6").unwrap()); |
| 3056 | // Inherits WheelTintAngle1 (even through empty `Input {}` stub) and Blend spline from master! | 3060 | // Empty `WheelTintAngle1 = Input {}` is a de-instanced override (falls back to tool default), |
| 3061 | // while omitted params (`Blend`, `PreDividePostMultiply`) inherit from master! | ||
| 3057 | let tint = comp.eval_number(inst, "WheelTintAngle1", 0.0, 0.0, &expr); | 3062 | let tint = comp.eval_number(inst, "WheelTintAngle1", 0.0, 0.0, &expr); |
| 3058 | assert!((tint - (-0.434283)).abs() < 1e-6, "got {tint}"); | 3063 | assert!(tint.abs() < 1e-6, "de-instanced empty Input {{}} must not inherit master value, got {tint}"); |
| 3059 | let blend_t5 = comp.eval_number(inst, "Blend", 5.0, 1.0, &expr); | 3064 | let blend_t5 = comp.eval_number(inst, "Blend", 5.0, 1.0, &expr); |
| 3060 | assert!((blend_t5 - 0.5).abs() < 1e-6, "got {blend_t5}"); | 3065 | assert!((blend_t5 - 0.5).abs() < 1e-6, "got {blend_t5}"); |
| 3061 | let pdpm = comp.eval_number(inst, "PreDividePostMultiply", 0.0, 0.0, &expr); | 3066 | let pdpm = comp.eval_number(inst, "PreDividePostMultiply", 0.0, 0.0, &expr); |
| ... | @@ -3068,11 +3073,13 @@ mod expression_modifier_tests { | ... | @@ -3068,11 +3073,13 @@ mod expression_modifier_tests { |
| 3068 | assert_eq!(inst.connected_node("EffectMask"), None); | 3073 | assert_eq!(inst.connected_node("EffectMask"), None); |
| 3069 | 3074 | ||
| 3070 | // Chained inheritance (`Instance_Chained -> Instance_ColorCorrector1_6 -> ColorCorrector1_6`): | 3075 | // Chained inheritance (`Instance_Chained -> Instance_ColorCorrector1_6 -> ColorCorrector1_6`): |
| 3071 | // nearest ancestor wins (`WheelHue1 = 0.9`), grandparent fills remaining params (`WheelTintAngle1`, `Blend`). | 3076 | // nearest ancestor wins (`WheelHue1 = 0.9`, and `WheelTintAngle1` was de-instanced by parent), |
| 3077 | // grandparent fills remaining omitted params (`Blend`, `PreDividePostMultiply`). | ||
| 3072 | let chained = comp.node(comp.find_node("Instance_Chained").unwrap()); | 3078 | let chained = comp.node(comp.find_node("Instance_Chained").unwrap()); |
| 3073 | assert!((comp.eval_number(chained, "WheelHue1", 0.0, 0.0, &expr) - 0.9).abs() < 1e-6); | 3079 | assert!((comp.eval_number(chained, "WheelHue1", 0.0, 0.0, &expr) - 0.9).abs() < 1e-6); |
| 3074 | assert!((comp.eval_number(chained, "WheelTintAngle1", 0.0, 0.0, &expr) - (-0.434283)).abs() < 1e-6); | 3080 | assert!(comp.eval_number(chained, "WheelTintAngle1", 0.0, 0.0, &expr).abs() < 1e-6); |
| 3075 | assert!((comp.eval_number(chained, "Blend", 10.0, 0.0, &expr) - 0.75).abs() < 1e-6); | 3081 | assert!((comp.eval_number(chained, "Blend", 10.0, 0.0, &expr) - 0.75).abs() < 1e-6); |
| 3082 | assert!((comp.eval_number(chained, "PreDividePostMultiply", 0.0, 0.0, &expr) - 1.0).abs() < 1e-6); | ||
| 3076 | assert_eq!(chained.connected_node("Input"), Some("Loader1")); | 3083 | assert_eq!(chained.connected_node("Input"), Some("Loader1")); |
| 3077 | assert_eq!(chained.connected_node("EffectMask"), None); | 3084 | assert_eq!(chained.connected_node("EffectMask"), None); |
| 3078 | 3085 | ||
| ... | @@ -3084,11 +3091,11 @@ mod expression_modifier_tests { | ... | @@ -3084,11 +3091,11 @@ mod expression_modifier_tests { |
| 3084 | assert!((comp.eval_number(cyc_b, "XBlurSize", 0.0, 0.0, &expr) - 3.0).abs() < 1e-6); | 3091 | assert!((comp.eval_number(cyc_b, "XBlurSize", 0.0, 0.0, &expr) - 3.0).abs() < 1e-6); |
| 3085 | assert!((comp.eval_number(cyc_b, "YBlurSize", 0.0, 0.0, &expr) - 7.0).abs() < 1e-6); | 3092 | assert!((comp.eval_number(cyc_b, "YBlurSize", 0.0, 0.0, &expr) - 7.0).abs() < 1e-6); |
| 3086 | 3093 | ||
| 3087 | // Roundtrip preserves SourceOp inheritance without duplicating master params | 3094 | // Roundtrip preserves SourceOp inheritance and de-instanced `Input {}` overrides without duplicating master params |
| 3088 | let saved = comp.to_fusion_string(); | 3095 | let saved = comp.to_fusion_string(); |
| 3089 | let reloaded = Comp::from_fusion_str(&saved).expect("reload"); | 3096 | let reloaded = Comp::from_fusion_str(&saved).expect("reload"); |
| 3090 | let r_inst = reloaded.node(reloaded.find_node("Instance_ColorCorrector1_6").unwrap()); | 3097 | let r_inst = reloaded.node(reloaded.find_node("Instance_ColorCorrector1_6").unwrap()); |
| 3091 | assert!((reloaded.eval_number(r_inst, "WheelTintAngle1", 0.0, 0.0, &expr) - (-0.434283)).abs() < 1e-6); | 3098 | assert!(reloaded.eval_number(r_inst, "WheelTintAngle1", 0.0, 0.0, &expr).abs() < 1e-6); |
| 3092 | assert!((reloaded.eval_number(r_inst, "Blend", 5.0, 1.0, &expr) - 0.5).abs() < 1e-6); | 3099 | assert!((reloaded.eval_number(r_inst, "Blend", 5.0, 1.0, &expr) - 0.5).abs() < 1e-6); |
| 3093 | assert_eq!(r_inst.connected_node("EffectMask"), None); | 3100 | assert_eq!(r_inst.connected_node("EffectMask"), None); |
| 3094 | } | 3101 | } |