Sasha Ouellet

sashaouellet

About Me

EXPERTISE
Student
INDUSTRY
Film/TV

Connect

LOCATION
United States

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Python Shelf Tool executable location May 9, 2018, 11:23 a.m.

Matthew Bennett
I am resurrecting this topic as I don't quite understand.

If I have a file C:\Users\foo\Desktop\python_script_I_want_to_execute_when_I_push_my_shelf_tool.py

What is required to input into my shelf tool script in order to have it execute that file?

Any info would be much appreciated.

Are you seeking to import that module? If so, “C:\Users\foo\Desktop” needs to be in PYTHONPATH (set in houdini.env), and you'd import the module like normal in your shelf script i.e.:
import python_script_I_want_to_execute_when_I_push_my_shelf_tool

Obviously, you'd package a directory with all your scripts alongside your shelf tool.

Python event callback when Houdini fully loaded Dec. 4, 2017, 2:04 p.m.

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)

Python event callback when Houdini fully loaded Nov. 27, 2017, 5:31 p.m.

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.