IVariable
- class omni.graph.core.IVariable
Bases:
_IVariable
Object that contains a value that is local to a graph, available from anywhere in the graph
Methods
__init__
(*args, **kwargs)Overloaded function.
get
(self, graph_context, instance_path)Get the value of a variable
get_array
(self, graph_context, ...)Get the value of an array variable
set
(self, graph_context, value, instance_path)Sets the value of a variable
set_type
(self, variable_type)Changes the type of a variable.
Attributes
category
display_name
Specifies if the variable is backed by a Usd attribute.
name
scope
source_path
tooltip
Gets the data type of the variable.
valid
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: omni.graph.core._omni_graph_core.IVariable, arg0: omni.core._core.IObject) -> None
__init__(self: omni.graph.core._omni_graph_core.IVariable) -> None
- get(self: omni.graph.core._omni_graph_core.IVariable, graph_context: omni::graph::core::Py_GraphContext, instance_path: str = None) object
Get the value of a variable
- Parameters
graph_context (omni.graph.core.GraphContext) – The GraphContext object to get the variable value from.
instance_path (str) – Optional path to the prim instance to fetch the variable value for. By default this will fetch the variable value from the graph prim.
- Returns
Value of the variable
- Return type
Any
- get_array(self: omni.graph.core._omni_graph_core.IVariable, graph_context: omni::graph::core::Py_GraphContext, get_for_write: bool = False, reserved_element_count: int = 0, instance_path: str = None) object
Get the value of an array variable
- Parameters
graph_context (omni.graph.core.GraphContext) – The GraphContext object to get the variable value from.
get_for_write (bool) – Should the data be retrieved for writing?
reserved_element_count (int) – If the data is to be retrieved for writing, preallocate this many elements
instance_path (str) – Optional path to the prim instance to fetch the variable value for. By default this will fetch the variable value from the graph prim.
- Returns
Value of the array variable
- Return type
Any
- set(self: omni.graph.core._omni_graph_core.IVariable, graph_context: omni::graph::core::Py_GraphContext, value: object, instance_path: str = None) bool
Sets the value of a variable
- Parameters
graph_context (omni.graph.core.GraphContext) – The GraphContext object to store the variable value.
value (any) – The value assigned to the variable.
instance_path (str) – Optional path to the prim instance to set the variable value on. By default this will set the variable value on the graph prim.
- Returns
True if the value was successfully set
- Return type
bool
- set_type(self: omni.graph.core._omni_graph_core.IVariable, variable_type: omni::graph::core::Py_Type) bool
Changes the type of a variable. Changing the type of a variable may remove the variable’s default value.
- Parameters
variable_type (omni.graph.core.Type) – The type to switch the variable to.
- Returns
True if the type was successfully changed.
- Return type
bool
- property is_backed_by_usd
Specifies if the variable is backed by a Usd attribute.
- Returns
True if the variable is backed by Usd, otherwise False.
- Return type
bool
- property type
Gets the data type of the variable.
- Returns
The data type of the variable.
- Return type