SpiecsEngine
 
Loading...
Searching...
No Matches

◆ PrintCompleteNodeInfo()

static void HoudiniEngine::PrintCompleteNodeInfo ( HAPI_Session & session,
HAPI_NodeId nodeId,
HAPI_AssetInfo & assetInfo )
static

Definition at line 212 of file HoudiniTestSource.h.

213 {
214 HAPI_NodeInfo nodeInfo;
215 HE_CHECK(HAPI_GetNodeInfo(&session, nodeId, &nodeInfo))
216
217 int objectCount = 0;
218 HAPI_ObjectInfo* objectInfos = 0;
219
220 if (nodeInfo.type == HAPI_NODETYPE_SOP)
221 {
222 // For pure SOP asset, a parent object will be created automatically,
223 // so use parent's ID to get the object info
224 objectCount = 1;
225 objectInfos = new HAPI_ObjectInfo[objectCount];
226 HE_CHECK(HAPI_GetObjectInfo(&session, nodeInfo.parentId, &objectInfos[0]))
227 }
228 else if (nodeInfo.type == HAPI_NODETYPE_OBJ)
229 {
230 // This could have children objects or not.
231 // If has children, get child object infos.
232 // If no children, presume this node is the only object.
233
234 HE_CHECK(HAPI_ComposeObjectList(&session, nodeId, nullptr, &objectCount))
235
236 if (objectCount > 0)
237 {
238 objectInfos = new HAPI_ObjectInfo[objectCount];
239 HE_CHECK(HAPI_GetComposedObjectList(&session, nodeInfo.parentId, objectInfos, 0, objectCount))
240 }
241 else
242 {
243 objectCount = 1;
244 objectInfos = new HAPI_ObjectInfo[objectCount];
245 HE_CHECK(HAPI_GetObjectInfo(&session, nodeId, &objectInfos[0]))
246 }
247 }
248 else
249 {
250 std::cout << "Unsupported node type: " << HAPI_NODETYPE_OBJ << std::endl;
251 return;
252 }
253
254 for (int objectIndex = 0; objectIndex < objectCount; ++objectIndex)
255 {
256 HAPI_ObjectInfo& objectInfo = objectInfos[objectIndex];
257 HAPI_GeoInfo geoInfo;
258 HE_CHECK(HAPI_GetDisplayGeoInfo(&session, objectInfo.nodeId, &geoInfo))
259
260 for (int partIndex = 0; partIndex < geoInfo.partCount; ++partIndex)
261 {
262 ProcessGeoPart(session, assetInfo, objectInfo.nodeId, geoInfo.nodeId, partIndex);
263 }
264 }
265
266 delete[] objectInfos;
267 }
#define HE_CHECK(expr)
HoudiniEngine Check macro. Verify HoudiniEngine API Effectiveness.
Definition HoudiniCore.h:17
static void ProcessGeoPart(HAPI_Session &session, HAPI_AssetInfo &assetInfo, HAPI_NodeId objectNode, HAPI_NodeId geoNode, HAPI_PartId partId)