mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Docking: Fix DockContextRebuild() temporarily invalidating dockid reference leading to undesirable merging of nodes.
This commit is contained in:
parent
46dff42239
commit
1ae0a1e658
14
imgui.cpp
14
imgui.cpp
@ -9634,11 +9634,11 @@ namespace ImGui
|
|||||||
static void DockContextQueueDock(ImGuiContext* ctx, ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload, ImGuiDir split_dir, float split_ratio, bool split_outer);
|
static void DockContextQueueDock(ImGuiContext* ctx, ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload, ImGuiDir split_dir, float split_ratio, bool split_outer);
|
||||||
static void DockContextQueueNotifyRemovedNode(ImGuiContext* ctx, ImGuiDockNode* node);
|
static void DockContextQueueNotifyRemovedNode(ImGuiContext* ctx, ImGuiDockNode* node);
|
||||||
static void DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req);
|
static void DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req);
|
||||||
static void DockContextProcessUndockWindow(ImGuiContext* ctx, ImGuiWindow* window);
|
static void DockContextProcessUndockWindow(ImGuiContext* ctx, ImGuiWindow* window, bool clear_persistent_docking_ref = true);
|
||||||
static void DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node);
|
static void DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node);
|
||||||
static void DockContextPruneUnusedSettingsNodes(ImGuiContext* ctx);
|
static void DockContextPruneUnusedSettingsNodes(ImGuiContext* ctx);
|
||||||
static ImGuiDockNode* DockContextFindNodeByID(ImGuiContext* ctx, ImGuiID id);
|
static ImGuiDockNode* DockContextFindNodeByID(ImGuiContext* ctx, ImGuiID id);
|
||||||
static void DockContextClearNodes(ImGuiContext* ctx, ImGuiID root_id, bool clear_persistent_docking_references); // Set root_id==0 to clear all
|
static void DockContextClearNodes(ImGuiContext* ctx, ImGuiID root_id, bool clear_persistent_docking_refs); // Set root_id==0 to clear all
|
||||||
static void DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDockNodeSettings* node_settings_array, int node_settings_count);
|
static void DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDockNodeSettings* node_settings_array, int node_settings_count);
|
||||||
static void DockContextBuildAddWindowsToNodes(ImGuiContext* ctx, ImGuiID root_id); // Use root_id==0 to add all
|
static void DockContextBuildAddWindowsToNodes(ImGuiContext* ctx, ImGuiID root_id); // Use root_id==0 to add all
|
||||||
|
|
||||||
@ -10129,11 +10129,11 @@ void ImGui::DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req)
|
|||||||
MarkIniSettingsDirty();
|
MarkIniSettingsDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::DockContextProcessUndockWindow(ImGuiContext* ctx, ImGuiWindow* window)
|
void ImGui::DockContextProcessUndockWindow(ImGuiContext* ctx, ImGuiWindow* window, bool clear_persistent_docking_ref)
|
||||||
{
|
{
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
if (window->DockNode)
|
if (window->DockNode)
|
||||||
DockNodeRemoveWindow(window->DockNode, window, 0);
|
DockNodeRemoveWindow(window->DockNode, window, clear_persistent_docking_ref ? 0 : window->DockId);
|
||||||
else
|
else
|
||||||
window->DockId = 0;
|
window->DockId = 0;
|
||||||
window->Collapsed = false;
|
window->Collapsed = false;
|
||||||
@ -11671,10 +11671,10 @@ void ImGui::DockBuilderRemoveNodeDockedWindows(ImGuiContext* ctx, ImGuiID root_i
|
|||||||
bool want_removal = (root_id == 0) || (window->DockNode && DockNodeGetRootNode(window->DockNode)->ID == root_id) || (window->DockNodeAsHost && window->DockNodeAsHost->ID == root_id);
|
bool want_removal = (root_id == 0) || (window->DockNode && DockNodeGetRootNode(window->DockNode)->ID == root_id) || (window->DockNodeAsHost && window->DockNodeAsHost->ID == root_id);
|
||||||
if (want_removal)
|
if (want_removal)
|
||||||
{
|
{
|
||||||
ImGuiID backup_dock_id = window->DockId;
|
const ImGuiID backup_dock_id = window->DockId;
|
||||||
DockContextProcessUndockWindow(ctx, window);
|
DockContextProcessUndockWindow(ctx, window, clear_persistent_docking_references);
|
||||||
if (!clear_persistent_docking_references)
|
if (!clear_persistent_docking_references)
|
||||||
window->DockId = backup_dock_id;
|
IM_ASSERT(window->DockId == backup_dock_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user