diff options
-rw-r--r-- | editor/imgui.cpp | 14 | ||||
-rw-r--r-- | src/chunk.inl | 15 |
2 files changed, 25 insertions, 4 deletions
diff --git a/editor/imgui.cpp b/editor/imgui.cpp index b8173eb3..fd45ce27 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -3,6 +3,7 @@ #include "compat/format.hpp" #include "imgui-raii.hpp" #include "src/world.hpp" +#include "src/anim-atlas.hpp" #include <Corrade/Containers/Optional.h> #include <Magnum/Math/Color.h> @@ -236,10 +237,17 @@ void app::do_popup_menu() //if (_popup_target.target != popup_target_type::scenery) {...} auto [c, t] = w[{ch, pos}]; auto sc = t.scenery(); - const bool b_act = sc.can_activate(), b_ins = sc && !check_inspector_exists(_popup_target); - if (ImGui::MenuItem("Activate", nullptr, false, b_act)) + + if (ImGui::MenuItem("Activate", nullptr, false, sc.can_activate())) sc.activate(); - if (ImGui::MenuItem("Inspect", nullptr, false, b_ins)) + if (auto next_rot = sc.atlas->next_rotation_from(sc.frame.r); + ImGui::MenuItem("Rotate", nullptr, false, next_rot != sc.frame.r)) + sc.rotate(next_rot); + + ImGui::Separator(); + + if (bool b_ins = sc && !check_inspector_exists(_popup_target); + ImGui::MenuItem("Inspect", nullptr, false, b_ins)) inspectors.push_back(std::exchange(_popup_target, {})); } } diff --git a/src/chunk.inl b/src/chunk.inl index 5abc1e12..bdb4f8ae 100644 --- a/src/chunk.inl +++ b/src/chunk.inl @@ -8,7 +8,20 @@ template<typename F> void chunk::with_scenery_bbox_update(std::size_t i, F&& fun static_assert(std::is_invocable_v<F>); static_assert(std::is_convertible_v<decltype(fun()), bool> || std::is_same_v<void, decltype(fun())>); if (is_passability_modified()) - fun(); + { + auto& s = scenery_at(i); + auto r0 = s.r; + bool modified = true; + if constexpr(!std::is_same_v<void, std::decay_t<decltype(fun())>>) + modified = fun(); + else + fun(); + if (r0 != s.r) + { + fm_debug_assert(modified); + mark_scenery_modified(); + } + } else { bbox x0, x; |