From e3e848ac4da1c2ae59d93e62da8ef6f87b3452cd Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 23 May 2022 22:36:46 -0700 Subject: Changeset: 37 Branch comment: [] Add infrastructure for rendering wireframe (rendering broken) including saving and loading config files --- source/EditorUtils.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/EditorUtils.hpp') diff --git a/source/EditorUtils.hpp b/source/EditorUtils.hpp index 99c522b..4fd4811 100644 --- a/source/EditorUtils.hpp +++ b/source/EditorUtils.hpp @@ -1,7 +1,9 @@ #pragma once #include "Color.hpp" +#include "EditorCore.hpp" #include "EditorGuizmo.hpp" +#include "Ires.hpp" #include #include @@ -60,4 +62,21 @@ float CalcImageHeight(glm::vec2 original, int targetWidth); float CalcImageWidth(glm::vec2 original, float targetHeight); ImVec2 FitImage(glm::vec2 original); +// TODO get kind from T +template +T* SimpleIresReceptor(T* existing, IEditor& editor, IresObject::Kind kind) { + if (existing) { + existing->ShowReference(editor); + } else { + IresObject::ShowReferenceNull(editor); + } + if (ImGui::BeginDragDropTarget()) { + if (auto payload = ImGui::AcceptDragDropPayload(IresObject::ToString(kind).data())) { + return *static_cast(payload->Data); + } + ImGui::EndDragDropTarget(); + } + return nullptr; +} + } // namespace Utils -- cgit v1.2.3-70-g09d2