diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-13 05:21:24 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-13 05:53:59 +0200 |
commit | 5cb62c2360c417b60a1a29a708f4605a347a948c (patch) | |
tree | 1725c22d5a40595a06f76e6ddd3dd1cd2b7091ad /editor/imgui.cpp | |
parent | 21bb9bb18f09b2a70d49de4ba426f43a957a1b08 (diff) |
editor: allow raising already-opened inspector window
Diffstat (limited to 'editor/imgui.cpp')
-rw-r--r-- | editor/imgui.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/editor/imgui.cpp b/editor/imgui.cpp index 96eb940f..3c483265 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -347,9 +347,19 @@ void app::do_popup_menu() const auto i = e.index(); if (ImGui::MenuItem("Activate", nullptr, false, e.can_activate(i))) e.activate(i); - if (bool b_ins = !check_inspector_exists(_popup_target); - ImGui::MenuItem("Inspect", nullptr, !b_ins, b_ins)) - inspectors.push_back(std::exchange(_popup_target, {})); + if (bool exists = check_inspector_exists(_popup_target); + ImGui::MenuItem("Inspect", nullptr, exists)) + { + if (!exists) + inspectors.push_back(std::exchange(_popup_target, {})); + else + { + char buf[32]; + entity_inspector_name(buf, sizeof buf, e.id); + ImGui::SetWindowFocus(buf); + ImGui::SetWindowCollapsed(buf, false); + } + } if (bool b_testing = tested_light_chunk == chunk_coords_(e.coord); e.type() == object_type::light) if (ImGui::MenuItem("Test", nullptr, b_testing)) |