Houdini Engine 3.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Assets

Functions

HAPI_DECL HAPI_LoadAssetLibraryFromFile (const HAPI_Session *session, const char *file_path, HAPI_Bool allow_overwrite, HAPI_AssetLibraryId *library_id)
 Loads a Houdini asset library (OTL) from a .otl file. It does NOT create anything inside the Houdini scene. More...
 
HAPI_DECL HAPI_LoadAssetLibraryFromMemory (const HAPI_Session *session, const char *library_buffer, int library_buffer_length, HAPI_Bool allow_overwrite, HAPI_AssetLibraryId *library_id)
 Loads a Houdini asset library (OTL) from memory. It does NOT create anything inside the Houdini scene. More...
 
HAPI_DECL HAPI_GetAvailableAssetCount (const HAPI_Session *session, HAPI_AssetLibraryId library_id, int *asset_count)
 Get the number of assets contained in an asset library. You should call HAPI_LoadAssetLibraryFromFile() prior to get a library_id. More...
 
HAPI_DECL HAPI_GetAvailableAssets (const HAPI_Session *session, HAPI_AssetLibraryId library_id, HAPI_StringHandle *asset_names_array, int asset_count)
 Get the names of the assets contained in an asset library. More...
 
HAPI_DECL HAPI_GetAssetInfo (const HAPI_Session *session, HAPI_NodeId node_id, HAPI_AssetInfo *asset_info)
 Fill an asset_info struct from a node. More...
 
HAPI_DECL HAPI_GetAssetDefinitionParmCounts (const HAPI_Session *session, HAPI_AssetLibraryId library_id, const char *asset_name, int *parm_count, int *int_value_count, int *float_value_count, int *string_value_count, int *choice_value_count)
 Get the number of asset parameters contained in an asset library, as well as the number of parameter int, float, string, and choice values. More...
 
HAPI_DECL HAPI_GetAssetDefinitionParmInfos (const HAPI_Session *session, HAPI_AssetLibraryId library_id, const char *asset_name, HAPI_ParmInfo *parm_infos_array, int start, int length)
 Fill an array of HAPI_ParmInfo structs with parameter information for the specified asset in the specified asset library. More...
 
HAPI_DECL HAPI_GetAssetDefinitionParmValues (const HAPI_Session *session, HAPI_AssetLibraryId library_id, const char *asset_name, int *int_values_array, int int_start, int int_length, float *float_values_array, int float_start, int float_length, HAPI_Bool string_evaluate, HAPI_StringHandle *string_values_array, int string_start, int string_length, HAPI_ParmChoiceInfo *choice_values_array, int choice_start, int choice_length)
 Fill arrays of parameter int values, float values, string values, and choice values for parameters in the specified asset in the specified asset library. More...
 

Detailed Description

Functions for managing asset libraries

Function Documentation

HAPI_DECL HAPI_GetAssetDefinitionParmCounts ( const HAPI_Session session,
HAPI_AssetLibraryId  library_id,
const char *  asset_name,
int *  parm_count,
int *  int_value_count,
int *  float_value_count,
int *  string_value_count,
int *  choice_value_count 
)

Get the number of asset parameters contained in an asset library, as well as the number of parameter int, float, string, and choice values.

This does not create the asset in the session. Use this for faster querying of asset parameters compared to creating the asset node and querying the node's parameters.

This does require HAPI_LoadAssetLibraryFromFile() to be called prior, in order to load the asset library and acquire library_id. Then HAPI_GetAvailableAssetCount and HAPI_GetAvailableAssets should be called to get the asset_name.

Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]library_idReturned by HAPI_LoadAssetLibraryFromFile().
[in]asset_nameName of the asset to get the parm counts for.
[out]parm_countThe number of parameters in the asset library.
[out]int_value_countThe number of int values for parameters in the asset library.
[out]float_value_countThe number of float values for parameters in the asset library.
[out]string_value_countThe number of string values for parameters in the asset library.
[out]choice_value_countThe number of choice values for parameters in the asset library.
HAPI_DECL HAPI_GetAssetDefinitionParmInfos ( const HAPI_Session session,
HAPI_AssetLibraryId  library_id,
const char *  asset_name,
HAPI_ParmInfo parm_infos_array,
int  start,
int  length 
)

Fill an array of HAPI_ParmInfo structs with parameter information for the specified asset in the specified asset library.

This does not create the asset in the session. Use this for faster querying of asset parameters compared to creating the asset node and querying the node's parameters.

This does require HAPI_LoadAssetLibraryFromFile() to be called prior, in order to load the asset library and acquire library_id. HAPI_GetAssetDefinitionParmCounts should be called prior to acquire the count for the size of parm_infos_array.

Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]library_idReturned by HAPI_LoadAssetLibraryFromFile().
[in]asset_nameName of the asset to get the parm counts for.
[out]parm_infos_arrayArray of HAPI_ParmInfo at least the size of length.
[in]startFirst index of range. Must be at least 0 and at most parm_count - 1 acquired from HAPI_GetAssetInfo.
[in]lengthMust be at least 1 and at most parm_count - start acquired from HAPI_GetAssetInfo
HAPI_DECL HAPI_GetAssetDefinitionParmValues ( const HAPI_Session session,
HAPI_AssetLibraryId  library_id,
const char *  asset_name,
int *  int_values_array,
int  int_start,
int  int_length,
float *  float_values_array,
int  float_start,
int  float_length,
HAPI_Bool  string_evaluate,
HAPI_StringHandle string_values_array,
int  string_start,
int  string_length,
HAPI_ParmChoiceInfo choice_values_array,
int  choice_start,
int  choice_length 
)

Fill arrays of parameter int values, float values, string values, and choice values for parameters in the specified asset in the specified asset library.

