Python command to refresh Context Options Editor?
2957 6 1- Tim Crowson
- Member
- 240 posts
- Joined: Oct. 2014
- Offline
Is there a method available to refresh the Context Options Editor UI via Python? I am automating the management of certain Context Options, which is working fine, but to see my automated changes in the Editor I have to click the Refresh button. Is there a method I can call that does the same thing?
- Tim Crowson
Technical/CG Supervisor
Technical/CG Supervisor
- Hamilton Meathouse
- Member
- 169 posts
- Joined: Nov. 2013
- Offline
You could map it to a hotkey or run as a pre-flight script.
Drag the button into the python shell window. That will give you the parm name. Add “.pressButton()” to the end of that parm and hit enter.
If that works, then you could make a python shelf script and assign that script a hotkey. It's not automated in the sense you are looking for, but may be of use during day-to-day work.
Drag the button into the python shell window. That will give you the parm name. Add “.pressButton()” to the end of that parm and hit enter.
If that works, then you could make a python shelf script and assign that script a hotkey. It's not automated in the sense you are looking for, but may be of use during day-to-day work.
- Tim Crowson
- Member
- 240 posts
- Joined: Oct. 2014
- Offline
Unfortunately the Context Options Panel's buttons don't seem to be parms per se. Even the docs for the panel say that options added via hou.setContextOption() would require the user to click on the refresh button.
But we really need the option to force this refresh programmatically without clicking (i.e. if a certain event is triggered, fire the update command). Manually managing context options isn't always desirable or even practical, especially if the content we are managing is complex. We have easy methods for managing the options themselves, we just need a method to update the options in the UI. If the method that is being called by the refresh button can be exposed to us, that would do the trick.
But we really need the option to force this refresh programmatically without clicking (i.e. if a certain event is triggered, fire the update command). Manually managing context options isn't always desirable or even practical, especially if the content we are managing is complex. We have easy methods for managing the options themselves, we just need a method to update the options in the UI. If the method that is being called by the refresh button can be exposed to us, that would do the trick.
Edited by Tim Crowson - May 16, 2020 18:05:33
- Tim Crowson
Technical/CG Supervisor
Technical/CG Supervisor
- mtucker
- Staff
- 4438 posts
- Joined: July 2005
- Offline
The context options UI is a python panel, defined in $HH/python2.7libs/contextoptions.py. It defines an OptionsEditor class with a reload() method (which is what the Refresh button calls).
The problem is that right now, the Context Options menu item creates a new panel every time that menu item is chosen. So there is no way to access a global OptionsEditor object on which to call the reload method. I'd say this is a bug, and I'll report it as such. But for now, you could probably customize the MainMenuCommon.xml menu file that defines the top level menu, and change the Context Options menu item behavior to put a single shared OptionsEditor object in the Houdini session module, then you can call reload on that OptionsEditor whenever you change an option value.
The problem is that right now, the Context Options menu item creates a new panel every time that menu item is chosen. So there is no way to access a global OptionsEditor object on which to call the reload method. I'd say this is a bug, and I'll report it as such. But for now, you could probably customize the MainMenuCommon.xml menu file that defines the top level menu, and change the Context Options menu item behavior to put a single shared OptionsEditor object in the Houdini session module, then you can call reload on that OptionsEditor whenever you change an option value.
- Tim Crowson
- Member
- 240 posts
- Joined: Oct. 2014
- Offline
- protean
- Member
- 72 posts
- Joined: July 2006
- Offline
- gg3d
- Member
- 1 posts
- Joined: Sept. 2019
- Offline
-
- Quick Links