Bringing up the color editor via python

   5222   6   2
User Avatar
Member
59 posts
Joined: April 2006
Offline
Is there a HOM python function that will bring up a color editor dialog, allow the user to select a color, and return it as an (r,g,b) tuple?
User Avatar
Member
1914 posts
Joined: Nov. 2006
Online
Unfortunately there is not. You'll have to use something like the PyQt color picker.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
59 posts
Joined: April 2006
Offline
What is the recommended method for utilizing PyQt within a Houdini python script? The following (placed in a shelf button tool) just segfaults Houdini 12:

import PyQt4.Qt as qt
c = qt.QColorDialog.getColor()
print c
User Avatar
Member
1914 posts
Joined: Nov. 2006
Online
You need to integrate things into the Houdini UI event loop, similarly to this:

http://www.sidefx.com/docs/houdini12.1/hom/cookbook/pyqt/part1/ [sidefx.com]
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
hey Graham, wasn't there a python way of loading a .ui file? so if you make your custom editor (or say you want to launch the gallery manager) you can actually call out the .ui file? I seem to think that hou.ui had a method for this..
-G
User Avatar
Member
1914 posts
Joined: Nov. 2006
Online
You can create a dialog using a Houdini .ui file (hou.ui.createDialog). However, that is only useful for making fairly simple Houdini style UIs. There are no simple widgets that represent the Houdini color picker, so it's not really applicable here.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
380 posts
Joined: July 2005
Offline
Noticed the H14 Color Editor is way better than the default PyQt.QColorDialog color editor. is this one available to lauch is it PyQt? is it exposed?
  • Quick Links