Skip to content

Commit

Permalink
Viewports are stable
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jan 18, 2024
1 parent dd26463 commit ce9e612
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 1 addition & 11 deletions addons/imgui-godot/ImGuiGodot/ImGuiGD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,16 @@ public static void Shutdown()
ImGui.DestroyContext();
}

/// <summary>
/// EXPERIMENTAL! Please report bugs, with steps to reproduce.
/// </summary>
[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;
}
}

/// <returns>
Expand Down
7 changes: 6 additions & 1 deletion addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit ce9e612

Please sign in to comment.