From 499f9ce455fcf6b9d9a69ec99c076936f1c8b7b7 Mon Sep 17 00:00:00 2001 From: JonRC Date: Tue, 10 Nov 2026 02:24:29 -0300 Subject: [PATCH 1/2] #3395: setValue stores string effect parameters, such as Apply Color LUT's LUT --- crates/script/src/prelude.js | 2 ++ crates/script/src/tests.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/crates/script/src/prelude.js b/crates/script/src/prelude.js index b9108b2a1..360913289 100644 --- a/crates/script/src/prelude.js +++ b/crates/script/src/prelude.js @@ -867,6 +867,8 @@ Property.prototype.property = function () { return null; }; if (!idx) return null; return this.__layer.containingComp.layer(idx).__id; } + // A string parameter (a LUT or look file, a text field) takes the text, or a File's path (#3395). + if (info.type === "string") return __str(v); if (info.type === "enum") return __num(v) - 1; if (info.type === "bool") return typeof v === "boolean" ? v : __num(v) !== 0; if (info.type === "color") { diff --git a/crates/script/src/tests.rs b/crates/script/src/tests.rs index 78a16e5d3..d04018e67 100644 --- a/crates/script/src/tests.rs +++ b/crates/script/src/tests.rs @@ -1949,3 +1949,30 @@ fn setting_comp_width_and_height_leaves_the_layers_where_they_are() { 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])); } + +/// #3395: setValue on a string effect parameter stores the text, or a File's path, as `prop.set` +/// does. Before, every string fell through to the number check ("value must be a number"). +/// Hidden string parameters (Mesh Warp's Distortion Mesh) stay refused. +#[test] +fn set_value_stores_a_string_parameter() { + let mut s = session(); + let o = ok( + &mut s, + r#" + var c = app.project.items.addComp("Str", 64, 36, 1, 1, 24); + var l = c.layers.addSolid([1, 0, 0], "s", 64, 36, 1); + var fx = l.property("ADBE Effect Parade"); + var lut = fx.addProperty("Apply Color LUT").property("LUT"); + lut.setValue("/luts/look.cube"); + var fromString = lut.value; + lut.setValue(new File("/luts/other.cube")); + var mesh = fx.addProperty("Mesh Warp").property("Distortion Mesh"); + var hidden; + try { mesh.setValue("x"); hidden = "no error"; } catch (e) { hidden = e.message; } + [lut.propertyValueType === PropertyValueType.CUSTOM_VALUE, fromString, lut.value, hidden] + "#, + ); + assert_eq!(o.result, json!([true, "/luts/look.cube", "/luts/other.cube", "\"Distortion Mesh\" can not be set"])); + let (_, c) = comp_named(&s, "Str"); + assert_eq!(layer(c, "s").props.prop("effects/#1/lut").unwrap().value, KV::Str("/luts/other.cube".into())); +} From 29db04ed62e57abc302e74701766229c79f5f09a Mon Sep 17 00:00:00 2001 From: JonRC Date: Tue, 10 Nov 2026 03:35:33 -0300 Subject: [PATCH 2/2] #3395: hidden string parameters stay refused by setValueAtTime and the other key setters --- crates/script/src/prelude.js | 6 +++++- crates/script/src/tests.rs | 12 +++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/script/src/prelude.js b/crates/script/src/prelude.js index 360913289..f2a7a8230 100644 --- a/crates/script/src/prelude.js +++ b/crates/script/src/prelude.js @@ -868,7 +868,11 @@ Property.prototype.property = function () { return null; }; return this.__layer.containingComp.layer(idx).__id; } // A string parameter (a LUT or look file, a text field) takes the text, or a File's path (#3395). - if (info.type === "string") return __str(v); + // A hidden one (Mesh Warp's mesh) stays refused by the key setters too, as by setValue. + if (info.type === "string") { + if (info.hidden) throw __err("\"" + info.name + "\" can not be set"); + return __str(v); + } if (info.type === "enum") return __num(v) - 1; if (info.type === "bool") return typeof v === "boolean" ? v : __num(v) !== 0; if (info.type === "color") { diff --git a/crates/script/src/tests.rs b/crates/script/src/tests.rs index d04018e67..d0884dbcb 100644 --- a/crates/script/src/tests.rs +++ b/crates/script/src/tests.rs @@ -1952,7 +1952,7 @@ fn setting_comp_width_and_height_leaves_the_layers_where_they_are() { /// #3395: setValue on a string effect parameter stores the text, or a File's path, as `prop.set` /// does. Before, every string fell through to the number check ("value must be a number"). -/// Hidden string parameters (Mesh Warp's Distortion Mesh) stay refused. +/// Hidden string parameters (Mesh Warp's Distortion Mesh) stay refused, keys included. #[test] fn set_value_stores_a_string_parameter() { let mut s = session(); @@ -1967,12 +1967,14 @@ fn set_value_stores_a_string_parameter() { var fromString = lut.value; lut.setValue(new File("/luts/other.cube")); var mesh = fx.addProperty("Mesh Warp").property("Distortion Mesh"); - var hidden; - try { mesh.setValue("x"); hidden = "no error"; } catch (e) { hidden = e.message; } - [lut.propertyValueType === PropertyValueType.CUSTOM_VALUE, fromString, lut.value, hidden] + function attempt(f) { try { f(); return "no error"; } catch (e) { return e.message; } } + var hidden = attempt(function () { mesh.setValue("x"); }); + var keyed = attempt(function () { mesh.setValueAtTime(0, "x"); }); + [lut.propertyValueType === PropertyValueType.CUSTOM_VALUE, fromString, lut.value, hidden, keyed, mesh.numKeys] "#, ); - assert_eq!(o.result, json!([true, "/luts/look.cube", "/luts/other.cube", "\"Distortion Mesh\" can not be set"])); + let refused = "\"Distortion Mesh\" can not be set"; + assert_eq!(o.result, json!([true, "/luts/look.cube", "/luts/other.cube", refused, refused, 0])); let (_, c) = comp_named(&s, "Str"); assert_eq!(layer(c, "s").props.prop("effects/#1/lut").unwrap().value, KV::Str("/luts/other.cube".into())); }