Jump to content

OnInputChanged - event not triggering when input nodes change name


danielsweeney

Recommended Posts

HI everyone.

 

Hope everyone is ok in this current situation. Hope no one is Ill from the virus and not going crazy working from home.

 

I am wondering if someone can point me in the right direction on this. I have a Multi-input HDA - I assumed that the OnInputChange HDA event would trigger when a name change of node that is connected. But for some reason, it does not.

 

What would be the best way to listen for this event happening. The event triggers fine the first time the node in plugged in, but not when the node changes name.

 

Any help would be appreciated. Cheers

 

Daniel

 

 

Link to comment
Share on other sites

depending on what you are doing you may be able to use opinput() or opinputpath() expression to grab the name or path of any input node and will correctly update when you rename the inputs

Edited by anim
Link to comment
Share on other sites

Right, as Tomas said a parameter expression might work for you, if not, then what you can do is in your onInputChanged handler of your hda, you would register a callback on the node's inputs.

(Simplified, untested)

def _callback():
  pass

for inp in hda_node.inputs():
  inp.addEventCallback([hou.nodeEventType.NameChanged], _callback)

You will need to take care of removing the callback if it's there already before adding a new one.

Link to comment
Share on other sites

Hi,

 

thanks for the responses Alex and Thomas.

 

to be honest the opinput() would work for my solution. but only if I could get all inputs going into a multi-connector? and it then Registered it on the Parm so i could run a call back script. But from what I have tested. the callback script does not run when its has an expression in the parm and the output changes when it pulls the new name?

 

I will have to have a proper think about doing it with node event types as I have no experience of this and I am very much on a learning path with python....:S

 

the joys of coding when you dont have a coding brain. ha

Daniel

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...