Python
My silly tools
hou.parm('/stage/all/runcommand').set(0)
List all the param names of the node called “all”
node = hou.node('/stage/all/')
for parm in node.parms():
print(parm.name(), parm.eval())
Creating a small button to display ALL the comments to all my nodes.
root_node = hou.node("/obj")
for node in root_node.allNodes():
#print node.path()
node.setGenericFlag(hou.nodeFlag.DisplayComment,True)Create a geo group and object in it.
# Get the current node or the parent network
network = hou.node("/obj") # Replace with the path to your desired network (e.g., "/obj" or "/obj/geo1")
# Create a geometry (SOP) node
geo_node = network.createNode("geo", "geometry")
# Optionally, move the node to a good position in the network
geo_node.moveToGoodPosition()
# If needed, you can dive inside and create a sub-node (e.g., a box SOP)
box_node = geo_node.createNode("sphere", "my_sphere")
# Move the sub-node to a good position as well
box_node.moveToGoodPosition()
# Layout the network nicely
geo_node.layoutChildren()Make a OUT null and connection
# Get selected nodes
nodes = hou.selectedNodes()
# Start undo group
with hou.undos.group("Make OUT null"):
# Check that at least one node selected
if( len(nodes) > 0 ):
# Make new node
for n in nodes:
oldPos = n.position()
parent = n.parent()
newNode = parent.createNode("null")
newNode.setPosition(hou.Vector2([oldPos[0], oldPos[1]-1]))
newNode.setInput( 0, n, 0 )
newNode.setName("OUT")Switch Auto Update to manual. (Shell button)
import hou
mode = hou.updateModeSetting().name()
if mode == 'AutoUpdate':
hou.setUpdateMode(hou.updateMode.Manual)
if mode == 'Manual':
hou.setUpdateMode(hou.updateMode.AutoUpdate)Find python script
import inspect, husd.assetutils as au
print("module file:", inspect.getfile(au))
print("has source? ", inspect.ismodule(au))
print("callable?", hasattr(au, "createFramedCameraToBounds"))
print("object:", au.createFramedCameraToBounds)
try:
print(inspect.getsource(au.createFramedCameraToBounds))
except Exception as e:
print("could not get source:", type(e).__name__, str(e))