Houdini Engine 6.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Caching

Houdini Caches

Houdini uses caching in several different areas to speed things up. For example, there is a SOP Cache that stores intermediate results for faster re-cooks. To see a list of all active caches in Houdini just go to Windows > Cache Manager.

To get that list of active caches from within HAPI you can call these two pair functions:

There is a list of standard cache names in form of defines:

To get information on a given cache, like current usage and maximum limit, call:

with the appropriate HAPI_CacheProperty

Conversely, to set properties on a cache call:

Of note here is that setting the HAPI_CACHEPROP_CURRENT to 0 will clear the cache.

Here's a quick example of getting and setting a property on a cache:

int sop_max_cache = 0;
&sop_max_cache );
HAPI_TEST_ASSERT( result == HAPI_RESULT_SUCCESS );
HAPI_TEST_ASSERT( sop_max_cache == 1024 );
hapiTestSession, HAPI_CACHE_SOP, HAPI_CACHEPROP_MAX, 2048 );
HAPI_TEST_ASSERT( result == HAPI_RESULT_SUCCESS );
&sop_max_cache );
HAPI_TEST_ASSERT( result == HAPI_RESULT_SUCCESS );
HAPI_TEST_ASSERT( sop_max_cache == 2048 );

Geometry Caching

Houdini supports saving geometry data to a variety of files, and this functionality can now be accessed through Houdini Engine. Given a unique set of asset, object, and geo ids that identifies a geometry, the data in the geometry may be dumped to either a file or a memory buffer. A corresponding load function can later read the file or memory and put the geometry back onto a node.

Geometry Files

The HAPI_SaveGeoToFile() function takes a file name and saves the geometry to the file. The format of the file will be determined by its extension. Supported formats include:

  • abc
  • bhclassic.lzma
  • bhclassic.bz2
  • bgeo
  • bgeo.bz2
  • bgeo.lzma
  • dxf
  • eps, ai
  • geo.bx2
  • geo.lzma
  • hclassic.bz2
  • hclassic.lzma
  • iges, igs
  • lw, lwo
  • obj
  • ply
  • stl, bstl
  • pc, pmap

To load a geometry file back, use the HAPI_LoadGeoFromFile() function.

Geometry Buffers

To Save geometry to memory, first use the HAPI_GetGeoSize() function to get the size of the buffer required to store the geometry in the format you requested. Note that this operation is stateful, as it will cache the geometry in memory. When the HAPI_SaveGeoToMemory() function is called next, the cached geometry will be copied into the buffer provided. HAPI_LoadGeoFromMemory() is the loading counterpart to put the data back onto a SOP node. Finally, note that as only the bgeo format is native to Houdini, it is the most efficient to save and load. All other formats require an internal conversion mechanism, and the architecture of that system is designed to hit the file system - so those operations will be much slower than saving and loading the bgeo format.