UsdAttributeInvertedModel#

class omni.kit.property.usd.UsdAttributeInvertedModel(
stage: Stage,
attribute_paths: List[Path],
self_refresh: bool,
metadata: dict,
change_on_edit_end=True,
**kwargs,
)#

Bases: UsdAttributeModel

A model that inverts the boolean value from a USD attribute.

This model extends the UsdAttributeModel and provides an inverted boolean representation of the USD attribute value. It can be particularly useful when working with toggles or switches in a user interface that require a reversed logic.

The get_value_as_bool method returns the inverted state of the attribute’s original boolean value. The set_value method sets the attribute’s value to the opposite of the provided value.

Methods

get_value()

Returns the inverted value of the underlying USD attribute.

get_value_as_bool()

Returns the inverted boolean value of the underlying USD attribute.

get_value_as_string([elide_big_array])

Returns the inverted boolean value as a string.

set_value(value[, comp])

Sets the value of the USD attribute to the opposite of the given value.

Attributes

__init__(
stage: Stage,
attribute_paths: List[Path],
self_refresh: bool,
metadata: dict,
change_on_edit_end=True,
**kwargs,
)#

Initializes the value model that is reimplemented in Python to watch a USD attribute path.

get_value()#

Returns the inverted value of the underlying USD attribute.

Returns:

Inverted value of the USD attribute.

Return type:

bool

get_value_as_bool() bool#

Returns the inverted boolean value of the underlying USD attribute.

Returns:

Inverted value of the USD attribute.

Return type:

bool

get_value_as_string(
elide_big_array=True,
) str#

Returns the inverted boolean value as a string.

Parameters:

elide_big_array (bool) – If True, large arrays are represented as […].

Returns:

‘True’ if original value is False, ‘False’ otherwise.

Return type:

str

set_value(value, comp: int = -1)#

Sets the value of the USD attribute to the opposite of the given value.

Parameters:
  • value (bool) – The value to set, after being inverted.

  • comp (int) – Component index for vector types, -1 for scalar.