Created
June 22, 2020 13:52
-
-
Save kickbase/b60124de89885b72e61e983520b34943 to your computer and use it in GitHub Desktop.
[Houdini] [Python] Disconnect and Refresh parms recursively. ex) attribute vop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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