Houdini Engine 1.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Objects, Geos, and Parts

This section assumes you have a successfully instantiated asset and a filled HAPI_AssetInfo struct. As a guide, start first by loading Objects, then Geos, and finally Parts.

Objects

Objects are the highest level nodes inside an asset. They are Houdini's equivalent of transform nodes. To get information on a asset's objects:

  1. Make sure you have a successfully instantiated asset and have a filled HAPI_AssetInfo struct as described in Assets.
  2. Allocate an array of HAPI_AssetInfo::objectCount HAPI_ObjectInfo's.
  3. Call HAPI_GetObjects() using HAPI_AssetInfo::id, the array you just allocated, 0 for the start, and HAPI_AssetInfo::objectCount for the length. You can of course choose a different range within those values.

Since objects are Houdini's transform nodes you're probably going to need their transforms as well which don't come as part of the HAPI_ObjectInfo struct. To get the object transforms, use HAPI_GetObjectTransforms() using the same asset id and object counts as with HAPI_GetObjects(). All transform information is provided in Houdini coordinates.

Geos

Geo nodes are equivalent to SOPs (Surface Operator nodes) in Houdini. Geos don't contain geometry directly, instead, they contain parts. To get information on a asset's geos:

  1. Make sure you have a valid filled HAPI_ObjectInfo struct as described in Objects.
  2. The geo ids will be the indicies from 0 to HAPI_ObjectInfo::geoCount - 1, inclusive. For each geo in this range, call HAPI_GetGeoInfo() to get a HAPI_GeoInfo struct filled.

In most cases, there will only be a single Geo for each Object, corresponding to the visible SOP node in Houdini. However, there are cases where multiple Geos are exposed. For example, one might wish to expose multiple nodes in a SOP network. In these cases the node can be marked "templated" inside of Houdini, and its geometry will become exposed through HAPI. Another case where multiple Geos come into play is in the case of Intermediate Asset Results where we expose geometry midway through a cook, allow modifications on that geometry, and let the cook continue from that point with the modified geometry. You can distinguish between these different Geos by looking at the HAPI_GeoInfo::type, HAPI_GeoInfo::isDisplayGeo, and HAPI_GeoInfo::isTemplated fields of HAPI_GeoInfo.

Parts

Parts contain the actual mesh/geometry/attribute data you're interested in.

Parts are computed based on the use of primitive groups within the geometry in Houdini. There will be 1 part per primitive group, plus another part containing all geometry that is not in a primitive group unless all primitives are part of at least one group. If within a primitive group there are multiple Houdini primitives, additional parts will be created per primitive. This splitting can be disabled via HAPI_CookOptions::splitGeosByGroup when passed in to HAPI_Initialize() or HAPI_CookAsset().

To get information on a asset's parts:

  1. Make sure you have a valid filled HAPI_GeoInfo struct as described in Geos.
  2. The part ids will be the indicies from 0 to HAPI_GeoInfo::partCount - 1, inclusive. For each part in this range, call HAPI_GetPartInfo() to get a HAPI_PartInfo struct filled.

Now you're ready to get the actual geometry data.

You can get the array of face counts, where the nth integer in the array is the number of vertices the nth face has, by calling HAPI_GetFaceCounts() with 0 and HAPI_PartInfo::faceCount as your max range.

You can get the array containing the vertex-point associations, where the ith element in the array is the point index to the ith vertex associates with, by calling HAPI_GetVertexList() with 0 and HAPI_PartInfo::vertexCount as your max range. As an example, if the first face had 3 vertices, the second face had 4 vertices and the third face had 5 vertices, then the first 3 integers in the vertex_list are the point indices belonging to the first face, the next 4 integers are those belonging to the second face, and the next 5 integers to the third face.

The vertex list contains only the indices to the points because vertices share points. There is a separate list of points, which are a list of 3 vectors, and the vertices index into this list of points. Thus the integers you retrieve from the vertex list are indices into the point list.

The actual point position information, along with all other geometry meta-data, is stored as Houdini attributes. See Attributes.

The code snippet below illustrates some of these concepts, when it iterates over the objects of the asset to print out information about each of its geos, and parts:

Full Source Sample

See Objects, Geos, and Parts Sample for a complete program that queries info on all objects, geos, and parts on an asset.