UsdLayerManager/openspec/changes/viewport-custom-camera/specs/viewport-frame-selection/spec.md

2.2 KiB

ADDED Requirements

Requirement: Frame selected prim with F key

The viewport SHALL frame the camera on the bounding box of the currently selected prim when the user presses the F key while the viewport is focused.

Scenario: Frame a selected mesh prim

  • WHEN the user has a mesh prim selected in the scene hierarchy and presses F while the viewport is focused
  • THEN the camera repositions to frame the bounding box of that prim and all its descendants in world space

Scenario: Frame with no prim selected

  • WHEN the user presses F with no prim selected
  • THEN no camera movement occurs

Scenario: Frame in USD camera mode

  • WHEN the viewport is in USD camera mode and the user presses F
  • THEN the viewport switches to free camera mode and frames the selected prim

Requirement: Frame all with A key

The viewport SHALL frame the camera on the bounding box of the entire USD stage when the user presses the A key while the viewport is focused.

Scenario: Frame all prims in the stage

  • WHEN the user presses A while the viewport is focused and a stage is loaded
  • THEN the camera repositions to frame the bounding box of the entire stage

Scenario: Frame all with no stage loaded

  • WHEN the user presses A with no stage loaded
  • THEN no camera movement occurs

Requirement: Selected prim path sourced from SceneHierarchyPanel

The viewport SHALL obtain the currently selected prim path from the SceneHierarchyPanel via a callback wired by the Application class.

Scenario: Selection change triggers prim path update

  • WHEN the user selects a different prim in the SceneHierarchyPanel
  • THEN the viewport's stored selected prim path updates to reflect the new selection
  • AND pressing F frames the newly selected prim

Requirement: Bounding box computed via UsdGeomBBoxCache

The bounding box for framing a selected prim SHALL be computed using UsdGeomBBoxCache to correctly account for transforms, instancing, and purpose.

Scenario: Bounding box includes descendant geometry

  • WHEN the user frames a prim that has mesh children
  • THEN the bounding box encompasses the prim and all its descendants' geometry in world space