forked from 1b-agent/opencadstudio-upstream
Wire up the Properties panel's Parameters section
PropValue::ParamRow/ParamAddRow, the PropParamInput/Commit/Delete/AddNew messages, their command_driver handlers (on_prop_param_commit/_delete/ _add_new, resolve_named_parameter_edit), and their render functions all already existed — but nothing ever constructed the "Parameters" section that would route data to them, so the whole inline add/rename/redefine/ delete workflow was unreachable from the UI. Adds that missing section to the no-selection page in refresh_properties, alongside a new PropValue::ParamsVisibilityToggle header row (mirrors the existing show_constraint_values setting) for toggling whether constraint pills show their driven value/parameter name. Users can now manage named parameters inline in the Properties panel (live resolved values, add/rename/redefine/delete) as an alternative to the separate PARAMETERS modal, which continues to work unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
753df67ee4
commit
ed2e0fbc4a
5 files changed
+154
-2
No files matched your search
@@ -471,6 +471,42 @@ impl OpenCADStudio {
|
||||
},
|
||||
],
|
||||
},
|
||||
// Document-wide named-parameter table embedded here
|
||||
// instead of only the separate PARAMETERS modal —
|
||||
// see `PropValue::ParamRow`'s doc comment. Belongs
|
||||
// on the no-selection (drawing-level) page, not a
|
||||
// per-entity one: a parameter isn't owned by any
|
||||
// one entity.
|
||||
PropSection {
|
||||
title: t!("Parameters").into_owned(),
|
||||
props: {
|
||||
let mut props: Vec<Property> = vec![Property {
|
||||
label: String::new(),
|
||||
field: "show_named_parameters",
|
||||
value: PropValue::ParamsVisibilityToggle(self.show_constraint_values),
|
||||
}];
|
||||
props.extend(scene
|
||||
.named_parameters()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, p)| Property {
|
||||
label: String::new(),
|
||||
field: "named_parameter",
|
||||
value: PropValue::ParamRow {
|
||||
index,
|
||||
name: p.name.clone(),
|
||||
formula: p.source.clone(),
|
||||
resolved: scene.named_parameters().resolve(&p.name).map_err(|e| e.to_string()),
|
||||
},
|
||||
}));
|
||||
props.push(Property {
|
||||
label: String::new(),
|
||||
field: "named_parameter_add",
|
||||
value: PropValue::ParamAddRow,
|
||||
});
|
||||
props
|
||||
},
|
||||
},
|
||||
];
|
||||
ui::PropertiesPanel {
|
||||
title: t!("No selection").into_owned(),
|
||||
@@ -3231,6 +3267,9 @@ fn make_sections_read_only(
|
||||
PropValue::EntityLink { handles, .. } => format!("{} entity link(s)", handles.len()),
|
||||
PropValue::ParamRow { name, formula, .. } => format!("{name} = {formula}"),
|
||||
PropValue::ParamAddRow => String::new(),
|
||||
PropValue::ParamsVisibilityToggle(value) => {
|
||||
if *value { t!("Shown") } else { t!("Hidden") }.into_owned()
|
||||
}
|
||||
};
|
||||
property.field = "locked_read_only";
|
||||
property.value = PropValue::ReadOnly(text);
|
||||
|
||||
Reference in new issue
Block a user