python script to drop node to selected

December 27, 2017

Not mine, but I trimmed what I needed. Great to add to your shelf, and make a shortcut.

node = hou.pwd()
for i in hou.selectedNodes():
if hou.nodeTypeCategories().keys():
### Above function lets you call this function on any context ###
dir = i.parent().path() + ‘/’
selNodeName = i.name()
nodeinfo = i.type().name()
nullnode = hou.node(‘/%s’%dir).createNode(‘null’, ‘OUT’)
selNodePos = i.position()
nullnode.setColor(hou.Color( [0,0,0] ))
### Setting node position ###
nullnode.setPosition(hou.Vector2(selNodePos[0],selNodePos[1]-1))
nullnode.setInput(0,i)
i.setSelected(False)
nullnode.setSelected(True)