selection

This is just a "sublibrary" used by other functions.

cursor_linkGroup()

Returns a hou.paneLinkType of the pane under the cursor.

pane_linkGroup( panetype )

Returns the paneTab of a given type. Also checks to return the pane from the same "pin group".

parm_pane ()

parmnode ()

Returns the actual node, doesn't have to be selected when it is actual in the parm pane.

container ()

Returns the parent of the actual node.

source code

the following code is maintained also on my github
thank you, great people, I couldn't do this without you.

import hou


def cursor_linkGroup() :
    try:
        current_desktop = hou.ui.curDesktop()
        cursor_pane     = current_desktop.paneTabUnderCursor()
        cursor_group    = cursor_pane.linkGroup()

        # if cursor_group == hou.paneLinkType.FollowSelection or cursor_group == hou.paneLinkType.Pinned :
        #     return hou.paneLinkType.Group1
        # else :
        #     return cursor_group
        return cursor_group

    except:
        # not a pane
        return hou.paneLinkType.Group1


def pane_linkGroup( panetype ) :
    cursor_group = cursor_linkGroup()
    current_desktop = hou.ui.curDesktop()
    pane_under_cursor = current_desktop.paneTabUnderCursor()

    # first check under cursor
    if pane_under_cursor.type() == panetype :
        return pane_under_cursor

    # try it for the right group
    for pane in current_desktop.paneTabs() :
        if pane.type() == panetype :
            if pane.linkGroup() == cursor_group :
                return pane

    # if none found, then Group1
    cursor_group = hou.paneLinkType.Group1
    for pane in current_desktop.paneTabs() :
        if pane.type() == panetype :
            if pane.linkGroup() == cursor_group :
                return pane




#def parm_pane () :
#    pass


def parmnode () :
    parm_pane = hou.ui.curDesktop().paneTabOfType(hou.paneTabType.Parm)
    parmnode = parm_pane.currentNode()
    return parmnode


def container () :
    parm_pane = hou.ui.curDesktop().paneTabOfType(hou.paneTabType.Parm)
    parmnode = parm_pane.currentNode()
    container = parmnode.parent()
    return container