diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 16:21:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 16:21:13 +0100 |
commit | 8b5ad57aefe1d4bdee5334b194f63168fbe8581e (patch) | |
tree | 30915d6642256c1dc4d8261f5c4cc7ffb351d205 /editor | |
parent | e2df578979a8796a41db92aba12dbe47b32bb8f5 (diff) |
wip
Diffstat (limited to 'editor')
-rw-r--r-- | editor/draw.cpp | 10 | ||||
-rw-r--r-- | editor/imgui.cpp | 19 |
2 files changed, 18 insertions, 11 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp index 329603e0..f1a0616c 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -17,7 +17,6 @@ void app::draw_cursor() { constexpr float LINE_WIDTH = 2; auto& shader = M->shader(); - shader.set_tint({1, 0, 0, 1}); const auto inactive_color = 0xff00ffff_rgbaf; if (cursor.tile && !cursor.in_imgui) @@ -27,7 +26,9 @@ void app::draw_cursor() mesh.draw(shader, {center, size, LINE_WIDTH}); }; - if (const auto* ed = _editor.current_tile_editor(); ed) + shader.set_tint({1, 0, 0, 1}); + + if (const auto* ed = _editor.current_tile_editor()) { if (!ed->is_anything_selected()) shader.set_tint(inactive_color); @@ -40,7 +41,7 @@ void app::draw_cursor() else if (ed->mode() == editor_mode::floor) draw(_wireframe_quad, TILE_SIZE2); } - else if (const auto* ed = _editor.current_scenery_editor(); ed) + else if (const auto* ed = _editor.current_scenery_editor()) { if (!ed->is_anything_selected()) shader.set_tint(inactive_color); @@ -54,8 +55,9 @@ void app::draw_cursor() anim_mesh.draw(shader, *sel.atlas, sel.frame.r, sel.frame.frame, Vector3(pos), 1); } } + + shader.set_tint({1, 1, 1, 1}); } - shader.set_tint({1, 1, 1, 1}); } void app::draw_collision_boxes() diff --git a/editor/imgui.cpp b/editor/imgui.cpp index fd45ce27..78248be3 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -211,6 +211,8 @@ void app::do_open_popup() bool app::check_inspector_exists(popup_target p) { + if (p.target == popup_target_type::none) [[unlikely]] + return true; for (const auto& p2 : inspectors) if (p2 == p) return true; @@ -224,20 +226,22 @@ void app::do_popup_menu() auto b0 = push_id(SCENERY_POPUP_NAME); + const auto [ch, pos, type] = _popup_target; + auto [c, t] = w[{ch, pos}]; + //if (_popup_target.target != popup_target_type::scenery) {...} + auto sc = t.scenery(); + if (_pending_popup) { _pending_popup = false; - fm_assert(_popup_target.target != popup_target_type::none); - ImGui::OpenPopup(SCENERY_POPUP_NAME.data(), ImGuiPopupFlags_NoOpenOverItems); + fm_assert(type != popup_target_type::none); + //if (type != popup_target_type::scenery) {...} + if (sc) + ImGui::OpenPopup(SCENERY_POPUP_NAME.data(), ImGuiPopupFlags_NoOpenOverItems); } if (auto b1 = begin_popup(SCENERY_POPUP_NAME)) { - auto [ch, pos, target] = _popup_target; - //if (_popup_target.target != popup_target_type::scenery) {...} - auto [c, t] = w[{ch, pos}]; - auto sc = t.scenery(); - if (ImGui::MenuItem("Activate", nullptr, false, sc.can_activate())) sc.activate(); if (auto next_rot = sc.atlas->next_rotation_from(sc.frame.r); @@ -255,6 +259,7 @@ void app::do_popup_menu() void app::kill_popups(bool hard) { _popup_target = { .target = popup_target_type::none }; + ImGui::CloseCurrentPopup(); if (hard) { |