diff options
author | rtk0c <[email protected]> | 2022-06-09 23:20:33 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-09 23:20:33 -0700 |
commit | ab81521707d6ffa3f5d01ad315c0070b54bf468a (patch) | |
tree | e9d19a27a9266962b87ae73576bfa5232ed705b6 /source/30-game/EditorUtils.hpp | |
parent | 3acd929a28c268a52f7799ea3db1ad4a01790fec (diff) | |
parent | e3e848ac4da1c2ae59d93e62da8ef6f87b3452cd (diff) |
Changeset: 68
Diffstat (limited to 'source/30-game/EditorUtils.hpp')
-rw-r--r-- | source/30-game/EditorUtils.hpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/30-game/EditorUtils.hpp b/source/30-game/EditorUtils.hpp index 99c522b..8a9ab95 100644 --- a/source/30-game/EditorUtils.hpp +++ b/source/30-game/EditorUtils.hpp @@ -1,7 +1,11 @@ #pragma once -#include "Color.hpp" +#include "EditorCore.hpp" #include "EditorGuizmo.hpp" +#include "Ires.hpp" + +#include <Color.hpp> +#include <Metadata.hpp> #include <imgui.h> #include <string> @@ -60,4 +64,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 <class T> +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(Metadata::EnumToString(kind).data())) { + return *static_cast<T* const*>(payload->Data); + } + ImGui::EndDragDropTarget(); + } + return nullptr; +} + } // namespace Utils |