Custom color swatches in network view
5693 12 5- centipede
- Member
- 2 posts
- Joined: 6月 2011
- Offline
Hi. Quick question.
Would it be possible to put a different set of colors in the little color box with 6x6 default colors (the one you get by pressing ‘C’ in network view) by changing a configuration file or a startup script?
I know that node colors and network boxes in the network view can be assigned any color via scripting. The usual reds-yellows-green-blue etc. are a little too bright for me.
Cheers,
Centipede
Would it be possible to put a different set of colors in the little color box with 6x6 default colors (the one you get by pressing ‘C’ in network view) by changing a configuration file or a startup script?
I know that node colors and network boxes in the network view can be assigned any color via scripting. The usual reds-yellows-green-blue etc. are a little too bright for me.
Cheers,
Centipede
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- Offline
The configuration file is in $HFS/houdini/config/opColorPalette.def
It is a simple text file with RGB values for each entry. Make sure it stays as a text file when you save it. Use a proper text editor as well. No .txt extensions please as most windows text editors will do that to you. I use vim.
You can edit this file directly but it is advised that you copy this file to your $HOME/houdini/config directory and edit here. $HOUDINI_PATH automatically expands to include $HOME/houdini to override $HFS/houdini so you should pick up the edited file. Last one wins.
The colours in the file are in reverse order going from lower right to upper left.
The first line indicates how many entries in multiples of 6 and defaults to 36.
Edit away.
It is a simple text file with RGB values for each entry. Make sure it stays as a text file when you save it. Use a proper text editor as well. No .txt extensions please as most windows text editors will do that to you. I use vim.
You can edit this file directly but it is advised that you copy this file to your $HOME/houdini/config directory and edit here. $HOUDINI_PATH automatically expands to include $HOME/houdini to override $HFS/houdini so you should pick up the edited file. Last one wins.
The colours in the file are in reverse order going from lower right to upper left.
The first line indicates how many entries in multiples of 6 and defaults to 36.
Edit away.
There's at least one school like the old school!
- centipede
- Member
- 2 posts
- Joined: 6月 2011
- Offline
- old_school
- スタッフ
- 2540 posts
- Joined: 7月 2005
- Offline
Very creative asset. Thank-you for sharing.
I like the way you use an in-line Python SOP to both preview color the geometry as well as drive the formatted result in to a string parameter at the top of the asset to be copy/pasted in to the colors file.
With the Python SOP, everything is clear and obvious for the user. No python module embedded in the asset. Good idea for prototyping, which this is.
I like the way you use an in-line Python SOP to both preview color the geometry as well as drive the formatted result in to a string parameter at the top of the asset to be copy/pasted in to the colors file.
With the Python SOP, everything is clear and obvious for the user. No python module embedded in the asset. Good idea for prototyping, which this is.
There's at least one school like the old school!
- arzo
- Member
- 99 posts
- Joined: 9月 2006
- Offline
- goldleaf
- スタッフ
- 4170 posts
- Joined: 9月 2007
- Offline
- arzo
- Member
- 99 posts
- Joined: 9月 2006
- Offline
- hkspowers
- Member
- 1 posts
- Joined:
- Offline
After working at a few studios that had their own versions of custom swatches, I decided I needed this feature as well. I can't take credit as I had help in figuring it out from several people and basically mimicked a much larger and more robust script but I find this to be the most simplified method out there.
Simply add the code as a shelf tool and assign the c shortcut to it to completely take over node color behavior.
you should get something like the attached image.
from PySide import QtGui, QtCore
selectedNodes = hou.selectedNodes()
if selectedNodes:
nodeColor = selectedNodes.color()
initialColor = QtGui.QColor()
initialColor.setRgbF(*nodeColor.rgb())
c = QtGui.QColorDialog.getColor(initialColor)
else:
c = QtGui.QColorDialog.getColor()
if c.isValid():
for n in selectedNodes:
n.setColor(hou.Color(c.getRgbF()))
Simply add the code as a shelf tool and assign the c shortcut to it to completely take over node color behavior.
you should get something like the attached image.
from PySide import QtGui, QtCore
selectedNodes = hou.selectedNodes()
if selectedNodes:
nodeColor = selectedNodes.color()
initialColor = QtGui.QColor()
initialColor.setRgbF(*nodeColor.rgb())
c = QtGui.QColorDialog.getColor(initialColor)
else:
c = QtGui.QColorDialog.getColor()
if c.isValid():
for n in selectedNodes:
n.setColor(hou.Color(c.getRgbF()))
- CYTE
- Member
- 680 posts
- Joined: 2月 2017
- Offline
- anvdev
- Member
- 27 posts
- Joined: 2月 2017
- Offline
from PySide2 import QtGui, QtCore, QtWidgets selectedNodes = hou.selectedNodes() if selectedNodes: nodeColor = selectedNodes[0].color() initialColor = QtGui.QColor() initialColor.setRgbF(*nodeColor.rgb()) c = QtWidgets.QColorDialog.getColor(initialColor) else: c = QtWidgets.QColorDialog.getColor() if c.isValid(): for n in selectedNodes: n.setColor(hou.Color(c.getRgbF()))
Edited by anvdev - 2020年5月5日 10:45:00
English is not my native language, sorry in advance for any misunderstanding
- CYTE
- Member
- 680 posts
- Joined: 2月 2017
- Offline
- anvdev
- Member
- 27 posts
- Joined: 2月 2017
- Offline
- CYTE
- Member
- 680 posts
- Joined: 2月 2017
- Offline
-
- Quick Links