* claim: #10778 * Sketch Project: keep hidden origin planes hidden (#10778) WIP from dead worker: fix + test written, gates not yet run. --------- Co-authored-by: Dahak Builds <dahakbuilds@users.noreply.github.com>
This commit is contained in:
@@ -2301,7 +2301,9 @@ impl SolveApp {
|
||||
|
||||
/// Is the origin widget shown? Origin planes and axes are drawn and pickable. While a dialog
|
||||
/// picks a plane ([`SolveApp::picking_plane`]) the Origin is always shown, drawn through the
|
||||
/// model (a plane inside a body stays visible), even when the browser hides it.
|
||||
/// model (a plane inside a body stays visible), even when the browser hides it — except the
|
||||
/// origin planes for Project ([`SolveApp::picking_project_geometry`], #10778), which keep a
|
||||
/// hidden Origin hidden.
|
||||
pub fn origin_visible(&self) -> bool {
|
||||
self.origin_shown() || self.picking_plane()
|
||||
}
|
||||
@@ -2318,6 +2320,15 @@ impl SolveApp {
|
||||
self.picking_sketch_plane() || self.dialog.as_ref().is_some_and(|d| d.inputs.get(d.active).is_some_and(|i| i.accept & selection::PLANES != 0))
|
||||
}
|
||||
|
||||
/// Is the Sketch Project dialog open, picking its geometry? Its pick takes origin planes,
|
||||
/// but Project must not bring hidden origin planes back (#10778): every line a plane
|
||||
/// projects, an origin axis already gives, so the planes only add noise over the geometry
|
||||
/// being picked. Other dialogs that pick a plane keep the reveal ([`Self::picking_plane`],
|
||||
/// #2581).
|
||||
pub fn picking_project_geometry(&self) -> bool {
|
||||
self.dialog.as_ref().is_some_and(|d| matches!(d.kind, dialogs::Kind::SketchProject { .. }))
|
||||
}
|
||||
|
||||
/// The field of view the view is drawn with: the `perspective_fov` preference while the view is
|
||||
/// in perspective ([`Self::perspective_view`]), and 0 (parallel) otherwise. The one place the
|
||||
/// drawn angle is decided.
|
||||
|
||||
@@ -1944,11 +1944,16 @@ pub fn origin_planes(app: &SolveApp) -> Vec<(&'static str, Vec3, [Vec3; 4])> {
|
||||
return Vec::new();
|
||||
}
|
||||
// While the Origin is hidden, a dialog picking a plane brings the planes back: then every
|
||||
// plane; otherwise only those not hidden one by one.
|
||||
let creating = !app.origin_shown() && app.picking_plane();
|
||||
// plane; otherwise only those not hidden one by one. Project is the exception (#10778):
|
||||
// its pick takes planes too, but each line a plane gives, an axis already gives, so a
|
||||
// hidden Origin stays hidden for it.
|
||||
let reveal = !app.origin_shown() && app.picking_plane() && !app.picking_project_geometry();
|
||||
if !app.origin_shown() && !reveal {
|
||||
return Vec::new();
|
||||
}
|
||||
origin_quads(origin_size(app.cam.half_height()))
|
||||
.into_iter()
|
||||
.filter(|(n, _, _)| creating || !app.session.visibility.hidden_origin.iter().any(|h| h == n))
|
||||
.filter(|(n, _, _)| reveal || !app.session.visibility.hidden_origin.iter().any(|h| h == n))
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -12695,6 +12700,30 @@ mod grid_plane_tests {
|
||||
assert!(origin_planes(&app).is_empty());
|
||||
}
|
||||
|
||||
/// #10778: Project's pick takes origin planes, but it must not bring hidden origin planes
|
||||
/// back: every line a plane projects, an origin axis already gives. The axes and point stay
|
||||
/// as today; other dialogs that pick a plane keep the reveal (#2581).
|
||||
#[test]
|
||||
fn project_leaves_hidden_origin_planes_hidden() {
|
||||
let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
|
||||
app.run("solid.box", json!({"length":40,"width":40,"height":40})).unwrap();
|
||||
app.run("sketch.create", json!({"plane": "XY"})).unwrap();
|
||||
app.set_origin_shown(false);
|
||||
app.start("sketch.project");
|
||||
assert!(app.picking_project_geometry());
|
||||
assert!(app.picking_plane(), "Project's pick takes origin planes");
|
||||
assert!(origin_planes(&app).is_empty(), "Project leaves hidden origin planes hidden");
|
||||
assert!(!origin_axes(&app).is_empty(), "the origin axes stay as today");
|
||||
// Other dialogs that pick a plane keep today's reveal.
|
||||
app.dialog = None;
|
||||
app.start("solid.mirror");
|
||||
app.dialog.as_mut().unwrap().active = 1;
|
||||
assert_eq!(origin_planes(&app).len(), 3, "Mirror still offers every origin plane");
|
||||
app.dialog = None;
|
||||
app.start("sketch.create");
|
||||
assert_eq!(origin_planes(&app).len(), 3, "Create Sketch still offers every origin plane");
|
||||
}
|
||||
|
||||
/// Primary rolls a live preview back for reselect, but not while a manipulator is dragged
|
||||
/// (same gate [`show`] uses via [`preview_should_roll_back`]).
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user