HAPI Basics question, getting the result of a cooked asset.

   3079   3   2
User Avatar
Member
9 posts
Joined: June 2017
Offline
Hi,

So I'm introducing a houdini plugin into our in house engine and I'm testing my code out so far by loading and cooking an HDA file. The file is supposed to create a number of points based off some attributes. My problem is, I do not know how to get the output after I run HAPI_CookAsset.

Any help would be super appreciated!
Thanks
User Avatar
Member
23 posts
Joined: April 2013
Offline
In order to get the point data, you'll need to call HAPI_GetAttributeInfo() and HAPI_GetAttributeFloatData(). I'd do a quick scan through the geo and part sections of the docs to get started (one's a container and the other actually holds the mesh information), but generally the process is like this:

HAPI_NodeId nodeId = 1234;

// Check GeoInfo incase we need multiple parts
HAPI_GeoInfo geoInfo;
HAPI_GetGeoInfo();

// Check part information for the point count (used later)
HAPI_PartInfo partInfo;
HAPI_GetPartInfo();

// Check information about our "P" attribute (is it an array? how big?)
HAPI_AttributeInfo attrInfo;
HAPI_GetAttributeInfo()

// Get our "P" data using the supplied information
Point3* p = new Point3[partInfo.pointCount];
HAPI_GetAttributeFloatData();

After that, you'll have some kind of point array to work with! That Node ID will allow you access to a lot of functionality.

Edit: Point3 is a max-specific container for a float3 array.
Edited by sburrichter - July 18, 2018 20:50:21
User Avatar
Member
603 posts
Joined: Sept. 2016
Offline
Also check out the full-source sample section in the docs:

https://www.sidefx.com/docs/hengine/_h_a_p_i__full_source_samples__objects_geos_parts.html [www.sidefx.com]
User Avatar
Member
9 posts
Joined: June 2017
Offline
This is exactly what I needed, thank you!
  • Quick Links