Python API Reference#
The Python API provides a high-level interface to the ovrtx rendering library.
Known Limitations#
In the current version, you cannot use the usd-core package from PyPI. If you wish to use OpenUSD in the same process as ovrtx, you must use the same version of OpenUSD as the one used to build ovrtx. This means that you must use OpenUSD v25.11, built as non-monolithic libraries with Python support enabled (the default). You must also use oneTBB v2021.13.0 or later when building OpenUSD.
This limitation will be lifted in a future version of ovrtx.
ovrtx#
- class ovrtx.DataAccess[source]#
Bases:
IntEnumData access mode for attribute write operations.
SYNC copies input data immediately so the caller’s buffer can be reused. ASYNC references the caller’s buffer until the operation completes (zero-copy).
Values mirror the
OVRTX_DATA_ACCESS_*constants from the C API.- ASYNC = 0#
- SYNC = 1#
- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- class ovrtx.Device[source]#
Bases:
IntEnumDevice type for attribute mapping and render output mapping.
Values mirror the
OVRTX_MAP_DEVICE_TYPE_*constants from the C API.- CPU = 1#
- CUDA = 2#
- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- class ovrtx.DLDataType[source]#
Bases:
StructureDescriptor of data type for elements of DLTensor.
- TYPE_MAP = {'bfloat16': (4, 16, 1), 'float16': (2, 16, 1), 'float32': (2, 32, 1), 'float32x4': (2, 32, 4), 'float64': (2, 64, 1), 'int16': (0, 16, 1), 'int32': (0, 32, 1), 'int64': (0, 64, 1), 'int8': (0, 8, 1), 'uint16': (1, 16, 1), 'uint32': (1, 32, 1), 'uint64': (1, 64, 1), 'uint8': (1, 8, 1), 'uint8x4': (1, 8, 4)}#
- classmethod from_str(type_name, lanes=None)[source]#
Create DLDataType from string name with optional lanes override.
- Parameters:
- Returns:
DLDataType instance.
- Raises:
ValueError – If type_name is not recognized.
- Return type:
Example
>>> DLDataType.from_str("int32") # int32, lanes=1 >>> DLDataType.from_str("float32", lanes=3) # float3 for points >>> DLDataType.from_str("float64", lanes=3) # double3 for points
- __init__(*args, **kwargs)#
- __new__(**kwargs)#
- bits#
Structure/Union member
- code#
Structure/Union member
- lanes#
Structure/Union member
- class ovrtx.PrimMode[source]#
Bases:
IntEnumPrim binding mode controlling how prim paths are resolved.
Values mirror the
OVRTX_BINDING_PRIM_MODE_*constants from the C API.- EXISTING_ONLY = 0#
- MUST_EXIST = 1#
- CREATE_NEW = 2#
- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- class ovrtx.Semantic[source]#
Bases:
IntEnumAttribute semantic type for write, bind, and map operations.
Specifies the interpretation of attribute data. For write methods, the semantic can often be omitted — the element type is inferred from the input data. For bind/map methods,
dtype/shapeis the recommended alternative for standard tensor types. Explicit semantics are required for packed struct types which have nodtype/shapeequivalent.- NONE = 0#
- XFORM_MAT4x4 = 1#
- PATH_STRING = 4#
- TOKEN_STRING = 5#
- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- class ovrtx.Renderer[source]#
Bases:
objectHigh-level Pythonic renderer for OVRTX.
Wraps the C library with automatic resource management. Resources are cleaned up automatically when the renderer goes out of scope.
Enum types for method parameters are accessible as class attributes (e.g.,
Renderer.PrimMode.EXISTING_ONLY) or via top-level imports (e.g.,from ovrtx import PrimMode).Example
from ovrtx import Renderer, RendererConfig # Use defaults renderer = Renderer() # Or customize config = RendererConfig(sync_mode=True, log_file_path="/path/to/app.log") renderer = Renderer(config=config) # Resources automatically cleaned up when renderer goes out of scope
- class Semantic#
Bases:
IntEnumAttribute semantic type for write, bind, and map operations.
Specifies the interpretation of attribute data. For write methods, the semantic can often be omitted — the element type is inferred from the input data. For bind/map methods,
dtype/shapeis the recommended alternative for standard tensor types. Explicit semantics are required for packed struct types which have nodtype/shapeequivalent.- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- NONE = 0#
- XFORM_MAT4x4 = 1#
- PATH_STRING = 4#
- TOKEN_STRING = 5#
- class PrimMode#
Bases:
IntEnumPrim binding mode controlling how prim paths are resolved.
Values mirror the
OVRTX_BINDING_PRIM_MODE_*constants from the C API.- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- EXISTING_ONLY = 0#
- MUST_EXIST = 1#
- CREATE_NEW = 2#
- class DataAccess#
Bases:
IntEnumData access mode for attribute write operations.
SYNC copies input data immediately so the caller’s buffer can be reused. ASYNC references the caller’s buffer until the operation completes (zero-copy).
Values mirror the
OVRTX_DATA_ACCESS_*constants from the C API.- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- ASYNC = 0#
- SYNC = 1#
- class Device#
Bases:
IntEnumDevice type for attribute mapping and render output mapping.
Values mirror the
OVRTX_MAP_DEVICE_TYPE_*constants from the C API.- __format__(format_spec)#
Returns format using actual value type unless __str__ has been overridden.
- __new__(value)#
- conjugate()#
Returns self, the complex conjugate of any int.
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- to_bytes(length, byteorder, *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- from_bytes(byteorder, *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.
- signed
Indicates whether two’s complement is used to represent the integer.
- as_integer_ratio()#
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real#
the real part of a complex number
- imag#
the imaginary part of a complex number
- numerator#
the numerator of a rational number in lowest terms
- denominator#
the denominator of a rational number in lowest terms
- CPU = 1#
- CUDA = 2#
- __init__(config=None)[source]#
Create a new renderer instance.
- Parameters:
config (RendererConfig | None) – Optional renderer configuration. If None, uses default configuration.
- Raises:
RuntimeError – If the renderer cannot be created.
- add_usd(usd_file_path, path_prefix=None)[source]#
Add a USD file to the renderer (synchronous).
Blocks until the USD file is fully loaded.
- Parameters:
- Returns:
USD handle for the loaded stage.
- Raises:
RuntimeError – If renderer is invalid, enqueue fails, or loading fails.
- Return type:
Example
usd_handle = renderer.add_usd("/path/to/scene.usda")
- add_usd_async(usd_file_path, path_prefix=None)[source]#
Add a USD file to the renderer (asynchronous).
Returns immediately with an Operation for manual control. Advanced users can use this for custom timeout handling or polling.
- Parameters:
- Returns:
Operation that can be polled or waited on with custom timeout.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
- Return type:
Operation[Any]
Example
# Poll with custom timeout op = renderer.add_usd_async("/path/to/scene.usda") usd_handle = op.wait(timeout_ns=1_000_000_000) # 1 second if usd_handle is None: print("Still loading...") else: print(f"Loaded: {usd_handle}")
- add_usd_layer(usd_layer_content, path_prefix=None)[source]#
Add inline USD layer content to the renderer (synchronous).
Blocks until the USD layer is fully loaded.
- Parameters:
- Returns:
USD handle for the loaded layer.
- Raises:
RuntimeError – If renderer is invalid, enqueue fails, or loading fails.
ValueError – If usd_layer_content is empty.
- Return type:
Example
renderer.add_usd("/path/to/scene.usda") renderer.add_usd_layer(''' #usda 1.0 (defaultPrim = "Render") def Scope "Render" { def RenderProduct "Camera" { rel camera = </World/Camera> } } ''', path_prefix="/Render")
- add_usd_layer_async(usd_layer_content, path_prefix=None)[source]#
Add inline USD layer content to the renderer (asynchronous).
Returns immediately with an Operation for manual control.
- Parameters:
- Returns:
Operation that can be polled or waited on with custom timeout.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
ValueError – If usd_layer_content is empty.
- Return type:
Operation[Any]
Example
op = renderer.add_usd_layer_async(''' #usda 1.0 (defaultPrim = "Inline") def Xform "Inline" { ... } ''', path_prefix="/Inline") op.wait()
- remove_usd(usd_handle)[source]#
Remove a previously added USD from the runtime stage.
- Parameters:
usd_handle (Any) – Handle returned from add_usd() or add_usd_layer().
- Raises:
RuntimeError – If the removal fails.
- Return type:
None
- remove_usd_async(usd_handle)[source]#
Remove a previously added USD (async).
- Parameters:
usd_handle (Any) – Handle returned from add_usd() or add_usd_layer().
- Returns:
Operation that completes when USD is removed.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
- Return type:
Operation[None]
- update_from_usd_time(usd_time)[source]#
Update runtime stage to a specific USD time.
Updates all time-sampled attributes in the runtime stage to the provided USD time. Use this for animated USD scenes to evaluate attributes at different times.
- Parameters:
usd_time (float) – USD time to update the stage to.
- Raises:
RuntimeError – If the update fails.
- Return type:
None
- clone_usd(source_path, target_paths)[source]#
Clone a USD subtree to one or more target paths.
Creates copies of the prim at source_path at each target path.
- Parameters:
- Raises:
RuntimeError – If the clone operation fails.
ValueError – If target_paths is empty.
- Return type:
None
- clone_usd_async(source_path, target_paths)[source]#
Clone a USD subtree (async).
- Parameters:
- Returns:
Operation that completes when cloning is done.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
ValueError – If target_paths is empty.
- Return type:
Operation[None]
- step(render_products, delta_time)[source]#
Step the renderer (synchronous - blocks until complete).
Enqueues a step operation, waits for rendering to complete, and returns results. This is the simple, blocking interface suitable for most use cases.
- Parameters:
- Returns:
RenderProductSetOutputs with rendering results.
- Raises:
RuntimeError – If renderer is invalid, enqueue fails, or rendering fails.
ValueError – If no valid render products provided.
- Return type:
RenderProductSetOutputs[Any]
Example
products = renderer.step(render_products={"/Render/..."}, delta_time=0.1) for product_name, product in products.products.items(): print(f"Rendered {product_name}")
- step_async(render_products, delta_time)[source]#
Step the renderer (asynchronous - returns immediately).
Enqueues a step operation and returns result for advanced control. Use this for custom timeout handling or polling.
- Parameters:
- Returns:
RendererResult that can be waited on with custom timeouts.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
ValueError – If no valid render products provided.
- Return type:
Example
result = renderer.step_async(render_products={"/Render/..."}, delta_time=0.1) # Poll without blocking metadata = result.wait(step_timeout_ns=0) if metadata is None: print("Still rendering...") else: print("Done!")
- reset(time=0.0)[source]#
Reset sensor simulation history to a specific time.
Clears accumulated rendering history for all render products and sets the simulation start time for future step() calls.
- Parameters:
time (float) – Simulation time to reset to (default: 0.0).
- Raises:
RuntimeError – If the reset fails.
- Return type:
None
- reset_async(time=0.0)[source]#
Reset sensor simulation history (async).
- Parameters:
time (float) – Simulation time to reset to (default: 0.0).
- Returns:
Operation that completes when reset is done.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
- Return type:
Operation[None]
- reset_stage()[source]#
Reset stage to empty state.
Clears all USD content from the runtime stage. After this call, the stage will be empty and new USD content can be loaded.
- Raises:
RuntimeError – If the reset fails.
- Return type:
None
- reset_stage_async()[source]#
Reset stage to empty state (async).
- Returns:
Operation that completes when stage is cleared.
- Raises:
RuntimeError – If renderer is invalid or enqueue fails.
- Return type:
Operation[None]
- write_attribute(
- prim_paths,
- attribute_name,
- tensor,
- semantic=Semantic.NONE,
- dirty_bits=None,
- prim_mode=PrimMode.EXISTING_ONLY,
- data_access=DataAccess.SYNC,
- cuda_stream=None,
- cuda_event=None,
Write scalar attribute data synchronously.
Pass data directly — the element type and component count are inferred automatically from the input:
Tensor input (NumPy, Warp, or any
__dlpack__-compatible object): the element type is derived from the array’s dtype and shape. For example, afloat32array with shape(N, 3)is interpreted as a 3-component float attribute.String input (
list[str]): automatically written as a token string attribute. One string per prim.
For repeated writes to the same attribute, consider using
bind_attribute()followed bybinding.write()for better performance.- Parameters:
attribute_name (str) – Name of the attribute.
tensor (Any) – A NumPy array, Warp array, or any
__dlpack__-compatible object. One element per prim. For token strings, pass alist[str]instead.semantic (Semantic) – Optional attribute semantic (e.g.,
Semantic.XFORM_MAT4x4). When omitted (default), the element type is inferred from the input data.dirty_bits (bytes | None) – Optional dirty bit array for selective updates.
prim_mode (PrimMode) – Prim binding mode (e.g.,
PrimMode.EXISTING_ONLY).data_access (DataAccess) – Data access mode.
DataAccess.SYNC(default) copies input data immediately so the caller’s buffer can be reused after this call returns.DataAccess.ASYNCreferences the caller’s buffer until the operation completes (zero-copy). Not allowed with string data.cuda_stream (int | None) – CUDA stream handle (
int) for GPU synchronization.cuda_event (int | None) – CUDA event handle (
int) for GPU synchronization.
- Raises:
RuntimeError – If renderer is invalid or write fails.
ValueError – If invalid parameters.
TypeError – If tensor type is not supported, or if string data is not a
list[str].
- Return type:
None
Example
import numpy as np # Tensor writes — just pass the array points = np.random.randn(N, 3).astype(np.float32) renderer.write_attribute(prim_paths, "points", points) matrices = np.tile(np.eye(4, dtype=np.float64), (N, 1, 1)) renderer.write_attribute(prim_paths, "xformOp:transform", matrices) # Token strings — auto-detected from list[str] renderer.write_attribute(prim_paths, "displayName", ["Cube", "Sphere"])
- write_array_attribute(
- prim_paths,
- attribute_name,
- tensors,
- semantic=Semantic.NONE,
- is_token=False,
- dirty_bits=None,
- prim_mode=PrimMode.EXISTING_ONLY,
- data_access=DataAccess.SYNC,
- cuda_stream=None,
- cuda_event=None,
Write array attribute data synchronously.
Pass data directly — the element type and component count are inferred automatically from the input:
Tensor input: Each tensor corresponds to one prim. The element type is derived from the array’s dtype and shape. Lengths may differ per prim.
String input (
list[list[str]]): defaults to path/relationship arrays. Setis_token=Truefor token arrays (e.g.,xformOpOrder,apiSchemas).
- Parameters:
attribute_name (str) – Name of the array attribute.
tensors (List[Any]) – List of tensors (NumPy arrays, Warp arrays, or any
__dlpack__-compatible object), one per prim. Lengths may differ but element dtype must match the USD attribute schema. For string arrays, passlist[list[str]]instead.semantic (Semantic) – Optional attribute semantic (e.g.,
Semantic.PATH_STRING). When omitted (default), the element type is inferred from the input data.is_token (bool) – When passing
list[list[str]]data, setTrueto write token arrays instead of path/relationship arrays. Ignored for tensor data. DefaultFalse.dirty_bits (bytes | None) – Optional dirty bit array for selective updates.
prim_mode (PrimMode) – Prim binding mode (e.g.,
PrimMode.EXISTING_ONLY).data_access (DataAccess) – Data access mode.
DataAccess.SYNC(default) copies input data immediately.DataAccess.ASYNCreferences the caller’s buffer until the operation completes (zero-copy). Not allowed with string data.cuda_stream (int | None) – CUDA stream handle (
int) for GPU synchronization.cuda_event (int | None) – CUDA event handle (
int) for GPU synchronization.
- Raises:
RuntimeError – If renderer is invalid or write fails.
ValueError – If invalid parameters or dtype mismatch.
TypeError – If any tensor type is not supported, or if string data is not
list[str].
- Return type:
None
Note
Tensor dtype must exactly match the USD attribute’s element type:
int[]→np.int32float3[]→np.float32with shape(N, 3)double3[]→np.float64with shape(N, 3)
Example
import numpy as np # Tensor array write face_counts = np.array([4, 4, 4], dtype=np.int32) renderer.write_array_attribute(["/World/Mesh"], "faceVertexCounts", [face_counts]) # Relationship arrays — default for list[list[str]] renderer.write_array_attribute(["/World/Mesh"], "material:binding", [["path1", "path2"]]) # Token arrays — explicit is_token override renderer.write_array_attribute(["/World/Mesh"], "xformOpOrder", [["xformOp:translate", "xformOp:rotateXYZ"]], is_token=True)
- write_attribute_async(
- prim_paths,
- attribute_name,
- tensor,
- semantic=Semantic.NONE,
- dirty_bits=None,
- prim_mode=PrimMode.EXISTING_ONLY,
- data_access=DataAccess.SYNC,
- cuda_stream=None,
- cuda_event=None,
Write scalar attribute data asynchronously.
See
write_attribute()for full documentation and examples.- Returns:
Operation for async control (yields None on completion).
- Parameters:
- Return type:
Operation[None]
- write_array_attribute_async(
- prim_paths,
- attribute_name,
- tensors,
- semantic=Semantic.NONE,
- is_token=False,
- dirty_bits=None,
- prim_mode=PrimMode.EXISTING_ONLY,
- data_access=DataAccess.SYNC,
- cuda_stream=None,
- cuda_event=None,
Write array attribute data asynchronously.
See
write_array_attribute()for full documentation and examples.- Returns:
Operation for async control (yields None on completion).
- Parameters:
- Return type:
Operation[None]
- bind_attribute(
- prim_paths,
- attribute_name,
- dtype=None,
- shape=None,
- semantic=Semantic.NONE,
- prim_mode=PrimMode.EXISTING_ONLY,
Create a persistent binding for scalar attribute writes.
Creates a binding handle that can be reused for multiple write() calls, avoiding the overhead of recreating the binding descriptor each time.
Specify the attribute type using
dtypeand optionallyshape:Tensor types:
dtype="float32", shape=(3,)forpoint3f,dtype="float64", shape=(4, 4)formatrix4d, etc.String types:
dtype="token"ordtype="path".Scalars:
dtype="int32"(no shape needed).
- Parameters:
attribute_name (str) – Name of the attribute.
dtype (Any | None) – Element type. Accepts string names (
"float32","float64","int32","token","path"), NumPy dtypes (np.float32,np.dtype("float64")), any dtype object with.kind/.itemsizeattributes (CuPy, JAX), Python built-ins (float,int), or aDLDataTypeobject.shape (tuple | None) – Element shape tuple (e.g.
(3,)for 3-component vectors,(4, 4)for matrices). Mandatory for multi-component types when using numpy dtypes or string names. Omit for scalars. Ignored for string types andDLDataType.semantic (Semantic) – Optional attribute semantic (e.g.,
Semantic.XFORM_MAT4x4). Alternative todtype/shapefor specifying the attribute type.prim_mode (PrimMode) – Prim binding mode (e.g.,
PrimMode.EXISTING_ONLY).
- Returns:
AttributeBinding[DLTensor] for scalar attribute writes.
- Return type:
AttributeBinding[DLTensor]
Example
# String form — no imports needed for dtype specification: binding = renderer.bind_attribute( ["/World/Cube"], "xformOp:transform", dtype="float64", shape=(4, 4)) # NumPy dtype objects also work: import numpy as np binding = renderer.bind_attribute( ["/World/Cube"], "visibility", dtype=np.int32)
- bind_attribute_async(
- prim_paths,
- attribute_name,
- dtype=None,
- shape=None,
- semantic=Semantic.NONE,
- prim_mode=PrimMode.EXISTING_ONLY,
Create a persistent binding for scalar attribute writes (async).
See
bind_attribute()for full documentation and examples.
- bind_array_attribute(
- prim_paths,
- attribute_name,
- dtype=None,
- shape=None,
- prim_mode=PrimMode.EXISTING_ONLY,
Create a persistent binding for array attribute writes.
Array attributes (e.g.,
float3[] points) may have variable lengths per prim. The binding locks in the element dtype; subsequent writes can have varying tensor lengths but must use the same element type.- Parameters:
attribute_name (str) – Name of the array attribute.
dtype (Any | None) – Element type. Accepts string names (
"float32","float64","int32","token","path"), NumPy dtypes (np.float32,np.dtype("float64")), any dtype object with.kind/.itemsizeattributes (CuPy, JAX), Python built-ins (float,int), or aDLDataTypeobject.shape (tuple | None) – Element shape tuple (e.g.
(3,)forfloat3[]). Mandatory for multi-component types when using numpy dtypes or string names. Ignored for string types andDLDataType.prim_mode (PrimMode) – Prim binding mode (e.g.,
PrimMode.CREATE_NEW).
- Returns:
AttributeBinding[List[DLTensor]] for array attribute writes.
- Return type:
AttributeBinding[List[DLTensor]]
Example
# String form — no imports needed for dtype specification: binding = renderer.bind_array_attribute( ["/World/Mesh"], "faceVertexCounts", dtype="int32") binding = renderer.bind_array_attribute( ["/World/Mesh"], "points", dtype="float32", shape=(3,)) # NumPy dtype objects also work: import numpy as np binding = renderer.bind_array_attribute( ["/World/Mesh"], "normals", dtype=np.float32, shape=(3,))
- bind_array_attribute_async(
- prim_paths,
- attribute_name,
- dtype=None,
- shape=None,
- prim_mode=PrimMode.EXISTING_ONLY,
Create a persistent binding for array attribute writes (async).
See
bind_array_attribute()for full documentation and examples.
- map_attribute(
- prim_paths,
- attribute_name,
- dtype=None,
- shape=None,
- semantic=Semantic.NONE,
- device=Device.CPU,
- device_id=0,
- prim_mode=PrimMode.EXISTING_ONLY,
Map attribute buffer for direct writes (synchronous, by-name).
Returns an AttributeMapping that provides access to an internal buffer. Write data using NumPy, Warp, or any
__dlpack__-compatible library, then callunmap_attribute()to apply the changes.When
dtype/shapeare provided, the returned tensor is automatically shaped to match. For example,dtype="float32", shape=(3,)returns a tensor with shape(N, 3)andfloat32dtype, ready for direct NumPy/Warp consumption.Note
Array attributes (e.g.,
float3[] points) are not supported for mapping. Usewrite_array_attribute()instead.- Parameters:
attribute_name (str) – Name of the attribute.
dtype (Any | None) – Element type. Accepts string names (
"float32","float64","int32","token","path"), NumPy dtypes (np.float32,np.dtype("float64")), any dtype object with.kind/.itemsizeattributes (CuPy, JAX), Python built-ins (float,int), or aDLDataTypeobject.shape (tuple | None) – Element shape tuple (e.g.
(3,)for 3-component vectors,(4, 4)for matrices). When provided, the mapped tensor is reshaped to(N, *shape). Ignored forDLDataType.semantic (Semantic) – Optional attribute semantic (e.g.,
Semantic.XFORM_MAT4x4). Alternative todtype/shapefor specifying the attribute type.device (Device) – Device for mapping (
Device.CPUorDevice.CUDA).device_id (int) – Device ID (default 0, typically GPU index for CUDA).
prim_mode (PrimMode) – Prim binding mode (e.g.,
PrimMode.EXISTING_ONLY).
- Returns:
AttributeMapping with access to the internal buffer. When
shapewas provided, the tensor has dimensions(N, *shape)with a scalar element dtype, ready for NumPy/Warp consumption.- Raises:
RuntimeError – If renderer is invalid or mapping fails.
ValueError – If invalid parameters or dtype mismatch.
- Return type:
AttributeMapping
Example
import numpy as np # String form — no imports needed for dtype specification: mapping = renderer.map_attribute( ["/World/Cube"], "xformOp:transform", dtype="float64", shape=(4, 4)) np.from_dlpack(mapping.tensor)[0] = np.eye(4) renderer.unmap_attribute(mapping) # NumPy dtype objects also work: with renderer.map_attribute(["/World/Cube"], "points", dtype=np.float32, shape=(3,)) as mapping: np.from_dlpack(mapping.tensor)[:] = new_points
- unmap_attribute(mapping, event=None, stream=None)[source]#
Unmap attribute and apply written data (synchronous - waits internally).
Applies the data written to the mapped buffer to the stage representation and destroys the mapping. After this call, the mapping is invalid.
For CUDA-mapped attributes, you can provide a CUDA event or stream handle to synchronize with ongoing GPU work before the data is consumed.
- Parameters:
mapping (AttributeMapping) – AttributeMapping from map_attribute()
event (int | None) – CUDA event handle to wait on before accessing data (from wp.Event.cuda_event). The C library will wait for this event before reading the mapped data.
stream (int | None) – CUDA stream handle for synchronization (from wp.Stream.cuda_stream). The C library will synchronize on this stream before reading the data.
- Raises:
RuntimeError – If renderer is invalid or unmap fails
ValueError – If event/stream provided for CPU-mapped attribute
ValueError – If both event and stream provided (mutually exclusive)
- Return type:
None
Note
Data must be fully written to mapping.tensor before calling this. The mapping cannot be used after unmap.
- unmap_attribute_async(mapping, event=None, stream=None)[source]#
Unmap attribute asynchronously (returns Operation for manual control).
Enqueues unmap operation and returns immediately. Use for advanced async control.
For CUDA-mapped attributes, you can provide a CUDA event or stream handle to synchronize with ongoing GPU work before the data is consumed.
- Parameters:
- Returns:
Operation[None] for async control
- Raises:
RuntimeError – If renderer is invalid or unmap fails
- Return type:
Operation[None]
Note
After wait() completes, set mapping._unmapped = True manually. Validation of event/stream parameters should be done in the caller (unmap_attribute).
- property config: RendererConfig#
Get the configuration used to create this renderer.
- class ovrtx.RendererResult[source]#
Bases:
Generic[T]Result of a renderer step operation.
Provides access to rendering metadata via wait().
- Usage:
result = renderer.step_async(...) metadata = result.wait() # Block until ready # Or poll without blocking metadata = result.wait(step_timeout_ns=0) if metadata is None: print("Not ready yet")
- __init__(operation)[source]#
Internal: Created by Renderer.step_async().
- Parameters:
operation (Operation[T]) – The step operation with renderer-specific handle
- property step_complete: bool#
Check if step operation has completed.
Useful for diagnosing which stage timed out when wait() returns None.
- Returns:
True if step completed (regardless of fetch status), False otherwise.
Example
metadata = result.wait(step_timeout_ns=1000, fetch_timeout_ns=500) if metadata is None: if not result.step_complete: print("Step timed out - increase step_timeout_ns") else: print("Fetch timed out - increase fetch_timeout_ns")
- wait(step_timeout_ns=None, fetch_timeout_ns=None)[source]#
Wait for step operation and fetch rendering results.
Two-stage operation with independent timeout control:
- Step operation: Raytracing/GPU work
If times out, returns None immediately without attempting fetch
- Fetch operation: Memory transfer (only if step completed)
If times out, returns None
- Parameters:
- Returns:
RenderProductSetOutputs if both stages complete, None if either times out.
The returned results auto-destroy their C resources when they go out of scope. Can be used as context manager for explicit control. Returns cached results on subsequent calls (idempotent).
- Raises:
RuntimeError – If step or fetch operation failed.
- Return type:
RenderProductSetOutputs[T] | None
Examples
# Infinite wait (most common - never returns None) metadata = result.wait() assert metadata is not None # Poll step without blocking (returns immediately) metadata = result.wait(step_timeout_ns=0) if metadata is None: print("Step not ready yet") # Fetch never attempted # Custom timeouts for both stages metadata = result.wait( step_timeout_ns=5_000_000_000, # 5 seconds for raytracing fetch_timeout_ns=100_000_000 # 100ms for memory transfer ) if metadata is None: # Use step_complete property to diagnose which stage timed out if not result.step_complete: print("Step timed out") else: print("Fetch timed out (step complete)")
- class ovrtx.RendererConfig[source]#
Bases:
objectovrtx renderer configuration.
- log_level: str | None = None#
“verbose”, “info”, “warn”, “error”.
- Type:
Set the log level for logging output
- __init__(
- sync_mode=None,
- log_file_path=None,
- log_level=None,
- enable_profiling=None,
- read_gpu_transforms=None,
- output_partial_frames=None,
- keep_system_alive=None,
- active_cuda_gpus=None,
- output_partial_frames: bool | None = None#
Output partial frames for incremental sensors. When disabled, only full frames are returned.
ovrtx.math#
Math types for ovrtx (public API).
This module provides math types like Matrix4d for use with ovrtx attribute operations.
- class ovrtx.math.Matrix4d[source]#
Bases:
Structure4x4 double-precision matrix (compatible with usdrt::GfMatrix4d).
Memory layout: 16 doubles in row-major order (128 bytes). Compatible with C++ usdrt::GfMatrix4d = omni::math::linalg::matrix4<double>.
Example
from ovrtx.math import Matrix4d # Create identity matrix m = Matrix4d() m.SetIdentity() # Access elements m[0][0] = 99.0 # Use with write_attribute from ovrtx import Semantic renderer.write_attribute( prim_paths=["/World/Cube"], attribute_name="omni:xform", tensor=m.to_dltensor(), semantic=Semantic.XFORM_MAT4x4, )
- SetScale(s)[source]#
Set matrix to uniform scale matrix.
- Parameters:
s (float) – Scale factor
- Return type:
None
- __getitem__(row)[source]#
Access matrix row.
- Parameters:
row (int) – Row index (0-3)
- Returns:
Row array (supports [row][col] indexing)
- __setitem__(row, value)[source]#
Set matrix row.
- Parameters:
row (int) – Row index (0-3)
value – Row data (list or array of 4 doubles)
- to_dltensor()[source]#
Create DLTensor for this matrix (for use with Renderer.write_attribute).
Returns a DLTensor with the format expected by the C library: - shape[0] = 1 (one matrix) - dtype.lanes = 16 (16 doubles per matrix) - dtype.bits = 64 - dtype.code = kDLFloat
- Returns:
DLTensor pointing to this matrix’s data
- Return type:
DLTensor
- v#
Structure/Union member