Added Trenchbroom configurator window and some UI fixes

This commit is contained in:
Antoine Pilote
2023-10-02 01:37:22 -04:00
parent 41a81e5279
commit 4622be08e9
7 changed files with 271 additions and 14 deletions

View File

@@ -38,7 +38,10 @@ void ScriptPanel::Draw(Nuake::Entity entity)
{
if(!component.Script.empty())
{
Nuake::OS::OpenIn(component.mWrenScript->GetFile()->GetAbsolutePath());
if (component.mWrenScript)
{
Nuake::OS::OpenIn(component.mWrenScript->GetFile()->GetAbsolutePath());
}
}
else
{

View File

@@ -1497,7 +1497,9 @@ namespace Nuake {
ImVec4 color = ImVec4(1, 1, 1, 1.0);
ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImGui::GetColorU32(ImVec4(1, 1, 1, 0.0)), -1);
ImGui::TextWrapped(l.message.c_str());
std::string displayMessage = l.message + "(" + std::to_string(l.count) + ")";
ImGui::TextWrapped(displayMessage.c_str());
ImGui::PopStyleColor();
ImGui::TableNextColumn();
@@ -1740,14 +1742,26 @@ namespace Nuake {
if (ImGui::MenuItem("Cut", "CTRL+X")) {}
if (ImGui::MenuItem("Copy", "CTRL+C")) {}
if (ImGui::MenuItem("Paste", "CTRL+V")) {}
ImGui::Separator();
if(ImGui::MenuItem("Trenchbroom Configurator", NULL, m_ShowTrenchbroomConfigurator))
{
m_ShowTrenchbroomConfigurator = !m_ShowTrenchbroomConfigurator;
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("View"))
{
if (ImGui::MenuItem("Draw grid", NULL, m_DrawGrid))
{
m_DrawGrid = !m_DrawGrid;
}
if (ImGui::MenuItem("Draw Axis", NULL, m_DrawAxis))
{
m_DrawAxis = !m_DrawAxis;
}
if (ImGui::MenuItem("Draw collisions", NULL, m_DebugCollisions))
{
m_DebugCollisions = !m_DebugCollisions;
@@ -1886,6 +1900,11 @@ namespace Nuake {
_audioWindow->Draw();
if (m_ShowTrenchbroomConfigurator)
{
m_TrenchhbroomConfigurator.Draw();
}
DrawMenuBar();
pInterface.DrawEntitySettings();

View File

@@ -9,6 +9,7 @@
#include "EditorSelectionPanel.h"
#include "WelcomeWindow.h"
#include "AudioWindow.h"
#include "../../TrenchbroomConfiguratorWindow.h"
namespace Nuake
{
@@ -27,6 +28,7 @@ namespace Nuake
bool m_ShowOverlay = true;
bool m_IsHoveringViewport = false;
bool m_IsViewportFocused = false;
bool m_ShowTrenchbroomConfigurator = false;
Vector2 m_ViewportPos = {0, 0};
Vector2 m_ViewportSize = {};
@@ -43,6 +45,7 @@ namespace Nuake
FileSystemUI* filesystem;
EditorSelection Selection;
EditorSelectionPanel SelectionPanel;
TrenchbroomConfiguratorWindow m_TrenchhbroomConfigurator;
EditorInterface();

View File

@@ -10,6 +10,7 @@
#include <src/Scripting/WrenScript.h>
#include <Engine.h>
#include <src/Resource/Prefab.h>
EditorSelectionPanel::EditorSelectionPanel()
{
@@ -59,7 +60,7 @@ void EditorSelectionPanel::Draw(EditorSelection selection)
if (!selection.File->IsValid())
{
std::string text = "File is invaluid";
std::string text = "File is invalid";
auto windowWidth = ImGui::GetWindowSize().x;
auto windowHeight = ImGui::GetWindowSize().y;
@@ -175,18 +176,30 @@ void EditorSelectionPanel::DrawAddComponentMenu(Nuake::Entity entity)
void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
{
using namespace Nuake;
if (file->GetExtension() == ".material")
{
MaterialEditor matEditor;
matEditor.Draw(std::static_pointer_cast<Material>(selectedResource));
}
if (file->GetExtension() == ".project")
{
DrawProjectPanel(Nuake::Engine::GetProject());
}
if (file->GetExtension() == ".wren")
switch (file->GetFileType())
{
DrawWrenScriptPanel(CreateRef<WrenScript>(file, true));
case FileType::Material:
{
MaterialEditor matEditor;
matEditor.Draw(std::static_pointer_cast<Material>(selectedResource));
break;
}
case FileType::Project:
{
DrawProjectPanel(Nuake::Engine::GetProject());
break;
}
case FileType::Script:
{
DrawWrenScriptPanel(CreateRef<WrenScript>(file, true));
break;
}
case FileType::Prefab:
{
//Ref<Prefab> prefab = CreateRef<Prefab>(file->GetRelativePath());
//DrawPrefabPanel(prefab);
break;
}
}
}