TypedValue

class omni.graph.core.TypedValue(value: typing.Optional[typing.Any] = None, type: omni.graph.core._omni_graph_core.Type = Type(<BaseDataType.UNKNOWN: 0>, 1, 0))

Bases: object

Class that encapsulates an arbitrary value with an explicit data type. This can be used when the data type is ambiguous due to the limited set of native Python data types. For example it can differentiate between a float and double whereas in Python they are the same thing.

Methods

__init__([value, type])

has_type()

Returns True iff the data value has an explicit type (i.e.

set(*args, **kwargs)

Set the data to a specific value and/or type.

Attributes

type

value

__init__(value: typing.Optional[typing.Any] = None, type: omni.graph.core._omni_graph_core.Type = Type(<BaseDataType.UNKNOWN: 0>, 1, 0)) None
has_type() bool

Returns True iff the data value has an explicit type (i.e. is not type UNKNOWN)

set(*args, **kwargs)

Set the data to a specific value and/or type. The regular __init__ can be passed (VALUE, TYPE) in the simplest case; this is for more flexible setting.

The argument types are flexible and support the following syntax:

set(): Sets the data value to None and makes it an UNKNOWN type set(Any): Sets the data value and makes it an UNKNOWN type set(Any, str|og.Type): Sets the data value and defines an explicit type set(value=Any): Sets the data value and makes it an UNKNOWN type set(value=Any, type=str|og.Type): Sets the data value and defines an explicit type

No attempt is made to match the type to the value - it is assumed that if it is specified, it is correct.

Raises

og.OmniGraphError if the argument combinations are not one of the above, or the type could not be parsed