You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the value of ImGui::GetStyle().Alpha is changed (fade in/fade out window transitions) before a call to ImGui::Begin(), I expect the next rendered window to be drawn at the specified alpha value. This works correctly as I expect:
clion64_ZKOCoque3h.mp4
However, in the scenario that there is a docked window A and a floating window B, when B is closed and a fade out occurs, the alpha of window A also changes. This only occurs while window A is docked. When undocked, it behaves as expected:
clion64_RE88PY0hDH.mp4
My render logic is as follows:
for every window:
set ImGui::GetStyle().Alpha to the desired alpha of the window
render window and calculate the alpha to use on next render
As per above, I am not making the mistake of setting the alpha value once per frame swap - it is set correctly per window.
It looks like the dock is not taking into account the requested alpha when ImGui::Begin() is called on the window and instead draws docked windows at whatever alpha was set directly before the call to ImGui::DockSpaceOverViewport (in the case above, when window B fades out, it's whatever alpha that was set to).
Probably more a question than a report at this stage... is this intended behaviour?
Omar, I'm also aware you posted a comment in a recent docking question:
As always the recurrent problem with docking questions is that people want to manipulate a dock node property which is shared by multiple windows, by definition there is a potential conflict, what is 2 windows which have opposite requests are docked together?
Indeed, my expectation would be problematic when more than once window is docked... Though my question still stands.
Screenshots/Video:
as above
Minimal, Complete and Verifiable Example code:
#defineFADE_EPISOLON0.01f
#defineFADE_TIME2.0f// 2 secondsfloatrender_window(float alpha, constchar *title, bool close)
{
ImGui::GetStyle().Alpha = alpha;
ImGui::Begin(title);
if (!close)
{
// fade in the windowif (std::abs(1.0f - alpha) > FADE_EPISOLON)
alpha = std::clamp(alpha + (ImGui::GetIO().DeltaTime / FADE_TIME), 0.0f, 1.0f);
else
alpha = 1.0f;
}
else
{
// fade out the windowif (alpha > FADE_EPISOLON)
alpha -= ImGui::GetIO().DeltaTime / FADE_TIME;
else
alpha = -1.0f;
}
ImGui::End();
return alpha;
}
voiddraw()
{
// NOTE: If I uncomment the following line, a different problem arises: any docked window will// no longer fade in.//ImGui::GetStyle().Alpha = 1.0f;ImGui::DockSpaceOverViewport(ImGui::GetMainViewport(), ImGuiDockNodeFlags_PassthruCentralNode);
if (alpha_a >= 0.0f)
alpha_a = render(alpha_a, "first", false);
if (alpha_b >= 0.0f)
alpha_b = render(alpha_b, "second", animate < 0.0f);
animate -= ImGui::GetIO().DeltaTime; // dirty 4 second pause before we fade out window B
}
intmain()
{
// all of the initialisation code as per the SDL2/OpenGL3 example on GitHubwhile (!done)
{
// SDL_PollEvent and ImGui::NewFrame() stuffdraw();
// ImGui::Render() and SDL_GL_SwapWindow stuff
}
// all of the cleanup code as per the SDL2/OpenGL3 example on GitHubreturn0;
}
The text was updated successfully, but these errors were encountered:
However, in the scenario that there is a docked window A and a floating window B, when B is closed and a fade out occurs, the alpha of window A also changes. This only occurs while window A is docked. When undocked, it behaves as expected:
You are overriding global Alpha and not restoring it. So it leaks into those other windows and is used by the docking system inside NewFrame().
Use PushStyleVar(ImGuiStyleVar_Alpha, alpha); .... PopStyleVar() instead.
Version/Branch of Dear ImGui:
Version 1.90.5, Branch: docking
Back-ends:
imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
MinGW 11.0 w64 (bundled with CLion)
Full config/build information:
Details:
My Issue/Question:
When the value of
ImGui::GetStyle().Alpha
is changed (fade in/fade out window transitions) before a call toImGui::Begin()
, I expect the next rendered window to be drawn at the specified alpha value. This works correctly as I expect:clion64_ZKOCoque3h.mp4
However, in the scenario that there is a docked window A and a floating window B, when B is closed and a fade out occurs, the alpha of window A also changes. This only occurs while window A is docked. When undocked, it behaves as expected:
clion64_RE88PY0hDH.mp4
My render logic is as follows:
As per above, I am not making the mistake of setting the alpha value once per frame swap - it is set correctly per window.
It looks like the dock is not taking into account the requested alpha when
ImGui::Begin()
is called on the window and instead draws docked windows at whatever alpha was set directly before the call toImGui::DockSpaceOverViewport
(in the case above, when window B fades out, it's whatever alpha that was set to).Probably more a question than a report at this stage... is this intended behaviour?
Omar, I'm also aware you posted a comment in a recent docking question:
Indeed, my expectation would be problematic when more than once window is docked... Though my question still stands.
Screenshots/Video:
as above
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: