Expand description
Feature-schema access + the feature-schema → FormField mapping.
The kernel OWNS the feature definitions (feature_pipeline/schema.rs; each
features/<feat>.rs declares its own schema() with an inputParamsSchema).
This module reaches that catalogue from native Rust (re-exported by the
kernel as brep_kernel::feature_schema_catalogue) and maps ONE feature’s
parameter schema into the general FormField list the shared egui form
engine renders — the SAME FormFields the settings dialog uses.
The map classifies each kernel param type:
number→FieldKind::Scalar(unbounded drag value)string→FieldKind::Text(idis read-only)transform→ threeFieldKind::Vec3(position/rotation/scale)boolean_operation→ anFieldKind::Enum(operation) + aFieldKind::Reference(tools) + aFieldKind::Bool(mergeCoplanarFaces)reference_selection→FieldKind::Reference(the #42 seam)
REFERENCE-SELECTION field types (rendered as the disabled placeholder — the
seam for the next slice’s real picker): the top-level reference_selection
params, and the targets list inside a boolean_operation. (transform’s
optional start reference is not surfaced here yet.)
Functions§
- feature_
catalogue - The kernel-owned feature-schema catalogue (
{ version, features: [...] }). - feature_
default_ params - A feature type’s DEFAULT
inputParams, built from its schema: one entry perinputParamsSchemaparam seeded with that param’sdefault_value(missing →null). The caller assigns the uniqueidafterwards (the schema’siddefault isnull). Additive, engine-owned, and reusable by any “add feature” path so a new feature’s params always track the kernel schema. Unknown types yield an empty object. - feature_
form_ fields - Map a feature type’s
inputParamsSchemainto the general form fields, in schema (insertion) order — the kernel builds schemas with serde_json’spreserve_order, so grouped fields stay contiguous for the group headers. - feature_
icon - The icon character for a feature type, if one exists. Every kernel
feature type has a FreeCAD-inspired monoline glyph in the font’s Private-Use
block U+E030-E059 (edited as
BREP_app/assets/glyphs/*.svg, which are also the source of the inline SVG icon catalog — seeBREP_app/src/icons.rs;every_feature_type_has_catalogued_artworkthere checks each of these codepoints actually HAS a glyph, which this module’s own test cannot). The font is installed as family"brep_icons"at the HEAD of egui’s fallback chain (crate-sidefonts.rs), so a bare returnedcharrenders as the icon. - feature_
long_ name - Human display name for a feature type: the schema
longName(else the type itself), with the feature’s icon character PREPENDED. Every consumer that shows a feature name (add-feature palette, history tree, context-bar offers, dialogs) reads it through here, so the icon appears everywhere with no per-caller wiring — seefeature_icon. - feature_
plain_ name - The same display name WITHOUT the leading glyph — the schema
longName, else the type itself. - feature_
schema - One feature’s full schema entry, by its
type/shortName(e.g."P.CU","B").Noneif the type is not in the catalogue. - feature_
short_ name - A feature type’s SHORT name (
shortName, e.g.P.CU,S,E), else the type code itself. This is the BASE for a new feature’s id: the engine appends the part history’s persistent global counter to it (P.CU→P.CU7,S→S8) incrate::history::History::next_feature_id. - form_
fields_ from_ schema - Map ANY schema entry carrying an
inputParamsSchemaobject into form fields — the shared engine behindfeature_form_fieldsAND the assembly constraint dialogs (whose schemas come from the kernel’sconstraint_schema_catalogue, same shape, different catalogue). One mapping, two catalogues (the schema-driven-dialog principle).