From 7982fe151f9153992565d2217a878794c8370c8d Mon Sep 17 00:00:00 2001 From: Antoine Pilote Date: Sun, 5 Mar 2023 21:44:23 -0500 Subject: [PATCH] Some UI changes --- Editor/src/ComponentsPanel/ComponentPanel.h | 4 ++-- .../ComponentsPanel/ModelResourceInspector.cpp | 2 +- Editor/src/ComponentsPanel/ScriptPanel.h | 18 +++++------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Editor/src/ComponentsPanel/ComponentPanel.h b/Editor/src/ComponentsPanel/ComponentPanel.h index 781c9a4c..1c716242 100644 --- a/Editor/src/ComponentsPanel/ComponentPanel.h +++ b/Editor/src/ComponentsPanel/ComponentPanel.h @@ -38,8 +38,8 @@ ImGui::PopStyleVar(); \ if (ImGui::BeginTable(#name, 3, ImGuiTableFlags_BordersInner)) \ { \ - ImGui::TableSetupColumn("name", 0, 0.3f); \ - ImGui::TableSetupColumn("set", 0, 0.6f); \ + ImGui::TableSetupColumn("name", 0, 0.25f); \ + ImGui::TableSetupColumn("set", 0, 0.65f); \ ImGui::TableSetupColumn("reset", 0, 0.1f); \ \ ImGui::TableNextColumn(); diff --git a/Editor/src/ComponentsPanel/ModelResourceInspector.cpp b/Editor/src/ComponentsPanel/ModelResourceInspector.cpp index ff5b2eb5..993fdb27 100644 --- a/Editor/src/ComponentsPanel/ModelResourceInspector.cpp +++ b/Editor/src/ComponentsPanel/ModelResourceInspector.cpp @@ -9,7 +9,7 @@ ModelResourceInspector::ModelResourceInspector(Ref model) void ModelResourceInspector::Draw() { - ImGui::BeginChild("modelInspector", ImVec2(0, 0), true); + ImGui::BeginChild("modelInspector", ImVec2(0, 100 * std::size(_model->GetMeshes())), true); { for (uint32_t i = 0; i < std::size(_model->GetMeshes()); i++) { diff --git a/Editor/src/ComponentsPanel/ScriptPanel.h b/Editor/src/ComponentsPanel/ScriptPanel.h index a68f9324..cad0f9d5 100644 --- a/Editor/src/ComponentsPanel/ScriptPanel.h +++ b/Editor/src/ComponentsPanel/ScriptPanel.h @@ -27,22 +27,16 @@ public: if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Script")) { char* file = (char*)payload->Data; - std::string fullPath = std::string(file, 256); - path = Nuake::FileSystem::AbsoluteToRelative(fullPath); - Ref nuakeFile = Nuake::FileSystem::GetFile(path); - component.mWrenScript = CreateRef(nuakeFile, true); - auto modules = component.mWrenScript->GetModules(); - if (modules.size() > 0) - component.mModule = 0; + std::string fullPath = std::string(file, 512); + path = Nuake::FileSystem::AbsoluteToRelative(std::move(fullPath)); + + component.LoadScript(path); } ImGui::EndDragDropTarget(); } component.Script = path; - - // - //ImGuiHelper::DrawVec3("Translation", &component.Translation); ImGui::TableNextColumn(); ComponentTableReset(component.Script, ""); @@ -53,9 +47,7 @@ public: ImGui::TableNextColumn(); // Here we create a dropdown for every modules - - auto wrenScript = component.mWrenScript; - + auto& wrenScript = component.mWrenScript; if (wrenScript) { auto modules = wrenScript->GetModules();