Houdini Engine 7.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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_CookNode(), among other APIs.

Query

To get the HAPI_PartInfo, just call HAPI_GetPartInfo() with the HAPI_NodeId of the geo (SOP) node and the HAPI_PartId. The HAPI_PartId is just an index into the list of parts which can change order and size after every cook.

The total number of parts in a geo is given by HAPI_GeoInfo::partCount.

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

Part Types

There are a couple of special part types to be aware of. The HAPI_PartType is given by HAPI_PartInfo::type. Here are some part types of note:

  1. HAPI_PARTTYPE_MESH is the default mesh primitive.
  2. HAPI_PARTTYPE_CURVE is the curve mesh primitive. See Curves.
  3. HAPI_PARTTYPE_VOLUME is the volume primitive. See Volumes.
  4. HAPI_PARTTYPE_INSTANCER is a packed primitive. See Packed Primitives.
  5. HAPI_PARTTYPE_BOX is the box primitive. You can call HAPI_GetBoxInfo() on this part to get the HAPI_BoxInfo struct and potentially render the same geometry more efficiently. In order for this to work, you have to enable box primitives by setting HAPI_CookOptions::handleBoxPartTypes to true.
  6. HAPI_PARTTYPE_SPHERE is the sphere primitive. You can call HAPI_GetSphereInfo() on this part to get the HAPI_SphereInfo struct and potentially render the same geometry more efficiently. In order for this to work, you have to enable sphere primitives by setting HAPI_CookOptions::handleSpherePartTypes to true.