Browser and viewport: item menu, per-item eyes, Delete key with confirmation

Right-click on any browser item (body, surface, datum, partition, set,
material, section, step, boundary condition, load, reference point,
coupling, contact, fluid domain) opens its menu: Edit…, Hide/Show,
Isolate, Show All, Active in step (boundary conditions and loads) and
Delete…. A right click on a datum or a partition's cut face in the
viewport opens the same menu. Each item the viewport draws on its own
has an eye; hidden items are neither drawn nor picked. Datums and
partitions are selectable with properties. Delete… and the Delete key
ask first (the prompt lists what uses the item: a datum's partitions
are deleted with it, other definitions in use are refused); ui.prompt
answers it. Every entry runs the same command as the ribbon and forms.

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-14 23:51:01 -04:00
1 parent d7ec7f486a
commit 08f669acad
12 files changed
+646 -78

No files matched your search

+29
View File
@@ -272,6 +272,9 @@ pub enum Prompt {
/// A design (its path) has none of the bodies the model's mesh and sets are on: start a new
/// model with it, or keep the model. The opened session waits in [`ModelApp::held`].
Design(String),
/// Delete a definition (the item menu's Delete…, the Delete key): what uses it is listed, and
/// the deletion refused or (a datum's partitions) done with it.
Delete(crate::menu::DeleteAsk),
}
/// The answer to [`Prompt::Design`].
@@ -871,6 +874,32 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
app.answer_design(a);
}
}
Some(Prompt::Delete(ask)) => {
let mut answer = None;
crate::frame::window(ctx, "Delete", crate::frame::Width::Normal).id(egui::Id::new("fc_delete")).show(ctx, |ui| {
ui.label(ask.question());
if ask.allowed() && !ask.users.is_empty() {
ui.label(egui::RichText::new("They are deleted too; Undo brings everything back.").color(t.text_dim));
}
ui.add_space(6.0);
ui.horizontal(|ui| {
if ask.allowed() && ui.button("Delete").clicked() {
answer = Some(true);
}
if ui.button(if ask.allowed() { "Cancel" } else { "Close" }).clicked() {
answer = Some(false);
}
});
});
if ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
answer = Some(false);
} else if ctx.input(|i| i.key_pressed(egui::Key::Enter)) {
answer = Some(ask.allowed());
}
if let Some(delete) = answer {
app.answer_delete(delete);
}
}
Some(Prompt::ReplaceMesh(r)) => {
let mut answer = None;
crate::frame::window(ctx, "Replace mesh", crate::frame::Width::Normal).id(egui::Id::new("fc_replace_mesh")).show(ctx, |ui| {