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

20 lines
1.3 KiB
Markdown

## ADDED Requirements
### Requirement: Generic attribute set is undoable
The system SHALL push an `AttributeSetCommand` to `CommandHistory` when `PropertyManager::SetPropertyValue` or `SetPropertyValueInLayer` is called. The command SHALL capture the old value (read before the set) and the new value as `std::function<void()>` closures so it is type-agnostic. `Undo()` SHALL restore the old value; `Redo()` SHALL re-apply the new value.
#### Scenario: Undo reverts attribute change
- **WHEN** the user changes a light's intensity via the Property panel and then presses Ctrl+Z
- **THEN** the intensity returns to its previous value
#### Scenario: Redo re-applies attribute change
- **WHEN** the user undoes an attribute change and then presses Ctrl+Y
- **THEN** the attribute is set back to the edited value
### Requirement: Attribute command preserves layer targeting
The `AttributeSetCommand` SHALL record which `SdfLayerHandle` was the active edit target. `Undo()` and `Redo()` SHALL use `UsdEditContext` to direct the attribute write to that same layer.
#### Scenario: Undo writes revert to correct layer
- **WHEN** the user edits an attribute with a non-root layer selected and then undoes
- **THEN** the revert opinion is written to the same non-root layer, not the root layer