Bundle

class omni.graph.core.Bundle(attribute_name: str, read_only: bool)

Bases: object

Deferred implementation of the bundle concept

Methods

__init__(attribute_name, read_only)

Initialize the access points for the bundle attribute

attribute_by_name(attribute_name)

Get an attribute by name from the underlying buffer or the buffer masking it.

clear()

Empties out the bundle contents

commit_to_graph_bundle_contents(source, ...)

-------- FOR GENERATED CODE USE ONLY -------- Copy all attributes from the buffer to the runtime BundleContents class.

create_attribute(name, type_desc)

Create an attribute inside the buffered bundle data structure

from_accessor(bundle_contents)

-------- FOR GENERATED CODE USE ONLY -------- Convert a BundleContents object to a python Bundle.

insert(to_insert)

Insert new content in the existing bundle

remove(attribute_name)

Removes the attribute with the given name from the bundle, silently succeeding if it is not in the bundle.

Attributes

attribute_names

Returns the list of interface objects corresponding to the attributes contained within the bundle

is_runtime_resident

name

The bundle's name

runtime_accessor

exposes the runtime bundle accessor.

size

Returns the number of attributes within this bundle, 0 if the bundle is not valid

valid

Returns: True if the underlying bundle is valid, False if the underlying bundle is not valid, None if the

__init__(attribute_name: str, read_only: bool)

Initialize the access points for the bundle attribute

Parameters
  • attribute_name – the bundle’s name. This name will only be used if the bundle is nested.

  • read_only – Is the bundle data read-only?

attribute_by_name(attribute_name: str) Optional[omni.graph.core._impl.runtime.RuntimeAttribute]

Get an attribute by name from the underlying buffer or the buffer masking it.

Parameters

attribute_name – the attribute being queried.

Returns

the named attribute within the bundle, or None if no such attribute exists in the bundle

clear()

Empties out the bundle contents

Raises

og.OmniGraphError if the bundle is not writable

static commit_to_graph_bundle_contents(source: omni.graph.core._impl.bundles.Bundle, bundle_contents: omni.graph.core._impl.bundles.BundleContents)

——– FOR GENERATED CODE USE ONLY ——– Copy all attributes from the buffer to the runtime BundleContents class.

Parameters
  • source – the Bundle object to be copied

  • bundle_contents – the BundleContets object to be copied into into

create_attribute(name: str, type_desc: type) omni.graph.core._impl.bundles.OmniAttribute

Create an attribute inside the buffered bundle data structure

Parameters
  • name – name of the attribute to create

  • type_desc – python type object of the attribute to create. Accepts all Omnigraph types. Will attempt to convert non-omnigraph types, but raise an error if it fails.

Returns

the OmniAttribute it created.

Raises

OmniGraphError if no type conversion was found.

classmethod from_accessor(bundle_contents: omni.graph.core._impl.bundles.BundleContents)

——– FOR GENERATED CODE USE ONLY ——– Convert a BundleContents object to a python Bundle.

Parameters

bundle_contents – the graph object representing the bundle

insert(to_insert: Union[omni.graph.core._impl.bundles.Bundle, omni.graph.core._impl.bundles.OmniAttribute, Tuple[omni.graph.core._impl.bundles.OmniAttribute, str], Tuple[omni.graph.core._omni_graph_core.Type, str]])

Insert new content in the existing bundle

Parameters

to_insert – Object to insert. It can be one of three different types of object: Bundle: Another bundle, whose contents are entirely copied into this one RuntimeAttribute: A single attribute from another bundle to be copied with the same name (RuntimeAttribute, str): A single attribute from another bundle and the name to use for the copy AttributeDescription: Information required to create a brand new typed attribute

Returns

Attribute object of the new attribute if inserting an attribute, else None

remove(attribute_name: str)

Removes the attribute with the given name from the bundle, silently succeeding if it is not in the bundle.

Parameters

attribute_name – attribute to be deleted.

property attribute_names: List[omni.graph.core._impl.bundles.OmniAttribute]

Returns the list of interface objects corresponding to the attributes contained within the bundle

property name

The bundle’s name

property runtime_accessor: omni.graph.core._impl.bundles.BundleContents

exposes the runtime bundle accessor.

Returns

the BundleContents object if it exists, None otherwise.

property size: int

Returns the number of attributes within this bundle, 0 if the bundle is not valid

property valid: Optional[bool]

Returns: True if the underlying bundle is valid, False if the underlying bundle is not valid, None if the