tidy networks

   2636   4   1
User Avatar
Member
194 posts
Joined: Aug. 2011
Offline
I have a tendency to try things with houdini… sometimes lots of things…


sometimes this leads to a bit of a messy graph of nodes in the network… many of which do nothing but waste CPU cycles…

I wonder if anybody knows some good tips for cleaning up after experimenting?

Is there a python command so that i can delete all the nodes that are currently bypassed?
Also is there a command to delete all the nodes that are orphaned?

(god that sounds terrible)

send them to a nice foster home, rather?


thanks
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
it should be easy to do it with python
you just need to cycle through each node in the network and check whether it is orphaned or bypassed
User Avatar
Member
636 posts
Joined: June 2006
Offline
There is some Example:

https://www.sidefx.com/docs/houdini/hom/nodesearch.html [www.sidefx.com]


Made quick a Example Script that searches in network /obj.

You can make a Shelf Tool.

# Import
import hou
import nodesearch

# Define Object and Search value
network = hou.node("/obj/")
matcher = nodesearch.State("bypass", True)

# Get Nodes
findNodes = matcher.nodes(network=network, recursive=True)

# Delete each node
for node in findNodes:
	node.destroy()
Edited by mandrake0 - Aug. 26, 2019 14:56:57
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
a quick python script is your answer here…
however it should be noted that bypassed and orphaned nodes take up almost zero resources
so unless you have 100's of them you don't need to worry too much
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
8538 posts
Joined: July 2007
Online
just make sure the script is robust enough to remove only truly unused nodes
since even bypassed/orphaned nodes can have parameters that are referenced somewhere else
and nodes themselves still may be referenced by path, which would not necessarily cook them if bypassed but the branch will not be found if deleted

I'd recommend doing cleanup by hand to keep track of the changes in the file and avoid future surprises
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links