Skip to content

Commit

Permalink
AddDockableWindow: warn if dockSpace not found
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Sep 21, 2024
1 parent e6c79d8 commit b06ddb7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/hello_imgui/internal/docking_details.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,23 @@ namespace AddDockableWindowHelper
}
if (!doesWindowHavePreviousSetting || dockableWindow.forceDockspace)
{
auto dockId = HelloImGui::GetRunnerParams()->dockingParams.dockSpaceIdFromName(dockableWindow.dockableWindow.dockSpaceName);
if (dockId.has_value())
auto dockSpaceName = dockableWindow.dockableWindow.dockSpaceName;
if (!dockSpaceName.empty())
{
ImGui::Begin(dockableWindow.dockableWindow.label.c_str());
ImGui::Dummy(ImVec2(10, 10));
ImGui::End();

ImGui::DockBuilderDockWindow(dockableWindow.dockableWindow.label.c_str(), dockId.value());
auto dockId = HelloImGui::GetRunnerParams()->dockingParams.dockSpaceIdFromName(dockSpaceName);
if (dockId.has_value())
{
ImGui::Begin(dockableWindow.dockableWindow.label.c_str());
//ImGui::Dummy(ImVec2(10, 10));
dockableWindow.dockableWindow.GuiFunction();
ImGui::End();

ImGui::DockBuilderDockWindow(dockableWindow.dockableWindow.label.c_str(), dockId.value());
}
else
{
fprintf(stderr, "DockableWindow %s: dockSpaceName %s not found\n", dockableWindow.dockableWindow.label.c_str(), dockableWindow.dockableWindow.dockSpaceName.c_str());
}
}
}

Expand Down

0 comments on commit b06ddb7

Please sign in to comment.