I tried to use the usd_attrib [www.sidefx.com] VEX function to extract the values as attributes, but it always returned 0. I do this at the SOP level, which might be the issue, and the 'usd_' prefixed functions only work in a LOP network, but I'm not sure. Most 'usd_' functions return 0 (The only exception is the 'usd_isstage [www.sidefx.com]' which always returns 1). If that's the case, how can I read those properties at SOP level? I know that the 'USD Import' node can convert the USD meshes to SOP, but that only works if the primitive type is a 'mesh', but in my case, I wanna extract information from an 'untyped' primitive. In which case the USD Importer return nothing.
The example code:
stringstage_path = "../LOPNET_for_Import/output0"; // A valid LOP nodestringwrong_path = "../wrong_ref"; // A valid SOP nodestringnon_existing_path = "../foo"; // A non-existing SOP nodei@is_stage = usd_isstage(stage_path); // '../LOPNET_for_Import/output0' is a valid stage (Return 1)i@wrong_stage = usd_isstage(wrong_path); // A null node is a valid stage (Return 1)i@non_existing_stage = usd_isstage(non_existing_path); // A non-existing node is a valid stage (Return 1)i@is_prim = usd_isprim(stage_path, "/SimulationData/Sewings/sewing0"); // Try to access a primitive (Return 0)i[]@attrib_test = usd_attrib(stage_path, '/SimulationData/Sewings/sewing0', 'PLIndexPair'); // Try to acces a property (Return 0)i@mesh_type_prim = usd_isprim(stage_path, "/Mesh/Pattern_15382_15382");
// Try to check if it can find a "mesh" type prim (Return 0)
You can also use this argument to refer to a USD file (e.g., “/path/to/file.usd”), or to another LOP node’s cooked stage using the op: as the path prefix (e.g., “op:/stage/lop_node”).