How to hook to OnEnter of an existing Python state?

   350   2   0
User Avatar
Member
730 posts
Joined: Aug. 2019
Offline
For example, I'd like to make Houdini to run some code when it enters KineFX state. But KineFX state is built-in, not written by me, and I'd not like to change Houdini's built-in Python code directly. Is it possible to hook my functions/scripts to an existing state so it's called upon entering that state?
User Avatar
Staff
455 posts
Joined: Feb. 2018
Offline
You could install a callback on the hou.SceneViewer object where the state is running and listen for the hou.sceneViewerEvent.StateEntered event.

https://www.sidefx.com/docs/houdini21.0/hom/hou/SceneViewer.html#addEventCallback [www.sidefx.com]
User Avatar
Member
730 posts
Joined: Aug. 2019
Offline
mabelzile
You could install a callback on the hou.SceneViewer object where the state is running and listen for the hou.sceneViewerEvent.StateEntered event.

https://www.sidefx.com/docs/houdini21.0/hom/hou/SceneViewer.html#addEventCallback [www.sidefx.com]

Thank you very much! Exactly what I need.
  • Quick Links