Search - User list
Full Version: Python Handle - init vs onActivate concepts
Root » Technical Discussion » Python Handle - init vs onActivate concepts
coccarolla
Can someone please help me understand conceptually the difference between these two? Why or when should you make use of one or the other?
mabelzile
__init__() is the Python handle constructor and is called when the state is entered and the handle is created.
onActivate() is called by Houdini to initialize an existing handle, either when the state is first entered or when it is resumed.

When the state exits, onDeactivate() is called and the handle is deleted. The next time the state is entered, a new handle is created and onActivate() is called again.

Interrupting a state does not delete the handle, but still triggers onDeactivate().
coccarolla
mabelzile
__init__() is the Python handle constructor and is called when the state is entered and the handle is created.
onActivate() is called by Houdini to initialize an existing handle, either when the state is first entered or when it is resumed.

When the state exits, onDeactivate() is called and the handle is deleted. The next time the state is entered, a new handle is created and onActivate() is called again.

Interrupting a state does not delete the handle, but still triggers onDeactivate().

Great, things are starting to make sense.
Can you share a bit of insight on how to use onDeactivate specifically? Do you need to call something to delete the handle or is that handled by Houdini on exiting the viewer state? I know about registering, is that the same?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB