imgui
imgui copied to clipboard
Add a flag to not draw the background of the dockspace.
In DockNodeUpdate()
// Draw whole dockspace background if ImGuiDockNodeFlags_PassthruCentralNode if set.
// We need to draw a background at the root level if requested by ImGuiDockNodeFlags_PassthruCentralNode, but we will only know the correct pos/size
// _after_ processing the resizing splitters. So we are using the DrawList channel splitting facility to submit drawing primitives out of order!
const bool render_dockspace_bg = node->IsRootNode() && host_window && (node_flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0;
if(render_dockspace_bg && node->IsVisible) {
host_window->DrawList->ChannelsSetCurrent(0);
if(central_node_hole)
RenderRectFilledWithHole(host_window->DrawList, node->Rect(), central_node->Rect(), GetColorU32(ImGuiCol_WindowBg), 0.0f);
else
host_window->DrawList->AddRectFilled(node->Pos, node->Pos + node->Size, GetColorU32(ImGuiCol_WindowBg), 0.0f);
}
Could it be possible to add an ImGuiDockNodeFlags_NoDockspaceBackground flag to change the code to:
// Draw whole dockspace background if ImGuiDockNodeFlags_PassthruCentralNode if set.
// We need to draw a background at the root level if requested by ImGuiDockNodeFlags_PassthruCentralNode, but we will only know the correct pos/size
// _after_ processing the resizing splitters. So we are using the DrawList channel splitting facility to submit drawing primitives out of order!
const bool render_dockspace_bg = node->IsRootNode() && host_window && ((node_flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0) && (0 == (node_flags & ImGuiDockNodeFlags_NoDockspaceBackground));
if(render_dockspace_bg && node->IsVisible) {
host_window->DrawList->ChannelsSetCurrent(0);
if(central_node_hole)
RenderRectFilledWithHole(host_window->DrawList, node->Rect(), central_node->Rect(), GetColorU32(ImGuiCol_WindowBg), 0.0f);
else
host_window->DrawList->AddRectFilled(node->Pos, node->Pos + node->Size, GetColorU32(ImGuiCol_WindowBg), 0.0f);
}
You can already use ImGuiDockNodeFlags_PassthruCentralNode and manipulate WindowBg color freely. This is showcased in the demo. Otherwise please ask precisely about your problem rather than ask about a possible solution.
EDIT You already asked a similar question in #5418. if you don't provide more details we can't help you. Right now the way you are wording the subject of this question is DIFFERENT from the code you are showing (Dockspace != DockNode).
Something like this should work:
PushStyleCol(ImGuICol_WindowBG, ImVec4(0,0,0,0));
DockSpace(...);
PopStyleCol();