Triggering python callback on node paste event

   1712   3   1
User Avatar
Member
78 posts
Joined: 5月 2018
Offline
Is there a way to trigger some code whenever a node is pasted or duplicated in a scene? I thought that maybe the OnCreated global event listed here [www.sidefx.com] would have done it, but that doesn't seem to be the case. I am trying to build a method of assigning a persistent unique ID to nodes, and currently this is the only part of the puzzle I seem to be missing. Any ideas?
User Avatar
Member
38 posts
Joined: 7月 2019
Offline
Hello,
OnLoaded will do what you want.
To avoid calling it when Houdini is loading the scene you can use hou.hipFile.isLoadingHipFile()
Example in OnLoaded:

if hou.hipFile.isLoadingHipFile():
     print("Loading")
else:
     print("Copying")
User Avatar
Member
78 posts
Joined: 5月 2018
Offline
Thanks FDX. That's exactly what I was looking for.
User Avatar
Member
136 posts
Joined: 8月 2015
Offline
That doesn't seem to be working anymore ?
  • Quick Links