From bc88333a591e3714b35af841a422f6617962a807 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 29 Apr 2026 01:50:39 -0500 Subject: [PATCH] [studio/modlib] Update ImGui drag/drop, other cleanup --- .../modlib/include/studio/imguiutil.hpp | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/olympic/studio/modlib/include/studio/imguiutil.hpp b/src/olympic/studio/modlib/include/studio/imguiutil.hpp index 533da230..262e7998 100644 --- a/src/olympic/studio/modlib/include/studio/imguiutil.hpp +++ b/src/olympic/studio/modlib/include/studio/imguiutil.hpp @@ -9,11 +9,20 @@ #include #include +#include +#include +#include -#include -#include #include +namespace turbine { +class Context; +} + +namespace studio { +struct Context; +} + namespace studio::ig { inline constexpr auto BtnSz = ImVec2{52, 22}; @@ -31,18 +40,18 @@ ox::Result getDragDropPayload(ox::CStringViewCR name) noexcept { return ox::Error(1, "No drag/drop payload"); } return ox::readClaw({ - std::launder(reinterpret_cast(payload->Data)), + static_cast(payload->Data), static_cast(payload->DataSize)}); } template ox::Result getDragDropPayload() noexcept { - auto const payload = ImGui::AcceptDragDropPayload(ox::ModelTypeName_v); + auto const payload = ImGui::AcceptDragDropPayload(ox::ModelTypeName_v.c_str()); if (!payload) { return ox::Error(1, "No drag/drop payload"); } return ox::readClaw({ - reinterpret_cast(payload->Data), + static_cast(payload->Data), static_cast(payload->DataSize)}); } @@ -55,7 +64,7 @@ ox::Error setDragDropPayload(ox::CStringViewCR name, auto const &obj) noexcept { template ox::Error setDragDropPayload(T const &obj) noexcept { OX_REQUIRE(buff, ox::writeClaw(obj, ox::ClawFormat::Metal)); - ImGui::SetDragDropPayload(ox::ModelTypeName_v, buff.data(), buff.size()); + ImGui::SetDragDropPayload(ox::ModelTypeName_v.c_str(), buff.data(), buff.size()); return {}; } @@ -64,8 +73,8 @@ class DragDropSource { private: bool const m_active{}; public: - DragDropSource(ImGuiDragDropFlags const flags = 0) noexcept: - m_active(ImGui::BeginDragDropSource(flags)) { + explicit DragDropSource(ImGuiDragDropFlags const flags = 0) noexcept: + m_active{ImGui::BeginDragDropSource(flags)} { } ~DragDropSource() noexcept { if (m_active) {