From 271c258e4038e71228b3f8080a407988fd3c2432 Mon Sep 17 00:00:00 2001 From: goaaats Date: Sat, 10 May 2025 13:16:12 +0200 Subject: [PATCH] Add per-window opt-out for fades --- Dalamud/Interface/Windowing/Window.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 3ff39f42f..51a6549e7 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -143,6 +143,12 @@ public abstract class Window /// public uint OnCloseSfxId { get; set; } = 24u; + /// + /// Gets or sets a value indicating whether this window should not fade in and out, regardless of the users' + /// preference. + /// + public bool DisableFadeInFadeOut { get; set; } = false; + /// /// Gets or sets the position of this window. /// @@ -331,7 +337,7 @@ public abstract class Window internal void DrawInternal(WindowDrawFlags internalDrawFlags, WindowSystemPersistence? persistence) { this.PreOpenCheck(); - var isReducedMotion = internalDrawFlags.HasFlag(WindowDrawFlags.IsReducedMotion); + var doFades = !internalDrawFlags.HasFlag(WindowDrawFlags.IsReducedMotion) && !this.DisableFadeInFadeOut; if (!this.IsOpen) { @@ -360,7 +366,7 @@ public abstract class Window } } - this.fadeInTimer = !isReducedMotion ? 0f : FadeInOutTime; + this.fadeInTimer = doFades ? 0f : FadeInOutTime; return; } @@ -592,7 +598,7 @@ public abstract class Window this.pushedFadeInAlpha = false; } - if (!this.internalIsOpen && this.fadeOutTexture == null && !isReducedMotion) + if (!this.internalIsOpen && this.fadeOutTexture == null && doFades) { this.fadeOutTexture = Service.Get().CreateDrawListTexture( "WindowFadeOutTexture"); @@ -818,9 +824,10 @@ public abstract class Window style.Push(ImGuiStyleVar.WindowBorderSize, 0); style.Push(ImGuiStyleVar.FrameBorderSize, 0); - var fakeFlags = ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs | - ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoBackground; - if (ImGui.Begin(this.WindowName, fakeFlags)) + const ImGuiWindowFlags flags = ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoCollapse | + ImGuiWindowFlags.NoScrollWithMouse | ImGuiWindowFlags.NoMouseInputs | + ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoBackground; + if (ImGui.Begin(this.WindowName, flags)) { var dl = ImGui.GetWindowDrawList(); dl.AddImage(