git.lucas.co / hou-control
SideFX Houdini customization package
git clone https://git.lucas.co/hou-control.git

commitfe666aa63174a5d7756ee8add5e980e8e098c2f3
parentf52e11c0ad
authorLucas Galante <[email protected]>
date2026-09-14 08:39
hc: centre the HC Panel on the Houdini window

The panel centred itself on the pane it was opened over, so a 900x600
dialog over a narrow pane hung off the window edge. It now anchors on the
main window's frame; the pane still decides which commands are listed.

Whether the position was honoured at all was the compositor's doing, not
Qt's: cce-fx granted a pre-map X11 configure request without recording it,
fixed alongside this in cce-compositor.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

 python3.13libs/hc/hcsession.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/python3.13libs/hc/hcsession.py b/python3.13libs/hc/hcsession.py
index 4d6acec..3b3ecbc 100644
--- a/python3.13libs/hc/hcsession.py
+++ b/python3.13libs/hc/hcsession.py
@@ -156,6 +156,12 @@ class HCSession:
         pane = self.currentPane()
         return pane.currentTab() if pane is not None else None
 
+    def mainWindowGeometry(self):
+        """The main Houdini window's frame, in the same screen space as
+        hou.Pane.qtScreenGeometry(), or None when there is no main window."""
+        main = hou.qt.mainWindow()
+        return main.frameGeometry() if main is not None else None
+
 
     """ Windows """
 
@@ -182,8 +188,10 @@ class HCSession:
         tab = self.currentTab()
         list_dict = HCMaps().commands(self, pane, tab)
 
-        anchor_geometry = pane.qtScreenGeometry() if pane is not None else None
-        panel = HCWidgets.SelectionDialog('hcpanel', list_dict, anchor_geometry=anchor_geometry)
+        # Centred on the Houdini window, not the pane the panel was opened
+        # over: the pane still decides which commands are listed, but a
+        # 900x600 dialog centred on a narrow pane hung off the window edge.
+        panel = HCWidgets.SelectionDialog('hcpanel', list_dict, anchor_geometry=self.mainWindowGeometry())
         panel.show()
         panel.raise_()
         panel.activateWindow()