browser.visibility hides and shows sketches, bodies, construction geometry and origin items (items: ids or names, or a whole folder; visible: bool), so agents can hide helper sketches over MCP. What is hidden moved from the egui UI state into the engine session (view state: not saved, not an undo step); the desktop eye toggles and menus use it, headless renders and fit leave hidden items out, and document.inspect, sketch.inspect and ui.inspect report visibility. ui.set still accepts hiddenBodies, hiddenOrigin, hiddenSketches and shownSketches. Tests: helper sketches hide and show in the engine (hostile input changes nothing) and through MCP only

This commit is contained in:
CypherNaugh_0x authored and bherbruck committed 2026-10-10 14:33:56 -04:00
1 parent 0321778d38
commit 81be4e74b8
16 files changed
+306 -118

No files matched your search

+12 -5
View File
@@ -41,10 +41,11 @@ pub mod colors {
pub fn bounds(s: &Session) -> Aabb3 {
let st = s.world_state();
let mut b = Aabb3::EMPTY;
for body in &st.bodies {
let v = &s.visibility;
for body in st.bodies.iter().filter(|x| !v.hidden_bodies.contains(&x.name)) {
b = b.union(&body.mesh().bounds());
}
for ss in &st.sketches {
for ss in st.sketches.iter().filter(|x| !v.hidden_sketches.contains(&x.feature)) {
if let Some((lo, hi)) = ss.sketch.bounds() {
for p in [lo, hi] {
b.add(ss.plane.to_world(p));
@@ -151,7 +152,7 @@ pub fn scene(s: &Session, cam: &Camera) -> Scene {
for (d, col) in [(Vec3::X, colors::AXIS_X), (Vec3::Y, colors::AXIS_Y), (Vec3::Z, colors::AXIS_Z)] {
sc.lines.push(SceneLine { points: vec![Vec3::ZERO, d * axis], color: col, width: 1.6, on_top: false });
}
for body in &st.bodies {
for body in st.bodies.iter().filter(|b| !s.visibility.hidden_bodies.contains(&b.name)) {
let selected = s.selection.iter().any(|x| matches!(x, Sel::Body { name } if *name == body.name));
let mesh = body.mesh();
// The body's appearance (or imported colour) and faces with looks of their own, as in
@@ -174,8 +175,7 @@ pub fn scene(s: &Session, cam: &Camera) -> Scene {
}
for ss in &st.sketches {
let active = s.active_sketch == Some(ss.feature);
// Finished sketches are hidden once a feature uses them, like Fusion's default.
if !active && sketch_consumed(s, ss.feature) {
if !sketch_shown(s, ss.feature) {
continue;
}
for (pts, col, cons) in sketch_lines(&ss.sketch, &ss.plane, active, &ss.report.curve_determined) {
@@ -185,6 +185,13 @@ pub fn scene(s: &Session, cam: &Camera) -> Scene {
sc
}
/// Is a sketch drawn? The active one is; others unless hidden. Finished sketches are hidden
/// once a feature uses them, like Fusion's default, unless shown one by one.
pub fn sketch_shown(s: &Session, id: u64) -> bool {
let v = &s.visibility;
s.active_sketch == Some(id) || (!v.hidden_sketches.contains(&id) && (v.shown_sketches.contains(&id) || !sketch_consumed(s, id)))
}
/// Is a sketch used by a later feature?
pub fn sketch_consumed(s: &Session, id: u64) -> bool {
use solvecraft_doc::FeatureKind;