Basics of the meta Asset Management
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include <mini/ini.h>
|
||||
#include <nfd.h>
|
||||
#include <ImGuizmo.h>
|
||||
#include <memory>
|
||||
|
||||
#include "Inspector.h"
|
||||
#include "Console.h"
|
||||
@ -16,30 +17,27 @@ class EditorLayer : public Layer {
|
||||
|
||||
|
||||
public:
|
||||
EditorLayer() :
|
||||
Layer(),
|
||||
inspector(Selected),
|
||||
scene(),
|
||||
renderer()
|
||||
EditorLayer() : Layer()
|
||||
{
|
||||
|
||||
Logo.Load("rsc/Yoggie.png");
|
||||
spdlog::info("{0}", project.GetProjectDirectory().string());
|
||||
Selected = YoggieEngine::Entity((entt::entity)-1, &scene);
|
||||
Selected = YoggieEngine::Entity{ (entt::entity)-1, (scene.get()) };
|
||||
|
||||
}
|
||||
|
||||
void OnStartup() override {
|
||||
std::string path = (std::filesystem::current_path()).string();
|
||||
project.setProjectDirectory(path);
|
||||
scene = std::make_unique<Scene>();
|
||||
project = std::make_unique<Project>();
|
||||
project.get()->setProjectDirectory(path);
|
||||
LoadLastOrEmptyProject();
|
||||
//Console console = Console();
|
||||
|
||||
}
|
||||
|
||||
void OnUpdate() override {
|
||||
scene.Update();
|
||||
renderer.Render(scene, *camera);
|
||||
scene.get()->Update();
|
||||
renderer.get()->Render(*scene, *camera);
|
||||
}
|
||||
|
||||
|
||||
@ -282,7 +280,7 @@ public:
|
||||
ImGui::Begin("SceneView",nullptr,viewportWindowFlags);
|
||||
// spdlog::info("{0}x{1}", ImGui::GetWindowWidth(), ImGui::GetWindowHeight());
|
||||
SceneisFocused = ImGui::IsWindowFocused() || ImGui::IsWindowHovered();
|
||||
ImGui::Image((ImTextureID)(intptr_t)renderer.getCurrentFrameBuffer().GetColourAttachment(),
|
||||
ImGui::Image((ImTextureID)(intptr_t)renderer.get()->getCurrentFrameBuffer().GetColourAttachment(),
|
||||
ImVec2{(float)ImGui::GetWindowWidth(),(float)ImGui::GetWindowHeight()});
|
||||
|
||||
|
||||
@ -331,11 +329,11 @@ public:
|
||||
|
||||
|
||||
ImGui::Begin(ICON_MD_MENU "SceneExplorer",nullptr);
|
||||
scene.getReg().each([&](entt::entity enttNumber) {
|
||||
YoggieEngine::Entity entity = YoggieEngine::Entity(enttNumber, &scene);
|
||||
scene.get()->getReg().each([&](entt::entity enttNumber) {
|
||||
YoggieEngine::Entity entity = YoggieEngine::Entity(enttNumber, &*scene.get());
|
||||
auto id = entity.GetComponent<YoggieEngine::IdentifierComponent>();
|
||||
if (ImGui::Selectable(id.name.c_str(), entity == Selected)) {
|
||||
Selected = YoggieEngine::Entity(enttNumber, &scene);
|
||||
Selected = YoggieEngine::Entity(enttNumber, &*scene);
|
||||
|
||||
}
|
||||
});
|
||||
@ -343,7 +341,7 @@ public:
|
||||
|
||||
ImGui::End();
|
||||
|
||||
/*
|
||||
|
||||
{
|
||||
ImGui::Begin("Asset", nullptr);
|
||||
|
||||
@ -364,7 +362,7 @@ public:
|
||||
YoggieEngine::Texture folderIcon;
|
||||
YoggieEngine::Texture assetIcon;
|
||||
|
||||
assetIcon = YoggieEngine::Texture("rsc/AssetIcon.png");
|
||||
//assetIcon = YoggieEngine::Texture("rsc/AssetIcon.png");
|
||||
|
||||
|
||||
ImGui::DragInt("IconSize", &iconSize, 1, 30, 90);
|
||||
@ -389,7 +387,7 @@ public:
|
||||
ImGui::ImageButton(
|
||||
(ImTextureID)assetIcon.GetID(),
|
||||
ImVec2{ (float)iconSize, (float)iconSize });
|
||||
ImGui::Text(asset.GetName(), row);
|
||||
ImGui::Text(asset.Handle.String().c_str(), row);
|
||||
|
||||
|
||||
|
||||
@ -408,7 +406,7 @@ public:
|
||||
ImGui::End();
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
ImGui::ShowDemoWindow();
|
||||
@ -467,15 +465,15 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
Inspector inspector;
|
||||
Renderer renderer;
|
||||
std::unique_ptr<Inspector> inspector = std::make_unique<Inspector>(Selected);
|
||||
std::unique_ptr<Renderer> renderer = std::make_unique<Renderer>();
|
||||
std::unique_ptr<EditorCamera> camera = std::make_unique<EditorCamera>();
|
||||
std::unique_ptr<Project> project;
|
||||
std::unique_ptr<Scene> scene;
|
||||
|
||||
EditorCamera* camera = new EditorCamera();
|
||||
Texture Logo;
|
||||
|
||||
|
||||
Project project;
|
||||
Scene scene;
|
||||
|
||||
bool SimulatePhysics = true;
|
||||
bool SceneisFocused = false;
|
||||
|
||||
@ -483,7 +481,6 @@ private:
|
||||
ImGuizmo::OPERATION activeOperation = ImGuizmo::OPERATION::TRANSLATE;
|
||||
|
||||
char* path = nullptr;
|
||||
Texture Logo;
|
||||
|
||||
void LoadLastOrEmptyProject() {
|
||||
// Check if there is a last known loaded project and
|
||||
@ -507,7 +504,7 @@ private:
|
||||
if (ini["editor"]["openlastproject"] == "TRUE")
|
||||
{
|
||||
|
||||
Project::LoadProject(ini["cache"]["project"], project);
|
||||
Project::LoadProject(ini["cache"]["project"], *project);
|
||||
///LoadScene(ini["cache"]["scene"], scene);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user