Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Viewport: shade the selected face fill, so a selected STL keeps its shape (#3761)

GreG Petersen2405f75c38c9
diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs
index 0bb5ba41cf..f359a4ca75 100644
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@ -1091,7 +1091,7 @@ pub struct Tokens {
pub timeline: Color32,
pub hover: Color32,
// ---- viewport selection feedback ----
- /// Selected face (flat fill).
+ /// Selected face (shaded fill).
pub sel_face: Color32,
/// Selected edge core and its lighter rim.
pub sel_edge: Color32,
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index ed0de0a4db..8bda105dad 100644
--- a/crates/ui-egui/src/viewport.rs
+++ b/crates/ui-egui/src/viewport.rs
@@ -4283,8 +4283,10 @@ pub(crate) fn build_highlight(app: &SolveApp) -> GpuScene {
match x {
Sel::Face { body, index, .. } => {
// A live preview stands in for the body: its old faces would fight with it.
+ // Lit, not flat: an imported mesh (STL, OBJ) is one face, and a flat fill would
+ // paint the whole part as a single silhouette.
if let Some(b) = by_name.get(body).filter(|_| app.body_visible(body) && !replaced(body)) {
- face_tris(&mut feedback, &shown(b), *index, c4(t.sel_face), false);
+ face_tris(&mut feedback, &shown(b), *index, c4(t.sel_face), true);
hidden_face_outline(&mut feedback, &drawn(b), *index, t.sel_edge);
}
}