| ... | ... | @@ -2153,7 +2153,7 @@ fn try_parse_text_keyframes(table: &LuaTable) -> Option<Vec<(f64, String)>> { |
| 2153 | 2153 | }; |
| 2154 | 2154 | let kt = v.as_table()?; |
| 2155 | 2155 | let val = kt.get_table("Value")?; |
| 2156 | | if val.tag.as_deref() == Some("Text") { |
| 2156 | if matches!(val.tag.as_deref(), Some("Text" | "StyledText")) { |
| 2157 | 2157 | let s = val.get_str("Value").unwrap_or("").to_owned(); |
| 2158 | 2158 | texts.push((time, s)); |
| 2159 | 2159 | } else { |
| ... | ... | @@ -3087,4 +3087,32 @@ mod expression_modifier_tests { |
| 3087 | 3087 | assert!((reloaded.eval_number(r_inst, "Blend", 5.0, 1.0, &expr) - 0.5).abs() < 1e-6); |
| 3088 | 3088 | assert_eq!(r_inst.connected_node("EffectMask"), None); |
| 3089 | 3089 | } |
| 3090 | |
| 3091 | #[test] |
| 3092 | fn parses_styled_text_and_text_bezier_spline_keyframes() { |
| 3093 | let src = r#"Composition { |
| 3094 | Tools = ordered() { |
| 3095 | Text_1 = TextPlus { |
| 3096 | Inputs = { |
| 3097 | StyledText = Input { |
| 3098 | SourceOp = "Text_1StyledText", |
| 3099 | Source = "Value", |
| 3100 | }, |
| 3101 | }, |
| 3102 | }, |
| 3103 | Text_1StyledText = BezierSpline { |
| 3104 | KeyFrames = { |
| 3105 | [10] = { 0, Value = StyledText { Value = "first line" } }, |
| 3106 | [20] = { 1, Value = Text { Value = "second line" } }, |
| 3107 | }, |
| 3108 | }, |
| 3109 | }, |
| 3110 | }"#; |
| 3111 | let comp = Comp::from_fusion_str(src).expect("parse styled text spline"); |
| 3112 | let expr = ExprEngine::new(); |
| 3113 | let node = comp.node(comp.find_node("Text_1").unwrap()); |
| 3114 | assert_eq!(comp.eval_text(node, "StyledText", 5.0, "", &expr), "first line"); |
| 3115 | assert_eq!(comp.eval_text(node, "StyledText", 10.0, "", &expr), "first line"); |
| 3116 | assert_eq!(comp.eval_text(node, "StyledText", 25.0, "", &expr), "second line"); |
| 3117 | } |
| 3090 | 3118 | } |