Hydra Generative Procedural

Hi all,

I’m trying to put together a simple Hydra Generative Procedural plugin using the current release build of OpenUSD. I’ve copied the CubePerMeshPointProcedural from the Hydra tests to keep it simple, but I just can’t seem to get UsdView to expand/load the shared object and I’m not sure why?

I’ve set

export HDGP_INCLUDE_DEFAULT_RESOLVER=1
export USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1

and the plugInfo.json file is being found as I get errors when it’s malformed. When using TF_DEBUG=”PLUG*” I get

Will read plugin info /sandbox/CubePerMeshPointProcedural/build/plugInfo.json
Did read plugin info /sandbox/CubePerMeshPointProcedural/build/plugInfo.json
Registering shared library plugin ‘CubePerMeshPointProcedural’ at ‘/sandbox/CubePerMeshPointProcedural/build/libCubePerMeshPointProcedural.dylib’.

and with export TF_DEBUG=“USDIMAGING*” I get

[PluginLoad] Loaded plugin ‘Mesh’ > ‘UsdImagingMeshAdapter’
[PluginLoad] Loaded plugin ‘GenerativeProcedural’ >
‘UsdProcImagingGenerativeProceduralAdapter’

So it seems as if it’s finding the plugInfo.json but the prim ends up being resolved to an inertGenerativeProcedural when I inspect the Hydra debugger.

I decided to put a static instance of a class that just prints out a test string and it appears that it’s never called so I don’t think the shared object is ever opened?
I’ve tested it on both Windows and macOS, it has left me a little stumped - I’ve pushed the test to GitHub - PeregrineLabs/CubePerMeshPointProcedural for reference, if you set pxr_DIR to a build of OpenUSD it should build easily.

Any insight would be greatly appreciated.

Thank you

Just as a quick follow up, monkeying around with the source I can confirm that the plugInfo is being loaded and added to the registry.
It doesn’t appear that an instance of UsdHyrdaGenerativeProceduralAPI is ever created which means that a reference to my generative procedural plugin is never requested thus PlugPlugin::_Load() is never called.

It appears that I needed to explicitly add

    token proceduralSystem = "hydraGenerativeProcedural"

to my GenerativeProcedural. I’m not sure if it’s a change in the schema or an issue in how it’s resolved but the default value doesn’t seem to be passed to the scene adapter (which was just returning and empty string).

It would be great to validate my findings, is this a required token now? For some reason I thought it would default to the schema’s value?

Thank you!

I haven’t touched GenProc yet but I did see the other day that weta has a pull request using genProc if it helps :slight_smile:

Thank you for the suggestion, I did see this but it’s from some time ago - from my digging it appears there was an AdapterRegistry refactor made that seems to be impacting this. My knowledge of the source or intention isn’t deep enough to pick apart where.

AsyncBegin and AsyncUpdate have also been added since a lot of the examples and I suspect the way forward but no examples (or tests) actually using that part of the API at the moment.

Hi ColinD,

I’m arriving a bit late to be of any help, probably, but do you explicitly use the HydraGenerativeProceduralAPI schema? Something like this:

def GenerativeProcedural "glorp" (
prepend apiSchemas = ["HydraGenerativeProceduralAPI"]
)
{
# etc.
}

The HydraGenerativeProceduralAPI schema sets the default value of proceduralSystem.