I need some help with getting the objects from a digital asset. I have loaded the
attached .hda file (ladder.hda) and am now trying to get the composed object list of the
asset with the following code:
HAPI_Result status_code;
HAPI_AssetLibraryId library_id;
status_code = HAPI_LoadAssetLibraryFromFile(ref session, file_path,
true, out library_id);
processStatusCode(status_code);
int asset_count = 0;
status_code = status_code = HAPI_GetAvailableAssetCount(ref session,
library_id, out asset_count);
processStatusCode(status_code);
int[] asset_names_sh = new int[asset_count];
status_code = HAPI_GetAvailableAssets(ref session, library_id, asset_names_sh, asset_count);
processStatusCode(status_code);
string[] asset_names = new string[asset_count];
for (int i = 0; i < asset_count; ++i)
{
asset_names[i] = getString(asset_names_sh[i]);
Console.WriteLine( asset_names[ i ] );
}
HAPI_NodeId node_id = -1;
string first_asset_name = asset_names[0];
bool cook_on_load = false;
status_code = HAPI_CreateNode(
ref session, -1, first_asset_name, "", cook_on_load, out node_id);
processStatusCode(status_code);
HAPI_CookOptions cook_options = getCookOptions();
HAPI_Result status_code = HAPI_CookNode(ref session, node_id, ref cook_options );
processStatusCode( status_code );
int object_count;
status_code = HAPI_ComposeObjectList(ref session, node_id, "", out object_count);
processStatusCode( status_code );
HAPI_ObjectInfo[] object_infos = new HAPI_ObjectInfo[object_count];
status_code = HAPI_GetComposedObjectList(ref session, node_id, object_infos, 0, object_count);
processStatusCode( status_code );
object_count becomes 0 but when opening the .hda file in Houdini it says that I have “1 objects”.
It works with the working_box.hda which I find strange. Is there something wrong I did when creating the asset?
Or why does it not work with the ladder?