Python event callback when Houdini fully loaded

   6447   5   2
User Avatar
Member
14 posts
Joined: May 2017
Offline
Hey all, I'm trying to get a script to run when Houdini is fully loaded. I'm aware of 123.py, but the issue is my script to run is a dialog that locks up the process until the user finalizes it.

The dialog ends up being executed as the splash screen is still in effect and therefore gets hidden behind it. Is there a callback I can hook into instead that would occur when Houdini is completely loaded?

Thanks!
User Avatar
Member
2625 posts
Joined: June 2008
Offline
Check out the docs.
http://www.sidefx.com/docs/houdini/hom/locations.html#events [www.sidefx.com]
http://www.sidefx.com/docs/houdini/hom/hou/hipFile.html#addEventCallback [www.sidefx.com]

The event type you probably want is .AfterLoad.
http://www.sidefx.com/docs/houdini/hom/hou/hipFileEventType.html [www.sidefx.com]
Edited by Enivob - Nov. 27, 2017 16:50:40
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
14 posts
Joined: May 2017
Offline
Enivob
Check out the docs.
http://www.sidefx.com/docs/houdini/hom/locations.html#events [www.sidefx.com]
http://www.sidefx.com/docs/houdini/hom/hou/hipFile.html#addEventCallback [www.sidefx.com]

The event type you probably want is .AfterLoad.
http://www.sidefx.com/docs/houdini/hom/hou/hipFileEventType.html [www.sidefx.com]

Thanks, but I've taken a look at these docs. AfterLoad triggers after a .hip is loaded, but I need an event that occurs after initial startup, once the UI is 100% ready to go. As I've stated, 123.py triggers too early while Houdini is still loading everything.
User Avatar
Member
459 posts
Joined: Oct. 2011
Offline
Isnt that what 456.py is for?
http://www.racecar.no [www.racecar.no]
User Avatar
Member
14 posts
Joined: May 2017
Offline
The solution is to use the hdefereval module and pass the callback to executeDeferred, which will execute when the main event loop is idle.

import hdefereval

# A function that needs the UI to be fully available (i.e. for desktop manipulation)
def functionToExecuteOnStartup():
    print 'foobar'

hdefereval.executeDeferred(functionToExecuteOnStartup)
Edited by sashaouellet - Dec. 4, 2017 14:05:04
User Avatar
Member
16 posts
Joined: Dec. 2014
Offline
Is there a Hython equivalent of this?
In Hython this throws the error: "ImportError: hdefereval is only available in a graphical Houdini"
  • Quick Links