ui: pick vertices, points and cells from the viewport

- Select: Vertices picks the design's B-rep vertices (meshed or not), and
  a selected vertex is marked (#346).
- Use selection on Datum Point (vertex, edge, face, or a hole's centre)
  and Reference Point (geometry.centre: a hole's centre, a vertex, nodes)
  (#346, #351).
- Partitioned Mesh: Use selection takes the picked bodies as cells; the
  cell list has All, None and Invert; hovering a cell's row (or its method
  row) highlights the cell in the viewport (#344).
- Rigid Wall's form takes its set from the selection; the Interactions
  branch lists the explicit steps' rigid walls, each opening its step
  (#350).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 09:27:39 -04:00
1 parent 1372094f8a
commit a09e3c856b
5 files changed
+143 -8

No files matched your search

+24 -2
View File
@@ -771,6 +771,21 @@ pub fn browser(app: &mut ModelApp, ui: &mut egui::Ui) {
}
/// The viewport setting a definition group's eye shows and hides: the setup's symbols.
/// The rigid walls of the explicit steps: a row label (`Rigid wall on front (Impact)`) and the
/// step each belongs to.
fn rigid_walls(m: &Model) -> Vec<(String, String)> {
m.steps()
.iter()
.filter_map(|s| match &s.procedure {
fieldcraft_model::Procedure::ExplicitDynamic(e) => {
Some(e.rigid_walls.iter().map(move |w| (format!("Rigid wall on {} ({})", w.set, s.name), s.name.clone())))
}
_ => None,
})
.flatten()
.collect()
}
fn eye_flag<'u>(state: &'u mut crate::UiState, group: &str) -> Option<&'u mut bool> {
match group {
"loads" => Some(&mut state.show_loads),
@@ -958,6 +973,8 @@ fn rows(app: &mut ModelApp, ui: &mut egui::Ui, acts: &mut Vec<Act>) {
];
for (key, label, kinds) in groups {
let items: Vec<(Def, String)> = kinds.iter().flat_map(|k| k.names(&app.session.model).into_iter().map(move |n| (*k, n))).collect();
// Rigid walls belong to their explicit step; they are listed here too, and open it.
let walls: Vec<(String, String)> = if key == "interactions" { rigid_walls(&app.session.model) } else { Vec::new() };
let icon = kinds.first().map(|k| k.icon());
let eye = eye_flag(&mut app.ui, key).map(|v| *v);
let (mark, tip) = state(key);
@@ -971,8 +988,8 @@ fn rows(app: &mut ModelApp, ui: &mut egui::Ui, acts: &mut Vec<Act>) {
eye,
icon,
label,
note: Some(format!("{}", items.len())),
dim: items.is_empty(),
note: Some(format!("{}", items.len() + walls.len())),
dim: items.is_empty() && walls.is_empty(),
mark,
tip,
..Default::default()
@@ -992,6 +1009,11 @@ fn rows(app: &mut ModelApp, ui: &mut egui::Ui, acts: &mut Vec<Act>) {
let row = Row { depth: 2, icon: Some(icon), moves, label: &name, ..Default::default() };
item_row(app, ui, id, row, Target::Def(kind, name.clone()), acts);
}
for (i, (label, step)) in walls.into_iter().enumerate() {
let id = egui::Id::new(("fc_row_rigid_wall", i));
let row = Row { depth: 2, icon: Some("interaction.rigid_wall"), label: &label, ..Default::default() };
item_row(app, ui, id, row, Target::Def(Def::Step, step), acts);
}
}
ghost_rows(app, ui, &stages, key, acts);
}