From cb47ef48c974218dc86183da4a57d3a3d22c78ef Mon Sep 17 00:00:00 2001 From: Johannes Hezer Date: Wed, 8 Apr 2026 11:38:22 +0200 Subject: [PATCH 1/2] replace always stay on top with proper parenting to Unreals main window --- .gitignore | 1 + client/ayon_unreal/api/tools_ui.py | 35 +++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 910a4fbc..ca3e3e43 100644 --- a/.gitignore +++ b/.gitignore @@ -162,3 +162,4 @@ Temporary Items # ignore mkdocs build site/ +/client/ayon_unreal/integration/ diff --git a/client/ayon_unreal/api/tools_ui.py b/client/ayon_unreal/api/tools_ui.py index f1ebfecd..c227f099 100644 --- a/client/ayon_unreal/api/tools_ui.py +++ b/client/ayon_unreal/api/tools_ui.py @@ -21,7 +21,9 @@ from ayon_unreal.api import hierarchy import unreal - +from ayon_core.tools.console_interpreter.ui.window import ( + ConsoleInterpreterWindow +) class ToolsBtnsWidget(QtWidgets.QWidget): """Widget containing buttons which are clickable.""" @@ -29,7 +31,7 @@ class ToolsBtnsWidget(QtWidgets.QWidget): def __init__(self, parent=None): super(ToolsBtnsWidget, self).__init__(parent) - + self._console = None current_context_string = ( f"Context: {get_current_task_name()} - " f"{get_current_folder_path()}" @@ -44,6 +46,7 @@ def __init__(self, parent=None): render_btn = QtWidgets.QPushButton("Render...", self) sequence_btn = QtWidgets.QPushButton( "Build sequence hierarchy...", self) + console_btn = QtWidgets.QPushButton("Console...", self) experimental_tools_btn = QtWidgets.QPushButton( "Experimental tools...", self ) @@ -57,6 +60,7 @@ def __init__(self, parent=None): layout.addWidget(render_btn, 0) layout.addWidget(publish_btn, 0) layout.addWidget(sequence_btn, 0) + layout.addWidget(console_btn, 0) layout.addWidget(experimental_tools_btn, 0) layout.addStretch(1) @@ -65,9 +69,33 @@ def __init__(self, parent=None): render_btn.clicked.connect(self._on_render) publish_btn.clicked.connect(self._on_publish) sequence_btn.clicked.connect(self._on_sequence) + console_btn.clicked.connect(self._show_console) experimental_tools_btn.clicked.connect(self._on_experimental) self.context_btn.clicked.connect(self._on_context_change) + def _show_console(self): + if self._console is not None: + if self._console.isVisible(): + # Closing also saves the scripts directly. + # Thus we prefer to close instead of hide here + self._console.close() + return + else: + self._console.show() + self._console.raise_() + return + + widget = ConsoleInterpreterWindow(parent=self) + widget.setWindowTitle("Python Script Editor - Unreal Engine") + widget.setWindowFlags(widget.windowFlags() | + QtCore.Qt.Dialog | + QtCore.Qt.WindowMinimizeButtonHint) + widget.show() + widget.raise_() + + self._widget = widget + unreal.parent_external_window_to_slate(widget.winId()) + def _on_create(self): self.tool_required.emit("creator") @@ -123,7 +151,6 @@ def __init__(self, *args, **kwargs): self.setWindowFlags( QtCore.Qt.Window - | QtCore.Qt.WindowStaysOnTopHint ) self.setFocusPolicy(QtCore.Qt.StrongFocus) @@ -194,6 +221,7 @@ def show_popup(cls): cls._popup = ToolsPopup() cls._popup.show() + unreal.parent_external_window_to_slate(cls._popup.winId()) @classmethod def show_dialog(cls): @@ -203,6 +231,7 @@ def show_dialog(cls): cls._dialog = ToolsDialog() cls._dialog.show() + unreal.parent_external_window_to_slate(cls._dialog.winId()) cls._dialog.raise_() cls._dialog.activateWindow() From 563af22fb3f9f3066c01d9418d75d85fcf8739d4 Mon Sep 17 00:00:00 2001 From: Johannes Hezer Date: Tue, 26 May 2026 16:44:28 +0200 Subject: [PATCH 2/2] implementing change from antirotor --- client/ayon_unreal/api/tools_ui.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/ayon_unreal/api/tools_ui.py b/client/ayon_unreal/api/tools_ui.py index c227f099..465d906c 100644 --- a/client/ayon_unreal/api/tools_ui.py +++ b/client/ayon_unreal/api/tools_ui.py @@ -176,7 +176,9 @@ def showEvent(self, event): self._first_show = False def _on_tool_require(self, tool_name): - host_tools.show_tool_by_name(tool_name, parent=self) + tool = host_tools.show_tool_by_name(tool_name, parent=self) + if tool: + unreal.parent_external_window_to_slate(tool.winId()) class ToolsPopup(ToolsDialog):