UsdLayerManager/openspec/changes/undo-redo-scene-editing/specs/undoable-transform-edits/spec.md

2.2 KiB

ADDED Requirements

Requirement: Gizmo drag produces one atomic undo command

The system SHALL record the pre-drag TRS state when a viewport gizmo drag begins, and push a single TransformCommand to CommandHistory when the drag ends (mouse button released). The command SHALL store the prim path, the edit-target layer, and the full TRS (translate, rotate, scale) snapshots from before and after the drag.

Scenario: Single undo reverses entire drag

  • WHEN the user drags the Move gizmo to translate a prim and then presses Ctrl+Z
  • THEN the prim returns to the position it had before the drag started (not an intermediate position)

Scenario: Redo restores drag result

  • WHEN the user undoes a gizmo drag and then presses Ctrl+Y
  • THEN the prim moves back to the post-drag position

Scenario: No command pushed for zero-delta drag

  • WHEN the user clicks a gizmo axis but releases without moving
  • THEN no command is pushed to the history stack

Requirement: Property panel TRS commits produce undo commands

The system SHALL push a TransformCommand to CommandHistory when a translate, rotate, or scale field in the Property panel loses focus after being edited (ImGui::IsItemDeactivatedAfterEdit()). The command SHALL store the pre-edit and post-edit TRS values.

Scenario: Undo reverts property-panel translate edit

  • WHEN the user types a new X translate value in the Property panel, presses Tab to commit, then presses Ctrl+Z
  • THEN the prim's translate returns to the value it had before the edit

Scenario: Typing without committing does not push a command

  • WHEN the user begins editing a translate field but presses Escape to cancel
  • THEN no new command is added to the undo stack

Requirement: Transform command respects the active edit target layer

The TransformCommand SHALL store and restore the SdfLayerHandle that was the active edit target at the time of the edit. Undo() and Redo() SHALL direct their UsdGeomXformCommonAPI writes to that same layer via UsdEditContext.

Scenario: Undo writes to correct layer

  • WHEN the user has Layer B selected as the edit target, moves a prim, then undoes
  • THEN the revert is written to Layer B, not to the root layer