mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Merge branch 'main' into NK-48-Dynamic-physics-gizmo
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <src/Rendering/Textures/Material.h>
|
||||
#include <src/Resource/ResourceLoader.h>
|
||||
#include <src/Resource/FontAwesome5.h>
|
||||
#include <src/Scripting/WrenScript.h>
|
||||
#include <Engine.h>
|
||||
|
||||
EditorSelectionPanel::EditorSelectionPanel()
|
||||
@@ -60,7 +61,7 @@ void EditorSelectionPanel::Draw(EditorSelection selection)
|
||||
ResolveFile(selection.File);
|
||||
}
|
||||
|
||||
DrawFile(selection.File.get());
|
||||
DrawFile(selection.File);
|
||||
break;
|
||||
}
|
||||
case EditorSelectionType::Resource:
|
||||
@@ -142,7 +143,7 @@ void EditorSelectionPanel::DrawAddComponentMenu(Nuake::Entity entity)
|
||||
|
||||
}
|
||||
|
||||
void EditorSelectionPanel::DrawFile(Nuake::File* file)
|
||||
void EditorSelectionPanel::DrawFile(Ref<Nuake::File> file)
|
||||
{
|
||||
using namespace Nuake;
|
||||
if (file->GetExtension() == ".material")
|
||||
@@ -153,6 +154,10 @@ void EditorSelectionPanel::DrawFile(Nuake::File* file)
|
||||
{
|
||||
DrawProjectPanel(Nuake::Engine::GetProject());
|
||||
}
|
||||
if (file->GetExtension() == ".wren")
|
||||
{
|
||||
DrawWrenScriptPanel(CreateRef<WrenScript>(file, true));
|
||||
}
|
||||
}
|
||||
|
||||
void EditorSelectionPanel::DrawResource(Nuake::Resource resource)
|
||||
@@ -417,3 +422,16 @@ void EditorSelectionPanel::DrawProjectPanel(Ref<Nuake::Project> project)
|
||||
ImGui::InputText("Trenchbroom Path", &project->TrenchbroomPath);
|
||||
}
|
||||
|
||||
void EditorSelectionPanel::DrawWrenScriptPanel(Ref<Nuake::WrenScript> wrenFile)
|
||||
{
|
||||
auto filePath = wrenFile->GetFile()->GetAbsolutePath();
|
||||
std::string fileContent = Nuake::FileSystem::ReadFile(filePath, true);
|
||||
|
||||
ImGui::Text("Content");
|
||||
ImGui::Separator();
|
||||
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetWindowWidth());
|
||||
ImGui::Text(fileContent.c_str(), ImGui::GetWindowWidth());
|
||||
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user