Houdini subnet None input operators

   196   6   2
User Avatar
Member
6 posts
Joined: Dec. 2016
Offline
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!

Attachments:
mergeNode.png (54.6 KB)
basicSubnetNode.png (48.8 KB)

User Avatar
Member
114 posts
Joined: March 2018
Online
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:
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
It should give you the result.
Edited by N-G - March 27, 2020 15:47:29
User Avatar
Member
42 posts
Joined: Feb. 2017
Offline
N-G
I used onInputChanged signal 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!
my houdini 18.0.417 also crash…
It is the time to move to Ubuntu…
vimeo.com/zengchen
User Avatar
Member
114 posts
Joined: March 2018
Online
zengchen
my houdini 18.0.417 also crash…
Therefore you may want to submit a bug for this and stick with the second approach until they fix it.
User Avatar
Member
6 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.
Edited by dacrow - March 27, 2020 10:32:33
User Avatar
Member
42 posts
Joined: Feb. 2017
Offline
dacrow
Ah. This crashes as it calls an infinite recursion.

Yes, I suddenly realized it
Edited by zengchen - March 27, 2020 10:42:54
It is the time to move to Ubuntu…
vimeo.com/zengchen
User Avatar
Member
114 posts
Joined: March 2018
Online
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
it is not crash this time since it doesn't call for infinite times!
Edited by N-G - March 27, 2020 15:49:57
  • Quick Links