Repository navigation
Add a FreeCAD-style navigation cube with rotation arrows - #591
markomarkovic wants to merge 7 commits into
Conversation
Renders OCCT's AIS_ViewCube as a transform-persistent overlay in the upper-right corner of the viewport: it always reflects the current camera orientation, keeps a constant screen size and allows one-click reorientation. Clicking a face, edge or corner starts an eased camera animation that preserves zoom, center, distance and projection type. Cube parts highlight on hover; hovering is confined to the cube's corner region so the rest of the viewport keeps its no-hover behavior. The cube can be toggled with the new 'Show navigation cube' preference and is excluded from fit(). FRONT/BACK labels follow the toolbar's Front/Back view actions.
Two curved arrow buttons above the navigation cube, similar to FreeCAD's, roll the camera around the screen-normal axis in animated 45 degree steps (pure roll: projection, zoom, center and distance are preserved). The arrows are screen-fixed 2D overlays that do not rotate with the camera, fill with the highlight color on hover, share the 'Show navigation cube' preference and are excluded from fit().
The navigation cube and its rotation arrows are always-displayed furniture that inflated number_visible_items, breaking test_inspect and test_debug. Skip them so the counts reflect only rendered CQ objects.
44b8fd5 to
4afc3a7
Compare
|
@markomarkovic Thanks
Let's go ahead and change to follow FreeCAD's convention. |
Label the cube's -Y face FRONT (OCCT's default) and flip the toolbar's Front/Back actions to match, so the default Iso view faces FRONT.
|
@jmwright Done in 3ee9eb2: the cube now labels the −Y face FRONT, as FreeCAD and OCCT do. To keep the cube and the toolbar consistent, the toolbar's Front/Back actions were flipped too (Front now looks from −Y, Back from +Y), so the default Iso view faces FRONT. The screenshot and description are updated. |
This PR adds an interactive navigation cube to the upper-right corner of the 3D viewport, similar to FreeCAD's, plus two curved arrow buttons that roll the view in 45° steps around the screen-normal axis. It addresses the common problem of losing orientation with the Turntable/Trackball controls by providing a persistent orientation reference with one-click reorientation.
Features
AIS_ViewCube, displayed as a transform-persistent object in the existing view — it follows every rotation source (both orbit methods, keyboard shortcuts, toolbar view actions) with no camera-sync code, keeps a constant screen size, and is unaffected by zoomfit()Implementation notes
HandleClickrequiresViewAnimation().SetView()(segfault otherwise) and aLastActiveView; the finishing animation frame only invalidates the view (an explicit redraw is needed); clicks landing mid-animation must settle the running animation first, or OCCT's repeated-click detection (which snaps the camera up vector to its canonical value) compares against a partially rotated cameratests/test_navigation_cube.py(pytest-qt), covering display, reorientation with zoom/center/pan preservation, animation edge cases, hover, the preference, andfit()exclusionDisclosure
The code in this PR was written by an AI assistant (Claude, by Anthropic) working under my direction: I specified the feature, made the design decisions, tested the result interactively, and reviewed the changes. Happy to adjust anything that doesn't fit the project's conventions.