Add a FreeCAD-style navigation cube with rotation arrows#591
Open
markomarkovic wants to merge 4 commits into
Open
Add a FreeCAD-style navigation cube with rotation arrows#591markomarkovic wants to merge 4 commits into
markomarkovic wants to merge 4 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().
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.
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()front_viewlooks from +Y, consistency with the existing toolbar was chosen over OCCT's convention. As a consequence the default Iso view faces the side labeled BACK — happy to flip the convention instead if that's preferred.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.