This does not create the asset in the session. Use this for faster querying of asset parameters compared to creating the asset node and querying the node's parameters. Note that only default values are retrieved.

This does require HAPI_LoadAssetLibraryFromFile() to be called prior, in order to load the asset library and acquire library_id. HAPI_GetAssetDefinitionParmCounts should be called prior to acquire the counts for the sizes of the values arrays.

Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]library_idReturned by HAPI_LoadAssetLibraryFromFile().
[in]asset_nameName of the asset to get the parm counts for.
[out]int_values_arrayArray of ints at least the size of int_length.
[in]int_startFirst index of range for int_values_array. Must be at least 0 and at most int_value_count - 1 acquired from HAPI_GetAssetDefinitionParmCounts.
[in]int_lengthMust be at least 0 and at most int_value_count - int_start acquired from HAPI_GetAssetDefinitionParmCounts.
[out]float_values_arrayArray of floats at least the size of float_length.
[in]float_startFirst index of range for float_values_array. Must be at least 0 and at most float_value_count - 1 acquired from HAPI_GetAssetDefinitionParmCounts.
[in]float_lengthMust be at least 0 and at most float_value_count - float_start acquired from HAPI_GetAssetDefinitionParmCounts.
[in]string_evaluateWhether or not to evaluate the string expressions. For example, the string "$F" would evaluate to the current frame number. So, passing in evaluate = false would give you back the string "$F" and passing in evaluate = true would give you back "1" (assuming the current frame is 1).
[out]string_values_arrayArray of HAPI_StringHandle at least the size of string_length.
[in]string_startFirst index of range for string_values_array. Must be at least 0 and at most string_value_count - 1 acquired from HAPI_GetAssetDefinitionParmCounts.
[in]string_lengthMust be at least 0 and at most string_value_count - string_start acquired from HAPI_GetAssetDefinitionParmCounts.
[out]choice_values_arrayArray of HAPI_ParmChoiceInfo at least the size of choice_length.
[in]choice_startFirst index of range for choice_values_array. Must be at least 0 and at most choice_value_count - 1 acquired from HAPI_GetAssetDefinitionParmCounts.
[in]choice_lengthMust be at least 0 and at most choice_value_count - choice_start acquired from HAPI_GetAssetDefinitionParmCounts.
HAPI_DECL HAPI_GetAssetInfo ( const HAPI_Session session,
HAPI_NodeId  node_id,
HAPI_AssetInfo asset_info 
)

Fill an asset_info struct from a node.

Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]node_idThe node id.
[out]asset_infoReturned HAPI_AssetInfo struct.
HAPI_DECL HAPI_GetAvailableAssetCount ( const HAPI_Session session,
HAPI_AssetLibraryId  library_id,
int *  asset_count 
)

Get the number of assets contained in an asset library. You should call HAPI_LoadAssetLibraryFromFile() prior to get a library_id.

Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]library_idReturned by HAPI_LoadAssetLibraryFromFile().
[out]asset_countThe number of assets contained in this asset library.
HAPI_DECL HAPI_GetAvailableAssets ( const HAPI_Session session,
HAPI_AssetLibraryId  library_id,
HAPI_StringHandle asset_names_array,
int  asset_count 
)

Get the names of the assets contained in an asset library.

The asset names will contain additional information about the type of asset, namespace, and version, along with the actual asset name. For example, if you have an Object type asset, in the "hapi" namespace, of version 2.0, named "foo", the asset name returned here will be: hapi::Object/foo::2.0

However, you should not need to worry about this detail. Just pass this string directly to HAPI_CreateNode() to create the node. You can then get the pretty name using HAPI_GetAssetInfo().

You should call HAPI_LoadAssetLibraryFromFile() prior to get a library_id. Then, you should call HAPI_GetAvailableAssetCount() to get the number of assets to know how large of a string handles array you need to allocate.

Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]library_idReturned by HAPI_LoadAssetLibraryFromFile().
[out]asset_names_arrayArray of string handles (integers) that should be at least the size of asset_count.
[in]asset_countShould be the same or less than the value returned by HAPI_GetAvailableAssetCount().
HAPI_DECL HAPI_LoadAssetLibraryFromFile ( const HAPI_Session session,
const char *  file_path,
HAPI_Bool  allow_overwrite,
HAPI_AssetLibraryId library_id 
)

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

Note
This is when we actually check for valid licenses.

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.

Note
The HIP file saved using HAPI_SaveHIPFile() will only have an absolute path reference to the loaded OTL meaning that if the OTL is moved or renamed the HIP file won't load properly. It also means that if you change the OTL using the saved HIP scene the same OTL file will change as the one used with Houdini Engine. See Saving a HIP File.
Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]file_pathAbsolute path to the .otl file.
[in]allow_overwriteWith 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_ASSET_DEF_ALREADY_LOADED.
[out]library_idNewly loaded otl id to be used with HAPI_GetAvailableAssetCount() and HAPI_GetAvailableAssets().
HAPI_DECL HAPI_LoadAssetLibraryFromMemory ( const HAPI_Session session,
const char *  library_buffer,
int  library_buffer_length,
HAPI_Bool  allow_overwrite,
HAPI_AssetLibraryId library_id 
)

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

Note
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.

Note
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 Saving a HIP File.
Parameters
[in]sessionThe session of Houdini you are interacting with. See Sessions for more on sessions. Pass NULL to just use the default in-process session.
[in]library_bufferThe memory buffer containing the asset definitions in the same format as a standard Houdini .otl file.
[in]library_buffer_lengthThe size of the OTL memory buffer.
[in]allow_overwriteWith 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_ASSET_DEF_ALREADY_LOADED.
[out]library_idNewly loaded otl id to be used with HAPI_GetAvailableAssetCount() and HAPI_GetAvailableAssets().