Houdini 20.0 hapi

hapi.loadAssetLibraryFromMemory function

Loads a Houdini asset library (OTL) from memory.

This is when we actually check for valid licenses.

Please note that the performance benefit of loading a library from memory are negligible at best. Due to limitations of Houdini’s library manager, there is still some disk access and file writes because every asset library needs to be saved to a real file. Use this function only as a convenience if you already have the library file in memory and don’t wish to have to create your own temporary library file and then call hapi.loadAssetLibraryFromFile.

The next step is to call hapi.getAvailableAssetCount to get the number of assets contained in the library using the returned library_id. Then call hapi.getAvailableAssets to get the list of available assets by name. Use the asset names with hapi.createNode to actually create one of these nodes in the Houdini scene and get back an asset_id.

The saved HIP file using hapi.saveHIPFile will contain the OTL loaded as part of its Embedded OTLs. This means that you can safely move or rename the original OTL file and the HIP will continue to work but if you make changes to the OTL while using the saved HIP the changes won’t be saved to the original OTL. See hapi.saveHIPFile.

Usage

loadAssetLibraryFromMemory(session: hapi.Session, library_buffer: str, library_buffer_length: int, allow_overwrite: bool) → int

Loads a Houdini asset library (OTL) from memory. It does NOT create anything inside the Houdini scene.

session

The session of Houdini you are interacting with. See hapi.Session for more on sessions. Pass None to just use the default in-process session.

library_buffer

The memory buffer containing the asset definitions in the same format as a standard Houdini .otl file.

library_buffer_length

The size of the OTL memory buffer.

allow_overwrite

With this true, if the library file being loaded contains asset definitions that have already been loaded they will overwrite the existing definitions. Otherwise, a library containing asset definitions that already exist will fail to load, returning a hapi.result of hapi.result.AssetDefAlreadyLoaded.

Returns library_id as a int.

hapi