#3395: setValue stores string effect parameters, such as Apply Color LUT's LUT

This commit is contained in:
JonRC
2026-11-10 02:24:29 -03:00
parent 6a105aa285
commit 499f9ce455
2 changed files with 29 additions and 0 deletions
+2
View File
@@ -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") {
+27
View File
@@ -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()));
}