Vex: get list of all nodes in a path?

   465   2   0
User Avatar
Member
1129 posts
Joined: April 2017
Offline
Hi!

In a wrangle, is there a way to get a list of all nodes in a specific path? Let's say I want to find all nodes in /mat/MyMaterialBuilder ?

I'm looking for a vex method because I know nothing of python.

-Olivier
User Avatar
Member
9205 posts
Joined: July 2007
Offline
Python is the way to go for this
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
90 posts
Joined: Aug. 2017
Offline
It's impossible with Vex. With Python it's as simple as this:
hou.node('/mat/karmamaterial').allSubChildren()

It produces a list of nodes as objects. And then you can look up any value you'd like by iterating over this list.
my_nodes = hou.node('/mat/karmamaterial').allSubChildren()

an_array_of_node_names = []
node_paths_for_example = []

for node in my_nodes:
    an_array_of_node_names.append( node.name() )
    node_paths_for_example.append( node.path() )

print(an_array_of_node_names)
print(node_paths_for_example)

Here [www.sidefx.com] you can find other things that can be added after the node.variable.

You can do it, believe in yourself. Basic Python can be learned in a weekend.
Edited by alexmajewski - May 11, 2025 03:19:57
  • Quick Links