ChangeFabricAttributeCommand#

class omni.fabric.commands.scripts.ChangeFabricAttributeCommand(
attr_path: str,
value: Any,
prev: Any,
timecode=Usd.TimeCode.Default(),
type_to_create_if_not_exist: ValueTypeNames | None = None,
stage: Stage | None = None,
is_custom: bool = False,
)#

Bases: Command

Change fabric prim attribute undoable Command.

Parameters:
  • attr_path (usdrt.Sdf.Path) – Prim attribute path.

  • value (Any) – Value to change to.

  • prev (Any) – Value to undo to.

  • timecode (usdrt.Usd.TimeCode) – The timecode to set attribute value to.

  • type_to_create_if_not_exist (usdrt.Sdf.ValueTypeName) – If not None AND attribute does not already exist, a new attribute will be created with given type and value.

  • stage (usdrt.Usd.Stage) – The current Fabric stage.

  • is_custom (bool) – If the attribute is created, specify if it is a ‘custom’ attribute (not part of the Schema).

Methods

__init__(attr_path, value, prev[, timecode, ...])

Create a command to change prim attribute.

do()

Executes the command to change the specified Fabric attribute to a new value.

undo()

Undoes the attribute change, reverting the attribute value to its previous state.

__init__(
attr_path: str,
value: Any,
prev: Any,
timecode=Usd.TimeCode.Default(),
type_to_create_if_not_exist: ValueTypeNames | None = None,
stage: Stage | None = None,
is_custom: bool = False,
)#

Create a command to change prim attribute.

do()#

Executes the command to change the specified Fabric attribute to a new value.

This method updates the attribute value and can create a new attribute if it does not exist and a type is specified.

undo()#

Undoes the attribute change, reverting the attribute value to its previous state.

If the attribute was created during the execution of the `do` method, this method will remove the attribute.