Custom color swatches in network view

   5636   12   5
User Avatar
Member
2 posts
Joined: June 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
User Avatar
Staff
2540 posts
Joined: July 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.
There's at least one school like the old school!
User Avatar
Member
2 posts
Joined: June 2011
Offline
It works spendidly :-)
Thanks

Attachments:
ColorSwatchCreator_v1.otl (18.1 KB)
ColorSwatchCreatorTest.hiplc (55.0 KB)
Example_Color_Swatch.png (97.1 KB)

User Avatar
Staff
2540 posts
Joined: July 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.
There's at least one school like the old school!
User Avatar
Member
99 posts
Joined: Sept. 2006
Offline
thanks
thats a good one
today i was doing an asset and its full of network boxes
and was wondering the same
User Avatar
Staff
4159 posts
Joined: Sept. 2007
Offline
Woh, golden tidbits!

Thanks centipede/jeff!
I'm o.d.d.
User Avatar
Member
99 posts
Joined: Sept. 2006
Offline
my custom pallete is up and shining

what about network editor preferences
how can i setup so grid will be always on as points and showing
and conection style to be rounded by default?

thanks
User Avatar
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()))

Attachments:
custNodeColor.jpg (99.0 KB)

User Avatar
Member
678 posts
Joined: Feb. 2017
Offline
Hey hkspowers,

I would like to try your node color script. Unfortunately, it gives me the following error:


IndentationError: ('expected an indented block', ('COLORS', 5, 9, 'nodeColor = selectedNodes.color()\n'))

Do you know how to fix this?

Thank you and
Cheers
CYTE
User Avatar
Member
27 posts
Joined: Feb. 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 - May 5, 2020 10:45:00
English is not my native language, sorry in advance for any misunderstanding
User Avatar
Member
678 posts
Joined: Feb. 2017
Offline
Hey andev,

thank you!
Now, it gives me this error:
Traceback (most recent call last):
  File "COLORS", line 1, in <module>
ImportError: No module named PySide

Does this mean I have to install PySide?

Cheers
CYTE
User Avatar
Member
27 posts
Joined: Feb. 2017
Offline
Now fixed for H16+
English is not my native language, sorry in advance for any misunderstanding
User Avatar
Member
678 posts
Joined: Feb. 2017
Offline
Hey andev,

Thank you. I´m on H18 and it is working now.

Cheers
CYTE
  • Quick Links