Hey guys,
I am trying to mimic the inputs of the merge node. In the merge node if you have three inputs and disconnect the middle input then you can see in the “Input Operators” that the you will only see three inputs.
If I create a simple subnet with just nulls in the inside and connect three inputs and disconnect the middle input, you will see a blank “None” input in the “Input Operators”.
How can I recreate this merge node functionality?
Merge node with the middle node disconnected:
Simple subnet with the middle node disconnected:
Thanks!
Houdini subnet None input operators
1835 6 2- harshmallow
- Member
- 13 posts
- Joined: Dec. 2016
- Offline
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
I used OnInputChanged event handler to disconnect and reconnect all inputs whenever input contains a None item but Houdini crash constantly in the most recent production build 18.0.416!
So I used another method to this issue:
Place a Python SOP inside your digital asset with this code:
It should give you the result.
So I used another method to this issue:
Place a Python SOP inside your digital asset with this code:
currentNode = hou.node("..") inputs = currentNode.inputs() if None in inputs: index = 0 for input in inputs: try: currentNode.setInput(index, None) except: pass index += 1 index = 0 for input in inputs: if input != None: currentNode.setInput(index, input) index += 1
Edited by N-G - March 27, 2020 15:47:29
- zengchen
- Member
- 77 posts
- Joined: Feb. 2017
- Offline
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
- harshmallow
- Member
- 13 posts
- Joined: Dec. 2016
- Offline
Thanks for the advice!
Ah. This crashes as it calls an infinite recursion. The OnInputChanged script gets called again as the the input is set during the loop. I get why it does that but I'm curious if there is a way to prevent the OnInputChanged from calling itself or any event calling another event.
Ah. This crashes as it calls an infinite recursion. The OnInputChanged script gets called again as the the input is set during the loop. I get why it does that but I'm curious if there is a way to prevent the OnInputChanged from calling itself or any event calling another event.
Edited by harshmallow - March 27, 2020 10:32:33
- zengchen
- Member
- 77 posts
- Joined: Feb. 2017
- Offline
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
dacrow
Thanks for the advice!
Ah. This crashes as it calls an infinite recursion. The OnInputChanged script gets called again as the the input is set during the loop. I get why it does that but I'm curious if there is a way to prevent the OnInputChanged from calling itself or any event calling another event.
Try this in OnInputChanged event handler:
currentNode = kwargs["node"] inputs = currentNode.inputs() index = 0 if len(inputs) != 0 and None in inputs: noneIndex = inputs.index(None) for input in inputs[noneIndex+1:]: if input != None: currentNode.setInput(inputs.index(input), None) currentNode.setInput(noneIndex, input) noneIndex += 1
Edited by N-G - March 27, 2020 15:49:57
-
- Quick Links