[Python] Updating UI color scheme with shelf tool?

   1257   6   1
User Avatar
Member
55 posts
Joined: 4月 2017
Offline
Hey all. Bit silly perhaps, but trying to make a shelf tool that toggles between Auto Update and Manual cook modes, and then changes UI color schemes to clearly show when you're in Manual mode, to avoid user error like when locking a camera.
To work faster with a shortcut in scenes that autocook on any selection, like with Polyreduce or sims.

Below is just the color scheme part. Trying to use a method that sets a custom color scheme file inside the houdini.pref file under $HOME/Houdini20.0/ using 'hou.setPreference'
https://www.sidefx.com/docs/houdini/hom/hou/setPreference.html [www.sidefx.com]
(Since setting the default colors.scheme pref doesn't seem to change, I tried adding it as a custom pref, but can't tell from documentation if that would even overrule the default, or just creates a new custom pref completely unrelated to it)

The UI file is called 'UIManual.hcs' (labeled Houdini Manual) located under $HOME/Houdini20.0/config as well as the Houdini install config folder just in case.

While it sets the houdini.pref file to custom.colors.scheme correctly, for some reason it just won't update the Houdini UI.

Any idea, or perhaps a better approach?
I have limited coding experience by the way, and this is my first Python.

import hou

hou.refreshPreferences()
color_scheme = hou.getPreference("colors.scheme")
hou.refreshPreferences()
hou.setPreference("custom.colors.scheme", "Houdini Manual")
hou.refreshPreferences()
User Avatar
Member
4730 posts
Joined: 2月 2012
Offline
Hi,

I was using viewport outline like this for camera lock but it can also be purposed for the cooking mode. I think something more subtle might work better for this since it's a very common workflow. I would likely outline only the cooking mode button itself, might be less distracting.



More ideas here:
https://www.sidefx.com/forum/topic/71012/?page=1 [www.sidefx.com]
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
188 posts
Joined: 2月 2016
Online
I have submitted a RFE for this(#145610), currently there is no way to change the UI color scheme through python
Edited by AslakKS - 2024年5月30日 05:54:36
User Avatar
Member
55 posts
Joined: 4月 2017
Offline
animatrix_
Hi,

I was using viewport outline like this for camera lock but it can also be purposed for the cooking mode. I think something more subtle might work better for this since it's a very common workflow. I would likely outline only the cooking mode button itself, might be less distracting.

More ideas here:
https://www.sidefx.com/forum/topic/71012/?page=1 [www.sidefx.com]

Nice, I'll have a look at the link. Thanks.
Currently just made a colour adjustment to the network box which seems OK, but could be more subtle heh
User Avatar
Member
55 posts
Joined: 4月 2017
Offline
AslakKS
I have submitted a RFE for this(#145610), currently there is no way to change the UI color scheme through python
I thought that might be the case. Thanks!
Wish I could upvote your RFE
User Avatar
Member
188 posts
Joined: 2月 2016
Online
Quite sure you can by submitting your own RFE and referencing the RFE number I included in my post
User Avatar
Member
55 posts
Joined: 4月 2017
Offline
These functions were added in 20.5.203 that might help:

Added HOM UI methods to reload color scheme and get current color scheme.

currentColorScheme()
Return the currently applied Houdini color scheme name.

reloadColorScheme()
Reloads all Houdini UI color settings from the configuration files (by default, in
$HFS/houdini/config and $HOUDINI_USER_PREF_DIR/ houdini/config).
Edited by MathiasJ - 2024年7月24日 17:29:52
  • Quick Links