Jump to content
Sign in to follow this  
danielsweeney

OnInputChanged - event not triggering when input nodes change name

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

 

 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×