Fixed math problem and display submeshes in editor panel

This commit is contained in:
a.pilote
2022-07-16 21:49:17 -04:00
parent 7d9e5b07b5
commit dbec248d8a
8 changed files with 78 additions and 20 deletions

View File

@@ -1,5 +1,8 @@
#pragma once
#include <src/Core/Core.h>
#include "ComponentPanel.h"
#include "ModelResourceInspector.h"
#include <src/Scene/Entities/ImGuiHelper.h>
#include <src/Scene/Components/MeshComponent.h>
@@ -7,9 +10,14 @@
#include <src/Core/String.h>
class MeshPanel : ComponentPanel {
private:
Scope<ModelResourceInspector> _modelInspector;
bool _expanded = false;
public:
MeshPanel() {}
MeshPanel()
{
CreateScope<ModelResourceInspector>();
}
void Draw(Nuake::Entity entity) override
{
@@ -23,7 +31,20 @@ public:
ImGui::TableNextColumn();
std::string label = std::to_string(component.ModelResource->ID);
ImGui::Button(label.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
if (ImGui::Button(label.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0)))
{
if (!_expanded)
{
_modelInspector = CreateScope<ModelResourceInspector>(component.ModelResource);
}
_expanded = !_expanded;
}
if (_expanded)
{
_modelInspector->Draw();
}
if (ImGui::BeginDragDropTarget())
{