hkspowers

hkspowers

About Me

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Custom color swatches in network view April 2, 2015, 1:43 a.m.

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()))