1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-02-02 03:40:06 +00:00

Docking: Added an assert to clarify that ImGuiDockNodeFlags_CentralNode flag does not need to be passed to DockSpace(). (#8145)

This commit is contained in:
ocornut 2024-11-26 11:36:50 +01:00
parent dad1047b04
commit 14d213ca85
3 changed files with 9 additions and 2 deletions

View file

@ -4957,7 +4957,7 @@ void ImGui::StartMouseMovingWindowOrNode(ImGuiWindow* window, ImGuiDockNode* nod
{
// Can undock if:
// - part of a hierarchy with more than one visible node (if only one is visible, we'll just move the root window)
// - part of a dockspace node hierarchy: so we can undock the last single visible node too (trivia: undocking from a fixed/central node will create a new node and copy windows)
// - part of a dockspace node hierarchy: so we can undock the last single visible node too. Undocking from a fixed/central node will create a new node and copy windows.
ImGuiDockNode* root_node = DockNodeGetRootNode(node);
if (root_node->OnlyNodeWithWindows != node || root_node->CentralNode != NULL) // -V1051 PVS-Studio thinks node should be root_node and is wrong about that.
can_undock_node = true;
@ -19320,7 +19320,9 @@ ImGuiID ImGui::DockSpace(ImGuiID dockspace_id, const ImVec2& size_arg, ImGuiDock
if ((flags & ImGuiDockNodeFlags_KeepAliveOnly) == 0)
window = GetCurrentWindow(); // call to set window->WriteAccessed = true;
IM_ASSERT((flags & ImGuiDockNodeFlags_DockSpace) == 0);
IM_ASSERT((flags & ImGuiDockNodeFlags_DockSpace) == 0); // Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags!
IM_ASSERT((flags & ImGuiDockNodeFlags_CentralNode) == 0); // Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! (#8145)
IM_ASSERT(dockspace_id != 0);
ImGuiDockNode* node = DockContextFindNodeByID(&g, dockspace_id);
if (node == NULL)