Python command to list all nodes in houdini?

   19545   8   1
User Avatar
Member
33 posts
Joined: Feb. 2009
Offline
Hi,
Im doing a server in python but I'm not familiar with python under Houdini. Can I get all nodes from houdini and its type.
Im doing a statistical report of houdini scenes.
thanks,
Alexis
User Avatar
Member
1904 posts
Joined: Nov. 2006
Offline
There is no command that just gives you all the nodes. You will have to recursively traverse the entire scene to find all nodes and their children. There is an example of doing just that in the help.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
7710 posts
Joined: July 2005
Online
There's also the “opstat” hscript command.
User Avatar
Member
1 posts
Joined: Sept. 2012
Offline
hou.node(“/”).allSubChildren()
User Avatar
Member
1 posts
Joined: April 2014
Offline
list = hou.node(“/obj/”).allSubChildren()
for i in list:
print i
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
print i.type()
http://www.racecar.no [www.racecar.no]
User Avatar
Staff
4159 posts
Joined: Sept. 2007
Offline
You can also list all of the node types from a version of Houdini with this command:

hython $HFS/houdini/python2.7libs/opnode_sum.py > all_nodes.txt

If you run that from two different versions of hython, you can diff the results. For example, this compares 16.5.323 and 16.5.473:


And if you need to, you can add this flag to get all of the parameters and values, and diff those too:

hython $HFS/houdini/python2.7libs/opnode_sum.py -p > all_nodes_and_parms.txt



The version of hython being run is was really matters; you'll need to run the hython in each version of Houdini you wish to print out the list for.

Hope that helps!
Edited by goldleaf - July 14, 2018 23:48:33

Attachments:
screenshot-window-2018-07-14-202402.png (85.0 KB)
screenshot-window-2018-07-14-202410.png (98.2 KB)

I'm o.d.d.
User Avatar
Member
3 posts
Joined: Jan. 2016
Offline
Thanks goldleaf. This is what I was looking for so long.
~
FX TD
Double Negative
User Avatar
Member
55 posts
Joined: Nov. 2019
Offline
Hi!

I am using a parser method that seems pretty neat in case you only want a more controlled search: https://www.sidefx.com/docs/houdini/hom/nodesearch.html [www.sidefx.com]

In terms of performance, to my understanding this looks faster than children() or allSubChildren() but perhaps someone can confirm that (?)
Edited by Cicuta - Jan. 30, 2024 16:37:11
  • Quick Links