mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Show ResourceID instead of nothing in component UI panel.
This commit is contained in:
@@ -67,6 +67,8 @@ int main()
|
||||
{
|
||||
gizmoDrawer.DrawGizmos(currentScene);
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
sceneFramebuffer->Unbind();
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <src/Scene/Entities/ImGuiHelper.h>
|
||||
#include <src/Scene/Components/MeshComponent.h>
|
||||
|
||||
#include <src/Resource/ResourceLoader.h>
|
||||
|
||||
class MeshPanel : ComponentPanel {
|
||||
|
||||
public:
|
||||
@@ -19,18 +21,19 @@ public:
|
||||
ImGui::Text("Mesh");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
std::string path = component.ModelPath;
|
||||
ImGui::Button(component.ModelPath.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||
std::string label = std::to_string(component.ModelResource->ID);
|
||||
ImGui::Button(label.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||
|
||||
if (ImGui::BeginDragDropTarget())
|
||||
{
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Model"))
|
||||
{
|
||||
char* file = (char*)payload->Data;
|
||||
std::string fullPath = std::string(file, 256);
|
||||
path = Nuake::FileSystem::AbsoluteToRelative(fullPath);
|
||||
|
||||
component.ModelPath = path;
|
||||
component.LoadModel();
|
||||
fullPath = Nuake::FileSystem::AbsoluteToRelative(fullPath);
|
||||
|
||||
//component.ModelPath = path;
|
||||
//component.LoadModel();
|
||||
}
|
||||
ImGui::EndDragDropTarget();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "WelcomeWindow.h"
|
||||
#include "src/Rendering/SceneRenderer.h"
|
||||
#include <dependencies/glfw/include/GLFW/glfw3.h>
|
||||
#include <src/Rendering/Buffers/Framebuffer.h>
|
||||
|
||||
namespace Nuake {
|
||||
Ref<UI::UserInterface> userInterface;
|
||||
@@ -54,6 +55,8 @@ namespace Nuake {
|
||||
{
|
||||
filesystem = new FileSystemUI(this);
|
||||
_WelcomeWindow = new WelcomeWindow(this);
|
||||
|
||||
m_EntitySelectionFramebuffer = CreateRef<FrameBuffer>(false, Vector2(1280, 720));
|
||||
}
|
||||
|
||||
void EditorInterface::Init()
|
||||
@@ -1078,19 +1081,8 @@ namespace Nuake {
|
||||
Engine::LoadScene(scene);
|
||||
}
|
||||
|
||||
Ref<Scene> SceneSnapshot;
|
||||
void EditorInterface::Draw()
|
||||
void EditorInterface::DrawMenuBar()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (!Engine::GetProject())
|
||||
{
|
||||
_WelcomeWindow->Draw();
|
||||
return;
|
||||
}
|
||||
|
||||
pInterface.m_CurrentProject = Engine::GetProject();
|
||||
|
||||
if (ImGui::BeginMainMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("File"))
|
||||
@@ -1122,7 +1114,7 @@ namespace Nuake {
|
||||
Selection = EditorSelection();
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (ImGui::MenuItem("Set current scene as default"))
|
||||
if (ImGui::MenuItem("Set current scene as default"))
|
||||
{
|
||||
Engine::GetProject()->DefaultScene = Engine::GetCurrentScene();
|
||||
}
|
||||
@@ -1180,16 +1172,16 @@ namespace Nuake {
|
||||
{
|
||||
if (ImGui::BeginMenu("Create new"))
|
||||
{
|
||||
if (ImGui::MenuItem("Empty"))
|
||||
if (ImGui::MenuItem("Empty"))
|
||||
{
|
||||
auto ent = Engine::GetCurrentScene()->CreateEntity("Empty entity");
|
||||
}
|
||||
if (ImGui::MenuItem("Light"))
|
||||
if (ImGui::MenuItem("Light"))
|
||||
{
|
||||
auto ent = Engine::GetCurrentScene()->CreateEntity("Light");
|
||||
ent.AddComponent<LightComponent>();
|
||||
}
|
||||
if (ImGui::MenuItem("Camera"))
|
||||
if (ImGui::MenuItem("Camera"))
|
||||
{
|
||||
auto ent = Engine::GetCurrentScene()->CreateEntity("Camera");
|
||||
ent.AddComponent<CameraComponent>();
|
||||
@@ -1204,7 +1196,7 @@ namespace Nuake {
|
||||
auto ent = Engine::GetCurrentScene()->CreateEntity("Trenchbroom map");
|
||||
ent.AddComponent<QuakeMapComponent>();
|
||||
}
|
||||
if (ImGui::MenuItem("Mesh"))
|
||||
if (ImGui::MenuItem("Mesh"))
|
||||
{
|
||||
auto ent = Engine::GetCurrentScene()->CreateEntity("Mesh");
|
||||
ent.AddComponent<MeshComponent>();
|
||||
@@ -1230,6 +1222,22 @@ namespace Nuake {
|
||||
if (ImGui::BeginMenu("Quit")) ImGui::EndMenu();
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Scene> SceneSnapshot;
|
||||
void EditorInterface::Draw()
|
||||
{
|
||||
Init();
|
||||
|
||||
if (!Engine::GetProject())
|
||||
{
|
||||
_WelcomeWindow->Draw();
|
||||
return;
|
||||
}
|
||||
|
||||
pInterface.m_CurrentProject = Engine::GetProject();
|
||||
|
||||
DrawMenuBar();
|
||||
|
||||
pInterface.DrawEntitySettings();
|
||||
DrawViewport();
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Nuake {
|
||||
ImGuizmo::MODE CurrentMode = ImGuizmo::WORLD;
|
||||
Ref<Material> m_SelectedMaterial;
|
||||
Ref<Directory> m_CurrentDirectory;
|
||||
Ref<FrameBuffer> m_EntitySelectionFramebuffer;
|
||||
|
||||
bool m_IsMaterialSelected = false;
|
||||
public:
|
||||
@@ -35,6 +36,7 @@ namespace Nuake {
|
||||
void BuildFonts();
|
||||
void Init();
|
||||
void Draw();
|
||||
void DrawMenuBar();
|
||||
void DrawViewport();
|
||||
void DrawEntityTree(Entity ent);
|
||||
void DrawSceneTree();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Nuake {
|
||||
mGBuffer->SetTexture(CreateRef<Texture>(Vector2(1920, 1080), GL_RGB), GL_COLOR_ATTACHMENT1);
|
||||
mGBuffer->SetTexture(CreateRef<Texture>(Vector2(1920, 1080), GL_RGB), GL_COLOR_ATTACHMENT2);
|
||||
mGBuffer->SetTexture(CreateRef<Texture>(Vector2(1920, 1080), GL_RGB), GL_COLOR_ATTACHMENT3);
|
||||
|
||||
|
||||
mShadingBuffer = CreateScope<FrameBuffer>(true, Vector2(1920, 1080));
|
||||
Ref<Texture> shadedTexture = CreateRef<Texture>(Vector2(1920, 1080), GL_RGB, GL_RGB16F, GL_FLOAT);
|
||||
mShadingBuffer->SetTexture(shadedTexture);
|
||||
@@ -27,7 +27,6 @@ namespace Nuake {
|
||||
|
||||
mToneMapBuffer = CreateScope<FrameBuffer>(false, Vector2(1920, 1080));
|
||||
mToneMapBuffer->SetTexture(CreateRef<Texture>(Vector2(1920, 1080), GL_RGB), GL_COLOR_ATTACHMENT0);
|
||||
|
||||
}
|
||||
|
||||
void SceneRenderer::Cleanup()
|
||||
|
||||
@@ -18,8 +18,7 @@ namespace Nuake
|
||||
ResourceLoader() = default;
|
||||
~ResourceLoader() = default;
|
||||
|
||||
|
||||
static Ref<Material> LoadResource(const std::string& path)
|
||||
static Ref<Material> LoadMaterial(const std::string& path)
|
||||
{
|
||||
const std::string FILE_NOT_FOUND = "[Resource Loader] File doesn't exists. \n ";
|
||||
const std::string WRONG_EXTENSION = "[Resource Loader] Resource type mismatch file extension. \n expected: ";
|
||||
@@ -55,7 +54,6 @@ namespace Nuake
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
private:
|
||||
static UUID ReadUUID(json j)
|
||||
{
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace Nuake
|
||||
bool Deserialize(const std::string str)
|
||||
{
|
||||
BEGIN_DESERIALIZE();
|
||||
ModelPath = j["ModelPath"];
|
||||
ModelPath = j["ModelPath"].dump();
|
||||
ModelResource = CreateRef<Model>();
|
||||
|
||||
if (j.contains("ModelResource"))
|
||||
{
|
||||
auto res = j["ModelResource"];
|
||||
auto& res = j["ModelResource"];
|
||||
ModelResource->Deserialize(res.dump());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user