diff --git a/engine.py b/engine.py index 25ffa21..028185b 100644 --- a/engine.py +++ b/engine.py @@ -1040,21 +1040,11 @@ def _create_dialog(self, title, bundle, widget, parent): dialog.raise_() dialog.activateWindow() - # special case to get windows to raise the dialog if sgtk.util.is_windows(): - # Anything beyond 16.5.481 bundles a PySide2 version that gives us - # a usable hwnd directly. We also check to make sure this is Qt5, - # since SideFX still offers Qt4/PySide builds of modern Houdinis. - if hou.applicationVersion() >= ( - 16, - 5, - 481, - ) and QtCore.__version__.startswith("5."): - hwnd = dialog.winId() - else: - ctypes.pythonapi.PyCObject_AsVoidPtr.restype = ctypes.c_void_p - ctypes.pythonapi.PyCObject_AsVoidPtr.argtypes = [ctypes.py_object] - hwnd = ctypes.pythonapi.PyCObject_AsVoidPtr(dialog.winId()) + # special case to get windows to raise the dialog + + hwnd = dialog.winId() + ctypes.windll.user32.SetActiveWindow(hwnd) return dialog diff --git a/startup.py b/startup.py index 850b2af..1c4e5ab 100644 --- a/startup.py +++ b/startup.py @@ -131,6 +131,33 @@ def prepare_launch(self, exec_path, args, file_to_open=None): self.logger.debug("Launch environment: %s" % (required_env,)) + # TODO - only for Houdini version 21.0+ + enable_sg_menu = self.get_setting("enable_sg_menu", True) + if enable_sg_menu: + + class MockEngine: + pass + + mock_engine = MockEngine() + mock_engine.logger = self.logger + + mock_engine._menu_name = "Flow Production Tracking" + if self.get_setting("use_short_menu_name", False): + mock_engine._menu_name = "FPTR" + + import tk_houdini + + xml_tmp_dir = required_env[bootstrap.g_temp_env] + menu_file = os.path.join(xml_tmp_dir, "MainMenuCommon.xml").replace( + os.path.sep, "/" + ) + + menu = tk_houdini.AppCommandsMenu(mock_engine, []) + self.logger.debug( + "Constructing dynamic PTR menu - before starting Houdini - special 21.0 behaviour" + ) + menu._create_dynamic_menu(menu_file) + return LaunchInformation(exec_path, args, required_env) def scan_software(self):