UsdLayerUndo
- class omni.kit.usd_undo.layer_undo.UsdLayerUndo(layer: Layer)
Bases:
object
A class for managing undo operations on USD layers.
This class encapsulates the functionality to reserve changes, perform undo operations, and reset the undo stack for a USD layer. It is designed to work with Sdf.Layer objects, allowing for precise control over the changes made to the layer.
- Parameters
layer – Sdf.Layer The Sdf.Layer object on which the undo operations are performed.
Methods
__init__
(layer)Initializes the UsdLayerUndo instance.
reserve
(path[, info])Reserves the changes made to the path in the USD layer to allow undo operations.
reset
()Resets the internal state of the UsdLayerUndo instance, clearing any changes reserved.
undo
()Undoes the last set of changes reserved by the reserve method.
- __init__(layer: Layer)
Initializes the UsdLayerUndo instance.
- Parameters
layer (Sdf.Layer) – The USD layer to be managed by this undo instance.
- class Key(path, info)
Bases:
object
A class to represent a key in the undo system for USD layers.
- Parameters
path – Sdf.Path The path associated with the change to be undone.
info – Any Optional information associated with the path, such as a specific attribute or metadata key.
- reserve(path: Path, info=None)
Reserves the changes made to the path in the USD layer to allow undo operations.
- Parameters
path (Sdf.Path) – The path in the USD layer to reserve.
info (optional) – Additional information about the reservation, default is None.
- reset()
Resets the internal state of the UsdLayerUndo instance, clearing any changes reserved.
- undo()
Undoes the last set of changes reserved by the reserve method.
- Raises
Exception – If the layer cannot be found.