OmniGraph: Process bundle input

I want to implement an OmniGraph node in Python. It should get a bundle as an input, this bundle can contain multiple prims.

How can I extract the prims from the bundle input inside the node’s compute(db) function?

Thanks
Bruno

Hi @bruno.vetter. Have you taken a look at these two tutorials?

Yes, I have. These tutorials do not cover how to work with bundles containing a set of prims. For example, the Ros Publisher Nodes accept a bundle named targetPrims, containing one or more prims. When I try to process such a bundle input inside my compute function, the attributes property returns an empty list. Looking at the OmniGraph docs, there seem to be a concept of having bundles inside bundles, but I am not sure if this is what I am looking for. I haven‘t found any code samples covering this.

Thanks Bruno. I’ll reach out to the OmniGraph team for you.

Hi! Sincere apologizes for the delay. Here is an example OGN and Python node:

The OgnBundleInputExample.ogn file:

{
    "BundleInputExample": {
        "version": 1,
        "description": "Example node of bundle input",
        "language": "Python",
        "exclude": ["usd", "docs"],
        "categories": "internal:test",
        "uiName": "Example Node: Bundle Input",
        "inputs": {
            "prims": {
                "type": "bundle",
                "description": [ "Input Primitives in Bundle" ]
            }
        },
        "outputs": {
            "count": {
                "type": "int",
                "description": [ "Number of Input Primitives in Bundle" ]
            }
        }
    }
}

The OgnBundleInputExample.py file:

class OgnBundleInputExample:
    @staticmethod
    def compute(db) -> bool:
        input_bundle = db.inputs.prims.bundle
        child_bundles = input_bundle.get_child_bundles()
        db.outputs.count = len(child_bundles)
        return True

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.