CreateUsdAttributeCommand

class omni.usd.commands.CreateUsdAttributeCommand(prim: Prim, attr_name: str, attr_type: ValueTypeName, custom: bool = True, variability: Variability = Sdf.VariabilityVarying, attr_value: Optional[Any] = None)

Bases: Command

Creates a USD Attribute for a primitive.

Example of usage:
omni.kit.commands.execute(“CreateUsdAttribute”,

prim=prim, attr_name=”custom”, attr_type=Sdf.ValueTypeNames.Double3)

Methods

__init__(prim, attr_name, attr_type[, ...])

Constructor.

do()

undo()

__init__(prim: Prim, attr_name: str, attr_type: ValueTypeName, custom: bool = True, variability: Variability = Sdf.VariabilityVarying, attr_value: Optional[Any] = None)

Constructor.

Parameters
  • prim (Usd.Prim) – USD primitive to create the attribute.

  • attr_name (str) – New attribute’s name.

  • attr_type (Sdf.ValueTypeName) – New attribute’s type.

  • custom (bool, optional) – If the attribute is custom. Default is True.

  • variability (Sdf.Variability, optional) – whether the attribute may vary over time and value coordinates, and if its value comes through authoring or from its owner. Default is Sdf.VariabilityVarying.

  • attr_value (Any, optional) – New attribute’s value. Leave it as None to use default value.