diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/app.hpp | 2 | ||||
-rw-r--r-- | editor/imgui-editors.cpp | 15 | ||||
-rw-r--r-- | editor/imgui.cpp | 7 | ||||
-rw-r--r-- | editor/tests.cpp | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/editor/app.hpp b/editor/app.hpp index 8a898e4f..d035d1ec 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -154,7 +154,7 @@ private: [[nodiscard]] bool tests_handle_mouse_move(const mouse_move_event& e); void tests_pre_update(); void tests_post_update(); - void draw_tests_pane(float main_menu_height); + void draw_tests_pane(); void draw_tests_overlay(); void tests_reset_mode(); tests_data& tests(); diff --git a/editor/imgui-editors.cpp b/editor/imgui-editors.cpp index 5bcc8ca0..a06da28e 100644 --- a/editor/imgui-editors.cpp +++ b/editor/imgui-editors.cpp @@ -32,8 +32,8 @@ StringView scenery_name(StringView name, const scenery_editor::scenery_&) return name; } -template<typename T> struct do_group_column : std::bool_constant<false> {}; -template<> struct do_group_column<scenery_editor> : std::bool_constant<true> {}; +template<typename T> constexpr inline bool do_group_column = false; +template<> constexpr inline bool do_group_column<scenery_editor> = true; StringView scenery_type_to_string(const vobj_editor::vobj_& vobj) { @@ -59,7 +59,7 @@ static void impl_draw_editor_scenery_pane(T& ed, Vector2 dpi) const auto& style = ImGui::GetStyle(); constexpr ImGuiTableFlags flags = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_ScrollY; - constexpr int ncolumns = do_group_column<T>::value ? 4 : 2; + constexpr int ncolumns = do_group_column<T> ? 4 : 2; const auto size = ImGui::GetWindowSize(); auto b2 = imgui::begin_table("scenery-table", ncolumns, flags, size); const auto row_height = ImGui::GetCurrentContext()->FontSize + 10*dpi[1]; @@ -69,7 +69,7 @@ static void impl_draw_editor_scenery_pane(T& ed, Vector2 dpi) constexpr auto colflags = colflags_ | ImGuiTableColumnFlags_WidthFixed; ImGui::TableSetupColumn("##thumbnail", colflags, thumbnail_width); ImGui::TableSetupColumn("Name", colflags_ | ImGuiTableColumnFlags_WidthStretch); - if constexpr(do_group_column<T>::value) + if constexpr(do_group_column<T>) { const auto colwidth_type = ImGui::CalcTextSize("generic").x; const auto colwidth_group = ImGui::CalcTextSize("MMMMMMMMMMMMMMM").x; @@ -113,12 +113,12 @@ static void impl_draw_editor_scenery_pane(T& ed, Vector2 dpi) ed.select_tile(scenery); click_event(); } - if (do_group_column<T>::value && ImGui::TableSetColumnIndex(2)) + if (do_group_column<T> && ImGui::TableSetColumnIndex(2)) { text(scenery_type_to_string(scenery)); click_event(); } - if (do_group_column<T>::value && ImGui::TableSetColumnIndex(3)) + if (do_group_column<T> && ImGui::TableSetColumnIndex(3)) { auto& atlas = *get_atlas(scenery); StringView name = loader.strip_prefix(atlas.name()); @@ -150,7 +150,6 @@ void app::draw_editor_pane(float main_menu_height) auto* ed = _editor.current_tile_editor(); auto* sc = _editor.current_scenery_editor(); auto* vo = _editor.current_vobj_editor(); - fm_assert(!ed || !sc || !vo); const auto window_size = M->window_size(); const auto dpi = M->dpi_scale(); @@ -191,6 +190,8 @@ void app::draw_editor_pane(float main_menu_height) draw_editor_scenery_pane(*sc); else if (vo) draw_editor_vobj_pane(*vo); + else if (_editor.mode() == editor_mode::tests) + draw_tests_pane(); } } } diff --git a/editor/imgui.cpp b/editor/imgui.cpp index b2623800..6eaccd4c 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -122,17 +122,14 @@ void app::draw_ui() draw_lightmap_test(main_menu_height); - if (_editor.current_tile_editor() || _editor.current_scenery_editor() || _editor.current_vobj_editor()) + if (_editor.current_tile_editor() || _editor.current_scenery_editor() || + _editor.current_vobj_editor() || _editor.mode() == editor_mode::tests) draw_editor_pane(main_menu_height); - else if (_editor.mode() == editor_mode::tests) - draw_tests_pane(main_menu_height); draw_fps(); draw_tile_under_cursor(); if (_editor.mode() == editor_mode::none) draw_inspector(); - if (_editor.mode() == editor_mode::tests) - draw_tests_pane(main_menu_height); draw_z_level(); do_popup_menu(); ImGui::EndFrame(); diff --git a/editor/tests.cpp b/editor/tests.cpp index 0e4bf6d3..04489ddc 100644 --- a/editor/tests.cpp +++ b/editor/tests.cpp @@ -79,7 +79,7 @@ void app::tests_reset_mode() tests() = std::monostate{}; } -void app::draw_tests_pane(float main_menu_height) +void app::draw_tests_pane() { } |