Repository navigation
Conversation
The viewport and the headless picture now build the grid from one public API, grid_segments and grid_segments_on, which return world segments with their fade and major/minor share. The plane choice, the steps, the reach and the hysteresis stay in the engine; the viewport keeps only the vertex building.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
The grid's primitives (
grid_plane,grid_step,grid_lines,GridFade,grid_ext,grid_far_reach) are public insolidcraft_engine::view, but the loop that turnsGridLineAtand the fade into drawn segments lived incrates/ui-egui/src/viewport.rs. A consumer outside the application — plugin work, or testing an independent feature in an isolated environment — had to link the whole CAD front end or repeat 30–60 lines of plotting.This extracts the loop into
solidcraft_engine::view:grid_segmentsis the default viewport grid: the plane choice throughgrid_planewith its existing hysteresis,grid_step, the centre snap,grid_ext,grid_far_reachandGridFade.grid_segments_onis the same loop for an arbitrary frame, used by the viewport's open-sketch grid and by the headless picture.grid_centremoved from the viewport into the engine.The viewport's ground branch now calls
grid_segmentsand keeps only the colour/width/vertex building; its sketch branch builds a frame and callsgrid_segments_on. The headless scene usesgrid_segments_onwith its existing target-snapped frame and its two-colour emitter.Deviations from the API sketch in the request:
solidcraft-enginecannot depend on egui, so there is noRect. The grid's extent comes fromcam.half_height()andgrid_ext, as the loop already did.GridSegmentcarriesmajorbecause both callers blend the minor and major colours and widths fromline.major.grid_segmentstakes the picture'sfar, thefollows_viewpreference and the previousGridPlane; the fade cut and the hysteretic edge-on switch need them.Related: #10641. This is the grid half of the split's view-math work; the function can move to
solidcraft-view-mathwhen that crate lands.Changes a default: no
Validation
cargo test -p solidcraft-engine --profile ci --lib— 3146 passed, 0 failed, 8 ignored (measured on the58c64ca4base, before rebasing onto the current main).cargo test -p solidcraft-ui-egui --profile ci --lib -- --test-threads=1— 4094 passed, 1 failed, 19 ignored (same base). The failure isrender_workspace::tests::progressive_image_controls_route_to_the_registered_host(glass mediaInvalidScene), which reproduces unchanged on a clean checkout of58c64ca4.cfc46448a(a single unrelated joints commit), the targeted suites were re-run: engine--lib -- grid17 passed, engine--lib -- guides3 passed,ui-egui --lib -- grid47 passed, includingthe_picture_and_the_window_draw_the_same_grid_on_a_sketch_plane.cargo fmt --all -- --check;cargo xtask layers(18 crates),lists,ui-containers— all pass.cargo check --workspace --all-targets --profile ci— exit 0.manual_option_ziphits (crates/ui-egui/src/agent_chat/settings.rs:223,crates/ui-egui/src/viewport.rs:1543), both present oncfc46448aand untouched here.Screenshots of the behavior (when observable)
No visible change: the grid is drawn from the same
grid_step,grid_lines,GridFade,grid_extandgrid_far_reach, with the same points, alphas, colours and widths, in the same order. The existing grid, fade and headless-picture tests assert it, including the picture/window grid equality on a sketch plane. No screenshot is attached because there is no visible difference to show.Integration status
Based on upstream main
cfc46448a(2026-11-02); the branch has one commit on top. The split in #10641/#10642 (currently an empty draft claim) may move theviewfunctions; this PR is the grid delta and can move with it. PR #6889 (grid units) changes the same engine grid code and viewport grid drawing, and #9843 (grid crossings) changesview.rs; whichever lands first, the other needs a rebase. PR #10873 (the compass) is a separate open PR and does not touch the grid functions; #7731/#10266 touch the navigator inviewport.rs, a different block.