summaryrefslogtreecommitdiffhomepage
path: root/editor/imgui.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-09-13 05:21:24 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-09-13 05:53:59 +0200
commit5cb62c2360c417b60a1a29a708f4605a347a948c (patch)
tree1725c22d5a40595a06f76e6ddd3dd1cd2b7091ad /editor/imgui.cpp
parent21bb9bb18f09b2a70d49de4ba426f43a957a1b08 (diff)
editor: allow raising already-opened inspector window
Diffstat (limited to 'editor/imgui.cpp')
-rw-r--r--editor/imgui.cpp16
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))