diff options
Diffstat (limited to 'source/30-game/EditorCorePrivate.cpp')
-rw-r--r-- | source/30-game/EditorCorePrivate.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/source/30-game/EditorCorePrivate.cpp b/source/30-game/EditorCorePrivate.cpp index 9fd6087..43857a8 100644 --- a/source/30-game/EditorCorePrivate.cpp +++ b/source/30-game/EditorCorePrivate.cpp @@ -8,13 +8,15 @@ #include "EditorNotification.hpp" #include "EditorUtils.hpp" #include "GameObject.hpp" -#include "Macros.hpp" #include "Mesh.hpp" #include "Player.hpp" #include "SceneThings.hpp" -#include "ScopeGuard.hpp" #include "VertexIndex.hpp" -#include "YCombinator.hpp" + +#include <Macros.hpp> +#include <Metadata.hpp> +#include <ScopeGuard.hpp> +#include <YCombinator.hpp> #define GLFW_INCLUDE_NONE #include <GLFW/glfw3.h> @@ -146,9 +148,9 @@ void EditorContentBrowser::Show(bool* open) { ImGui::OpenPopup("New Ires"); } if (ImGui::BeginPopup("New Ires")) { - for (int i = 0; i < IresObject::KD_COUNT; ++i) { + for (int i = 0; i < (int)IresObject::KD_COUNT; ++i) { auto kind = static_cast<IresObject::Kind>(i); - if (ImGui::MenuItem(IresObject::ToString(kind).data())) { + if (ImGui::MenuItem(Metadata::EnumToString(kind).data())) { auto ires = IresObject::Create(kind); auto [DISCARD, success] = IresManager::instance->Add(ires.get()); if (success) { @@ -228,7 +230,7 @@ void EditorContentBrowser::Show(bool* open) { } if (!mInspector->renaming) { if (ImGui::BeginDragDropSource()) { - auto kindName = IresObject::ToString(ires->GetKind()); + auto kindName = Metadata::EnumToString(ires->GetKind()); // Reason: intentionally using pointer as payload ImGui::SetDragDropPayload(kindName.data(), &ires, sizeof(ires)); // NOLINT(bugprone-sizeof-expression) ImGui::Text("%s '%s'", kindName.data(), name.c_str()); @@ -249,6 +251,11 @@ void EditorContentBrowser::Show(bool* open) { mInspector->renamingScratchBuffer = ldObj.name; } + if (ImGui::Button("Save", !isIttLevel)) { + auto ldObj = static_cast<LevelManager::LoadableObject*>(origItPtr); + LevelManager::instance->SaveLevel(ldObj->level->GetUid()); + } + auto& objects = LevelManager::instance->mObjByUid; for (auto it = objects.begin(); it != objects.end(); ++it) { auto& uid = it->first; @@ -779,7 +786,9 @@ void EditorInstance::ShowInspector(LevelManager::LoadableObject* ldObj) { ImGui::InputText("Name", &ldObj->name); ImGui::InputTextMultiline("Desciption", &ldObj->description); - // TODO level object explorer + if (ImGui::CollapsingHeader("Instanciation Entries")) { + ldObj->level->ShowInstanciationEntries(*this); + } } void EditorInstance::ShowInspector(GameObject* object) { @@ -915,7 +924,7 @@ void EditorInstance::ShowInspector(GameObject* object) { ImGui::SameLine(); IresObject::ShowReferenceSafe(*this, ea->confSprite.Get()); if (ImGui::BeginDragDropTarget()) { - if (auto payload = ImGui::AcceptDragDropPayload(IresObject::ToString(IresObject::KD_Spritesheet).data())) { + if (auto payload = ImGui::AcceptDragDropPayload(Metadata::EnumToString(IresObject::KD_Spritesheet).data())) { auto spritesheet = *static_cast<IresSpritesheet* const*>(payload->Data); ea->confSprite.Attach(spritesheet); auto def = spritesheet->GetInstance(); @@ -929,7 +938,7 @@ void EditorInstance::ShowInspector(GameObject* object) { ImGui::SameLine(); IresObject::ShowReferenceSafe(*this, ea->confMaterial.Get()); if (ImGui::BeginDragDropTarget()) { - if (auto payload = ImGui::AcceptDragDropPayload(IresObject::ToString(IresObject::KD_Material).data())) { + if (auto payload = ImGui::AcceptDragDropPayload(Metadata::EnumToString(IresObject::KD_Material).data())) { auto material = *static_cast<IresMaterial* const*>(payload->Data); ea->confMaterial.Attach(material); player->SetMaterial(material->GetInstance()); |