MCP: get_property and get_layer list an enum property's options (#2085)

This commit is contained in:
Marco Arnulfo
2026-10-30 00:44:58 +01:00
parent a8d83b9717
commit 701d9df8a5
9 changed files with 59 additions and 10 deletions
+2 -3
View File
@@ -999,9 +999,8 @@ fn list(_: &mut Session, p: &Value) -> Result<Value> {
json!({"id": e.id, "name": e.name, "category": e.category, "gpu": e.gpu, "float": e.float, "params": e.params.iter().map(|p| {
let mut out = json!({"id": p.id, "name": p.name, "type": p.default.kind_name(), "default": p.default.to_json()});
match &p.ui {
effectcraft_project::ParamUi::Popup { options } => {
// Engine/MCP popup values are zero-based; JSX exposes one-based values.
out["options"] = json!(options.iter().enumerate().map(|(value, label)| json!({"value": value, "label": label})).collect::<Vec<_>>());
effectcraft_project::ParamUi::Popup { .. } => {
out["options"] = super::popup_options(&p.ui).unwrap_or_default();
}
effectcraft_project::ParamUi::Slider { min, max, slider_min, slider_max, decimals } => {
out["min"] = json!(min);