Querying Nodes from USD Primitive path

   Views 396   Replies 2   Subscribers 2
User Avatar
Member
18 posts
Joined: March 2024
Offline
Hello,

I'm looking for a python function or a set of function that could help to retrieve the involved node(s) for a given USD primitive path.

What i may be looking for , is to extract these layer stack pathes (which are the nodes involved in the creation or edition of the prim)



Thank you!
Edited by sebd3dvfx - April 10, 2025 04:30:47

Attachments:
layer_property_stack.png (102.7 KB)

User Avatar
Staff
4228 posts
Joined: Sept. 2007
Offline
It's not always the case that layers == nodes, but where possible, LOPs will record a node's id to the "HoudiniPrimEditorNodes". This custom data is set per-primitive, and you can see it in the Scene Graph Details.

You can get at the nodes with a help function we have in loputils, by passing a lop node and prim path to loputils.getEditorNodes(). It just helps get node paths from the node ids stored as customdata.

This is used in the Scene Graph Tree's "Jump to Existing Editor Nodes" option, when you RMB on a prim.

Hope this helps!
I'm o.d.d.
User Avatar
Member
18 posts
Joined: March 2024
Offline
Ok, after some exploration i found out using the USD api instead.

Since our prims are most of the time synced with the node name (with some exception that we can specify in code), i could look up every anonymous usd layers containing the name of the node.
This allows to retrieve specific nodes quite fast :

prim = stage.GetPrimAtPath("/world/primitive")
prim_name = prim.GetName()
for prim_spec in prim.GetPrimStack():
    for lyr in prim_spec.layer.GetLoadedLayers():
        lyr_name=lyr.GetDisplayName() # contains the houdini node name
Edited by sebd3dvfx - April 11, 2025 07:32:17
  • Quick Links