Node pasted event callback?

   321   2   1
User Avatar
Member
183 posts
Joined: March 2011
Offline
Hi,

I'm doing some hdas for pipeline stuff, and I need to run some python code when a node is created. It works well when the node is created but not when It's copied and pasted (by ctrl+c->ctrl+v or alt drag). Since a new node is being created, shouldn't the onCreated callback be called in the situation or I am missing something here?

I haven't found any suitable callback either.
User Avatar
Member
1786 posts
Joined: Nov. 2006
Offline
Unless things have changed in recent versions, unfortunately there's no proper form of callbacks to easily tap into in regards to network editor actions which means you're pretty much forced to implement it on your own via a custom node graph event handler similar to this:

https://github.com/captainhammy/Houdini-Toolbox/blob/master/houdini/python3.7libs/nodegraphhooks.py [github.com]

It's been a while since I messed with any of that stuff and mostly don't recall how it works anymore. That file basically registers a custom handler that will do certain things otherwise defers the default Houdini handler. I believe that due to the way the default Houdini handler stuff was implemented it was pretty much impossible to just call their code while adding in your own hooks so it required making a copy of a bunch of the Houdini code to handle the actual pasting the way they do (nodegraph.handle_houdini_paste_event) and then eventually doing something that you want to do, which in this case was me emitting a callback for my own crappy callback system.

I recall it was a bit of a pain to figure out and a lot of diving into various places but we eventually figured out something that worked well enough for our goals.
Graham Thompson, Pipeline Things
User Avatar
Member
183 posts
Joined: March 2011
Offline
graham
Unless things have changed in recent versions, unfortunately there's no proper form of callbacks to easily tap into in regards to network editor actions which means you're pretty much forced to implement it on your own via a custom node graph event handler similar to this:

https://github.com/captainhammy/Houdini-Toolbox/blob/master/houdini/python3.7libs/nodegraphhooks.py [github.com]

It's been a while since I messed with any of that stuff and mostly don't recall how it works anymore. That file basically registers a custom handler that will do certain things otherwise defers the default Houdini handler. I believe that due to the way the default Houdini handler stuff was implemented it was pretty much impossible to just call their code while adding in your own hooks so it required making a copy of a bunch of the Houdini code to handle the actual pasting the way they do (nodegraph.handle_houdini_paste_event) and then eventually doing something that you want to do, which in this case was me emitting a callback for my own crappy callback system.

I recall it was a bit of a pain to figure out and a lot of diving into various places but we eventually figured out something that worked well enough for our goals.

Thanks for the great info, although the news is a bit sad! haha.
  • Quick Links