[Sidefx-houdini-list] Intercepting menu buttons on Type Properties.

Andy Nicholas andy at andynicholas.com
Tue Oct 11 12:43:52 EDT 2016

So I had a quick play with it. I tried installing an event filter to find when the dialog was closed, but that didn’t work. I suspect it’s possibly a threading issue.

What I’ve done below seems to work, but it’s a bit of a hack to be honest. As far as I can see though, there’s nothing that directly supports what you want. 

To try it out, just copy the code below into Houdini's Python Source Editor, select a node and run “hou.session.test()” from the Python shell.

from time import sleep
from PySide import QtGui,QtCore
import hou       

def launch_type_properties(current_node, on_close_callback):
    #We want to make sure we don't use any existing window that has focus
    existing_window = QtGui.QApplication.activeWindow()

    #Open up the Type Properties window
    active_window = None
    found = False
    #We don't want to loop forever in case something unexpected happens
    while count<30:
        active_window = QtGui.QApplication.activeWindow()
        title = active_window.windowTitle()    

        #Error checking here sucks. Need to test edge cases where
        # another dialog or window unexpectedly pops up

        if title == "Edit Operator Type Properties" and existing_window!=active_window:
            found = True

    while found:
        if active_window.isVisible() is False:
            on_close_callback(active_window, current_node)
def on_close(window, current_node):
    hou.ui.displayMessage("Type Properties Closed for "+current_node.name())

def test():
    #Your menu should be able to pass the current node, rather than using selection like this
    sel = hou.selectedNodes()
    if len(sel)!=1:
        hou.ui.displayMessage("Make sure you select a node first")
    current_node = sel[0]
    launch_type_properties(current_node, on_close)

> On 11 Oct 2016, at 16:21, Andy Nicholas <andy at andynicholas.com> wrote:
> I can partly solve your problem, but then, unfortunately, give you another one to figure out :)
> If you can override the “Type Properties…" menu, then you can replace it with your own that calls this function:
>    hou.ui.openTypePropertiesDialog(node_or_node_type, promote_spare_parms=False, immediately_save=False)
> which will open the HDA Type Properties dialog for you.
> The only problem is that it’s not modal and will return straight away. However, there maybe a (platform dependent) way of using Python to get a handle for the Type Properties window so you can figure out when it’s closed. In theory, it’s all PyQt now, so it’s possible that it might be relatively easy to do.
> Once you know it’s closed, you can check to see if the HDA file on disk has been modified.
>> On 11 Oct 2016, at 15:56, Sandy Sutherland <sandy.maillists at gmail.com> wrote:
>> Hi All,
>> Given that you can modify the menu xml filesto intercept and change any
>> menu item in Houdini, is it possible to intercept the buttons like the
>> Accept Button on the bottom of the Type Properties GUI?
>> We are looking into this, to add methods for our version publishing system,
>> when saving and creating HDAs.
>> Thanks
>> Sandy
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list

More information about the Sidefx-houdini-list mailing list