Custom Popup Menu

   8763   5   3
User Avatar
Member
216 posts
Joined: 10月 2015
Offline
Hi !

Is there a way to make a custom popup menu (like the one on the “tab” key) to put my own script/command/asset and don't “polute” the factory one ?

Like this in Sofimage : http://rray.de/xsi/xpop/ [rray.de]

Thanks.
User Avatar
スタッフ
476 posts
Joined: 4月 2014
Offline
It is certainly possible.

Look at the following thread where a user created a really impressive modeling toolbox.
https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=41478&start=50&postdays=0&postorder=asc&highlight= [sidefx.com]

Houdini ships with PySide built-in, so you can install a global Qt event filter and react to mouse clicks from Python.

https://srinikom.github.io/pyside-docs/PySide/QtCore/QObject.html#PySide.QtCore.PySide.QtCore.QObject.installEventFilter [srinikom.github.io]

You would need to do something like:

class KeyPressEater(QObject):
def eventFilter(self, obj, event):
if event.type() == QEvent.KeyPress:
print “Ate key press”, event.key()
return True
else:
# standard event processing
return QObject.eventFilter(self, obj, event)

keyPressEater = KeyPressEater(self)
hou.ui.mainQtWindow().installEventFilter(keyPressEater)


This code is untested and if it works, it will capture all the keyPress event leaving Houdini in a zombie state. Once you have the filter up and running and can hook any PySide code you want to it.
User Avatar
Member
216 posts
Joined: 10月 2015
Offline
Hello Guillaume,

That's seems to be good, I will look at this !
Thanks.
User Avatar
Member
678 posts
Joined: 7月 2005
Offline
:evil:
User Avatar
Member
216 posts
Joined: 10月 2015
Offline
Hello, Here we have !
odforce post [forums.odforce.net]
User Avatar
Member
161 posts
Joined: 5月 2015
Offline
Awesome, thanks for sharing!
  • Quick Links