UsdLayerManager/openspec/changes/viewport-custom-camera/proposal.md

30 lines
2.3 KiB
Markdown

## Why
The current viewport uses a fixed internal camera with basic orbit/pan/zoom controls that do not match industry-standard DCC conventions. Users cannot view the scene through USD stage cameras (e.g. perspective cameras authored in the USD file), and the input mapping differs from Maya's Alt+button convention, making the tool feel foreign to target users. Adding Maya-style controls and the ability to frame the selected prim are essential for a usable USD editing workflow.
## What Changes
- Add Maya-style viewport navigation: Alt+LMB to orbit, Alt+MMB to pan, Alt+RMB (or scroll) to dolly/zoom, with optional Alt-free scroll zoom
- Add the ability to switch the viewport camera between the built-in free camera and any camera prim found on the USD stage
- Add a "Frame Selected" action (press F key) that frames the viewport on the currently selected prim's bounding box
- Add a "Frame All" action (press A key) that frames the viewport on the entire stage bounds
- Add a camera selector dropdown in the viewport toolbar to switch between free camera and stage cameras
## Capabilities
### New Capabilities
- `maya-viewport-controls`: Maya-style Alt+button navigation scheme replacing the current LMB/MMB/scroll mapping
- `viewport-camera-switching`: Switch viewport rendering between the built-in free camera and USD stage camera prims
- `viewport-frame-selection`: Frame viewport on selected prim (F key) and frame all (A key)
### Modified Capabilities
- `imgui-docking`: No spec-level requirement changes; the viewport toolbar UI integrates within the existing dockable panel system
## Impact
- **ViewportCamera**: Add support for driving the view from an external USD camera prim (reading its transform and projection); refactor internal state to support both free-camera and USD-camera modes
- **ViewportPanel**: Rewrite `HandleInput()` to use Maya-style Alt+button conventions; add camera selector UI in the viewport toolbar; add Frame Selected / Frame All hotkeys; expose camera switching
- **UsdSceneRenderer**: No changes required — it already accepts view/projection matrices
- **Application**: Wire up the selected prim path from SceneHierarchyPanel to the viewport for frame-selected functionality
- **Dependencies**: No new third-party dependencies; all changes use existing OpenUSD and ImGui APIs