Search - User list
Full Version: HAPI Basics question, getting the result of a cooked asset.
Root » Houdini Engine API » HAPI Basics question, getting the result of a cooked asset.
Saffron
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
sburrichter
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.
chrisgreb
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]
Saffron
This is exactly what I needed, thank you!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB