Skip to content

Instantly share code, notes, and snippets.

@kickbase
Created June 22, 2020 13:52
Show Gist options
  • Save kickbase/b60124de89885b72e61e983520b34943 to your computer and use it in GitHub Desktop.
Save kickbase/b60124de89885b72e61e983520b34943 to your computer and use it in GitHub Desktop.
[Houdini] [Python] Disconnect and Refresh parms recursively. ex) attribute vop
def disconnect_and_refresh(list):
for node in list:
if (node.isEditable() and(len(node.children()) != 0)):
for inConnection in node.inputConnections():
inIndex = inConnection.inputIndex()
inNode = inConnection.outputNode()
inNode.setInput(inIndex, None, 0)
for outConnection in node.outputConnections():
outIndex = outConnection.inputIndex()
outNode = outConnection.outputNode()
outNode.setInput(outIndex, None, 0)
node.moveToGoodPosition()
disconnect_and_refresh(node.children())
else:
path = node.parent().path()
type = node.type().name()
name = node.name()
node.destroy()
geo = hou.node(path).createNode(type, name)
geo.moveToGoodPosition()
disconnect_and_refresh(hou.selectedNodes())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment