How to exract USD propertys to SOP attributes?

   273   1   0
User Avatar
Member
4 posts
Joined: Dec. 2016
Offline
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:
string stage_path = "../LOPNET_for_Import/output0"; // A valid LOP node
string wrong_path = "../wrong_ref"; // A valid SOP node
string non_existing_path = "../foo"; // A non-existing SOP node

i@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)
Edited by lampmilan - July 24, 2024 05:59:14

Attachments:
usd_extract.hiplc (370.7 KB)
patch_test_3.usd (353.8 KB)
attirb_not_working.PNG (221.0 KB)

User Avatar
Member
283 posts
Joined: Jan. 2013
Offline
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”).

op:../LOPNET_for_Import/output0
  • Quick Links