mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +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();
|
||||
|
||||
Reference in New Issue
Block a user