How to make a python UI state permanent?

   1302   4   0
User Avatar
Member
60 posts
Joined: July 2014
Offline
Hi all

I have a working python state that displays some information in the UI. I want this state to always be active from the moment Houdini starts. Can anyone tell me how to do that? My state seems to disable when I select different objects no matter what I change.

Thanks!
User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
By default python states belongs to one context only, you can register your state with multiple contexts that would keep the state active as you select nodes in different contexts. Take a look at the context argument of the hou.ViewerStateTemplate API

https://www.sidefx.com/docs/houdini18.0/hom/hou/ViewerStateTemplate.html [www.sidefx.com]
Edited by mabelzile - Aug. 7, 2020 17:00:14
User Avatar
Member
60 posts
Joined: July 2014
Offline
I guess what I'm trying to do is not make it sensitive to selection at all. If I specify a node, I want the state to stay active regardless of what I'm currently selecting or not. Is that possible? Basically I want a UI overlay that displays information on a node whether it's the current selection or not. It seems that even when selecting nodes of the same context is stops displaying my state.

Thanks so much!
Edited by ndasilva - Aug. 8, 2020 00:58:04
User Avatar
Staff
397 posts
Joined: Feb. 2018
Offline
By adding multi contexts to your state it will make it nodeless and should become insensitive to node selection, providing your state is compatible with the selected node context.
User Avatar
Member
60 posts
Joined: July 2014
Offline
That seems to have done the trick. Thanks!
  • Quick Links