BundleChanges

class omni.graph.core.BundleChanges(bundle_changes: IBundleChanges, bundle: IConstBundle2, clear_at_exit: bool = True)

Bases: object

—– FOR USE BY GENERATED CODE ONLY —–

BundleChanges is designed for inspecting modifications within a bundle during its lifetime.

The BundleChanges class enables the inspection of changes in a bundle’s attributes and child bundles during the lifetime of the BundleChanges instance. It keeps a record of modifications that have occurred, providing a suite of functionalities to inspect these changes.

An important aspect of the BundleChanges class is that it automatically clears the changes upon its destruction, i.e., when the instance goes out of scope. This ensures that the lifetime of the recorded changes is tied to the lifetime of the BundleChanges instance.

Example usage:

def compute(db) -> bool:
with db.inputs.bundle.changes() as bundle_changes:
if bundle_changes:

# inspect changes

else:

return True # early exit, no changes

Methods

__init__(bundle_changes, bundle[, clear_at_exit])

Initialize bundle change tracking system for a bundle

activate()

Activates the change tracking system for a bundle.

clear_changes()

Clears the recorded changes.

deactivate()

Deactivates the change tracking system for a bundle.

get_change(entry)

Retrieves the change status of a abundle or attribute.

has_changed()

Checks if the bundle has changed.

__init__(bundle_changes: IBundleChanges, bundle: IConstBundle2, clear_at_exit: bool = True)

Initialize bundle change tracking system for a bundle

Parameters
  • context – Evaluation context from which this bundle was extracted

  • bundle – Bundle for which changes are being tracked

activate()

Activates the change tracking system for a bundle.

This method controls the change tracking system of a bundle. It’s only applicable for read-write bundles (when readOnly template parameter is false). For read-only bundles, this method will cause a compilation error if called.

clear_changes()

Clears the recorded changes.

This method is used to manually clear the recorded changes of the bundle.

deactivate()

Deactivates the change tracking system for a bundle.

This method controls the change tracking system of a bundle. It’s only applicable for read-write bundles (when readOnly template parameter is false). For read-only bundles, this method will cause a compilation error if called.

get_change(entry: Union[BundleContents, RuntimeAttribute, AttributeData, IConstBundle2])

Retrieves the change status of a abundle or attribute.

This method is used to check if a specific bundle or attribute has been modified within the lifetime of the BundleChanges instance.

Parameters

entry – None, RuntimeAttribute or BundleContents to check if dirty.

has_changed()

Checks if the bundle has changed.

This method is used to check if any changes have been made to the bundle’s attributes or child bundles within the lifetime of the BundleChanges instance.