// This is the old way of getting outputs. Keep it for now for legacy. TODO: Remove this later internal void GatherAllAssetOutputsLegacy(HEU_SessionBase session, HAPI_ObjectInfo objectInfo, bool bUseOutputNodes, ref List<HEU_GeoNode> geoNodes) { List<HAPI_GeoInfo> geoInfos = new List<HAPI_GeoInfo>(); // Get display geo info HAPI_GeoInfo displayGeoInfo = new HAPI_GeoInfo(); if (!session.GetDisplayGeoInfo(objectInfo.nodeId, ref displayGeoInfo)) { return; } //HEU_Logger.LogFormat("Found geoinfo with name {0} and id {1}", HEU_SessionManager.GetString(displayGeoInfo.nameSH, session), displayGeoInfo.nodeId); geoInfos.Add(displayGeoInfo); if (bUseOutputNodes) { int outputCount = 0; if (!session.GetOutputGeoCount(objectInfo.nodeId, out outputCount)) { outputCount = 0; } if (outputCount > 0) { HAPI_GeoInfo[] outputGeoInfos = new HAPI_GeoInfo[outputCount]; if (!session.GetOutputGeoInfos(objectInfo.nodeId, ref outputGeoInfos, outputCount)) { outputGeoInfos = new HAPI_GeoInfo[0]; } foreach (HAPI_GeoInfo geoInfo in outputGeoInfos) { if (geoInfo.nodeId == displayGeoInfo.nodeId) { continue; } bool bValidOutput = true; int parentId = HEU_HAPIUtility.GetParentNodeID(session, geoInfo.nodeId); while (parentId >= 0) { if (parentId == geoInfo.nodeId) { // This output node is inside the display geo // Do not use this output to avoid duplicates bValidOutput = false; break; } parentId = HEU_HAPIUtility.GetParentNodeID(session, parentId); } if (bValidOutput) { // Need to cook output geometry to get their parts HAPI_GeoInfo cookedGeoInfo = new HAPI_GeoInfo(); session.CookNode(geoInfo.nodeId, HEU_PluginSettings.CookTemplatedGeos); // Get the refreshed geo info if (session.GetGeoInfo(geoInfo.nodeId, ref cookedGeoInfo)) { geoInfos.Add(cookedGeoInfo); } } } } } // Get editable nodes, cook em, then create geo nodes for them HAPI_NodeId[] editableNodes = null; HEU_SessionManager.GetComposedChildNodeList(session, objectInfo.nodeId, (int)HAPI_NodeType.HAPI_NODETYPE_SOP, (int)HAPI_NodeFlags.HAPI_NODEFLAGS_EDITABLE, true, out editableNodes); if (editableNodes != null) { foreach (HAPI_NodeId editNodeID in editableNodes) { if (editNodeID != displayGeoInfo.nodeId) { session.CookNode(editNodeID, HEU_PluginSettings.CookTemplatedGeos); HAPI_GeoInfo editGeoInfo = new HAPI_GeoInfo(); if (session.GetGeoInfo(editNodeID, ref editGeoInfo)) { geoInfos.Add(editGeoInfo); } } } } //HEU_Logger.LogFormat("Object id={5}, name={0}, isInstancer={1}, isInstanced={2}, instancePath={3}, instanceId={4}", // HEU_SessionManager.GetString(objectInfo.nameSH, session), objectInfo.isInstancer, objectInfo.isInstanced, // HEU_SessionManager.GetString(objectInfo.objectInstancePathSH, session), objectInfo.objectToInstanceId, objectInfo.nodeId); // Go through geo infos to create geometry int numGeoInfos = geoInfos.Count; for (int i = 0; i < numGeoInfos; ++i) { // Create GeoNode for each geoNodes.Add(CreateGeoNode(session, geoInfos[i])); } }