Advertisement
whillothewhisp

CookNode

May 27th, 2025
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1.     // Get the display SOP node (inside the asset node)
  2.     HAPI_NodeId display_node_id;
  3.     int node_count;
  4.     ENSURE_SUCCESS(HAPI_ComposeChildNodeList(NULL, g_asset_id, HAPI_NODETYPE_SOP, HAPI_NODEFLAGS_DISPLAY, true, &node_count));
  5.  
  6.     // If there are SOP children
  7.     if (node_count > 0)
  8.     {
  9.         std::vector<HAPI_NodeId> child_nodes(node_count);
  10.         ENSURE_SUCCESS(HAPI_GetComposedChildNodeList(NULL, g_asset_id, child_nodes.data(), node_count));
  11.  
  12.         display_node_id = child_nodes[0];  // Pick first display SOP node (could also inspect others)
  13.     }
  14.     else
  15.     {
  16.         std::cerr << "No display SOP node found in the HDA." << std::endl;
  17.         return 1;
  18.     }
  19.  
  20.     // Cook the SOP node if needed
  21.     ENSURE_SUCCESS(HAPI_CookNode(NULL, display_node_id, &cookOptions));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement