EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge main into fix/1063-text-animator-stacked
Claude55761e226fee
diff --cc crates/script/src/tests.rsindex e384ae1d6,a2f674d0a..786dec561--- a/crates/script/src/tests.rs+++ b/crates/script/src/tests.rs@@@ -1483,23 -1719,67 +1719,88 @@@ fn layer_property_resolves_transform_anassert_eq!(layer(c, "s").props.prop("transform/opacity").unwrap().value, KV::Scalar(25.0));}+/// A text animator property added by its After Effects name is the one asked for, not its Tracking+/// Type companion, and it can be found again by that name (#1063).+#[test]+fn scripted_text_animator_property_is_the_one_asked_for() {+ let mut s = session();+ let o = ok(+ &mut s,+ r#"+ var c = app.project.items.addComp("Track", 960, 300, 1, 3, 30);+ var t = c.layers.addText("MOVARA");+ var a = t.property("ADBE Text Properties").property("ADBE Text Animators").addProperty("ADBE Text Animator");+ var props = a.property("ADBE Text Animator Properties");+ var added = props.addProperty("ADBE Text Tracking Amount");+ added.setValue(20);+ [added.name, props.property("ADBE Text Tracking Amount").value, props.property("ADBE Text Tracking Amount").name,+ added.matchName, props.property(added.matchName).propertyIndex]+ "#,+ );+ assert_eq!(o.result, json!(["Tracking Amount", 20, "Tracking Amount", "ADBE Text Tracking Amount", 2]));+}+++ /// #1936: an array whose length doesn't match the property's dimension is an error in After+ /// Effects, not a value to truncate or broadcast. Two values for a 3-D property stay legal.+ #[test]+ fn set_value_rejects_an_array_of_the_wrong_dimension() {+ let mut s = session();+ let o = ok(+ &mut s,+ r#"+ var c = app.project.items.addComp("Dims", 640, 360, 1, 2, 30);+ var l = c.layers.addSolid([1, 0, 0], "s", 640, 360, 1);+ var ramp = l.property("ADBE Effect Parade").addProperty("ADBE Ramp").property("ADBE Ramp-0001");+ function attempt(f) { try { f(); return "no error"; } catch (e) { return e.message; } }+ var before = "" + ramp.value;+ var tooMany = attempt(function () { ramp.setValue([1, 2, 3]); });+ var tooFew = attempt(function () { ramp.setValue([1]); });+ var untouched = "" + ramp.value;+ ramp.setValue([7, 8]);+ var keyed = attempt(function () { ramp.setValueAtTime(0, [1, 2, 3, 4]); });+ // A 3-D property still takes two values, as it does in After Effects: z stays 0.+ l.property("Position").setValue([120, 34]);+ [tooMany, tooFew, untouched === before, "" + ramp.value, keyed, "" + l.property("Position").value]+ "#,+ );+ assert_eq!(+ o.result,+ json!([+ "Array is not of the correct dimension",+ "Array is not of the correct dimension",+ true,+ "7,8",+ "Array is not of the correct dimension",+ "120,34,0"+ ])+ );+ let (_, c) = comp_named(&s, "Dims");+ assert_eq!(layer(c, "s").props.prop("transform/position").unwrap().value, KV::Vec3([120.0, 34.0, 0.0]));+ }++ /// #1942: the scripting width and height setters resize the frame only. Re-anchoring the old frame+ /// in the new one, which moves every unparented layer, belongs to the Composition Settings dialog.+ #[test]+ fn setting_comp_width_and_height_leaves_the_layers_where_they_are() {+ let mut s = session();+ let o = ok(+ &mut s,+ r#"+ var c = app.project.items.addComp("w", 400, 200, 1, 1, 25);+ var l = c.layers.addSolid([1, 1, 1], "s", 50, 50, 1, 1);+ var pos = l.property("ADBE Transform Group").property("ADBE Position");+ pos.setValue([100, 100]);+ var k = c.layers.addSolid([1, 1, 1], "k", 50, 50, 1, 1);+ var kpos = k.property("ADBE Transform Group").property("ADBE Position");+ kpos.setValueAtTime(0, [10, 20]);+ kpos.setValueAtTime(1, [30, 40]);+ var before = "" + pos.value;+ c.width = 800;+ c.height = 400;+ [before, "" + pos.value, "" + kpos.keyValue(1), "" + kpos.keyValue(2), c.width, c.height]+ "#,+ );+ assert_eq!(o.result, json!(["100,100,0", "100,100,0", "10,20,0", "30,40,0", 800, 400]));+ let (_, c) = comp_named(&s, "w");+ assert_eq!(layer(c, "s").props.prop("transform/position").unwrap().value, KV::Vec3([100.0, 100.0, 0.0]));+ }