From ce9e612636bf76ea5ac2e18855784b70e952b2f2 Mon Sep 17 00:00:00 2001 From: Patrick Dawson Date: Thu, 18 Jan 2024 05:23:03 +0100 Subject: [PATCH] Viewports are stable --- addons/imgui-godot/ImGuiGodot/ImGuiGD.cs | 12 +----------- addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs | 7 ++++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs b/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs index 7d510b6..339f98d 100644 --- a/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs +++ b/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs @@ -157,26 +157,16 @@ public static void Shutdown() ImGui.DestroyContext(); } - /// - /// EXPERIMENTAL! Please report bugs, with steps to reproduce. - /// + [Obsolete("just set ImGuiConfigFlags.ViewportsEnable instead")] public static void ExperimentalEnableViewports() { var io = ImGui.GetIO(); - io.BackendFlags |= ImGuiBackendFlags.PlatformHasViewports; io.ConfigFlags |= ImGuiConfigFlags.ViewportsEnable; if (OS.GetName() != "Windows") { GD.PushWarning("ImGui Viewports have issues on macOS and Linux https://github.com/ocornut/imgui/wiki/Multi-Viewports#issues"); } - - var mainvp = ImGuiLayer.Instance.GetViewport(); - if (mainvp.GuiEmbedSubwindows) - { - GD.PushWarning("ImGui Viewports: 'display/window/subwindows/embed_subwindows' needs to be disabled"); - mainvp.GuiEmbedSubwindows = false; - } } /// diff --git a/addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs b/addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs index 1c2436e..570b349 100644 --- a/addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs +++ b/addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs @@ -23,7 +23,12 @@ public GodotImGuiWindow(ImGuiViewportPtr vp) Rect2I winRect = new(_vp.Pos.ToVector2I(), _vp.Size.ToVector2I()); - ImGuiLayer.Instance.GetViewport().GuiEmbedSubwindows = false; + Window mainWindow = ImGuiLayer.Instance.GetWindow(); + if (mainWindow.GuiEmbedSubwindows) + { + GD.PushWarning("ImGui Viewports: 'display/window/subwindows/embed_subwindows' needs to be disabled"); + mainWindow.GuiEmbedSubwindows = false; + } GodotWindow = new Window() {