A little bit of cleanup

This commit is contained in:
WiggleWizard
2024-09-15 23:06:06 +01:00
parent 269533eb03
commit baac971deb
10 changed files with 16 additions and 508 deletions

View File

@@ -1,20 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include "src/FileSystem/FileSystem.h"
#include <src/Core/Maths.h>
#include <src/Scene/Components/AudioEmitterComponent.h>
#include <src/Scene/Entities/ImGuiHelper.h>
class AudioEmitterPanel : ComponentPanel
{
public:
AudioEmitterPanel() = default;
~AudioEmitterPanel() = default;
void Draw(Nuake::Entity entity) override
{
}
};

View File

@@ -1,23 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include "src/FileSystem/FileSystem.h"
#include <src/Core/Maths.h>
#include <src/Scene/Components/ParticleEmitterComponent.h>
#include <src/Scene/Entities/ImGuiHelper.h>
#include "MaterialEditor.h"
#include <src/Resource/ResourceLoader.h>
#include <src/Resource/ResourceLoader.h>
class ParticleEmitterPanel : ComponentPanel
{
public:
Scope<ModelResourceInspector> _modelInspector;
ParticleEmitterPanel() {}
void Draw(Nuake::Entity entity) override
{
}
};

View File

@@ -1,79 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include <src/Scene/Components/QuakeMap.h>
#include "src/Scene/Systems/QuakeMapBuilder.h"
#include "src/FileSystem/FileSystem.h"
#include <src/AI/NavManager.h>
#include <src/UI/ImUI.h>
class QuakeMapPanel : ComponentPanel {
public:
QuakeMapPanel() {}
void Draw(Nuake::Entity entity) override
{
// using namespace Nuake;
//
// if (!entity.HasComponent<Nuake::QuakeMapComponent>())
// return;
//
// Nuake::QuakeMapComponent& component = entity.GetComponent<Nuake::QuakeMapComponent>();
// BeginComponentTable(QUAKEMAP, Nuake::QuakeMapComponent);
// {
// {
// ImGui::Text("Map");
// ImGui::TableNextColumn();
//
// std::string path = component.Path;
// ImGui::Button(component.Path.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
// if (ImGui::BeginDragDropTarget())
// {
// if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Map"))
// {
// char* file = (char*)payload->Data;
// std::string fullPath = std::string(file, 256);
// path = Nuake::FileSystem::AbsoluteToRelative(fullPath);
//
// component.Path = path;
// }
// ImGui::EndDragDropTarget();
// }
//
// ImGui::TableNextColumn();
//
// ComponentTableReset(component.Path, "");
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Collision");
// ImGui::TableNextColumn();
//
// ImGui::Checkbox("##Collison", &component.HasCollisions);
// ImGui::TableNextColumn();
// ComponentTableReset(component.HasCollisions, true);
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Auto Rebuild");
// ImGui::TableNextColumn();
//
// ImGui::Checkbox("##AutoRebuild", &component.AutoRebuild);
// ImGui::TableNextColumn();
// ComponentTableReset(component.AutoRebuild, false);
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Build");
// ImGui::TableNextColumn();
//
// if (UI::SecondaryButton("Build Geometry"))
// {
// Nuake::QuakeMapBuilder builder;
// builder.BuildQuakeMap(entity, component.HasCollisions);
// }
// }
// }
// EndComponentTable();
}
};

View File

@@ -1,62 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include <src/Scene/Components/RigidbodyComponent.h>
#include "src/FileSystem/FileSystem.h"
class RigidbodyPanel : ComponentPanel {
public:
RigidbodyPanel() {}
void Draw(Nuake::Entity entity) override
{
if (!entity.HasComponent<Nuake::RigidBodyComponent>())
return;
auto& component = entity.GetComponent<Nuake::RigidBodyComponent>();
BeginComponentTable(RIGIDBODY, Nuake::RigidBodyComponent);
{
{
ImGui::Text("Mass");
ImGui::TableNextColumn();
ImGui::DragFloat("##Mass", &component.Mass, 0.01f, 0.1f);
component.Mass = std::max(component.Mass, 0.0f);
ImGui::TableNextColumn();
ComponentTableReset(component.Mass, 0.0f);
}
ImGui::TableNextColumn();
{
ImGui::Text("Lock X axis");
ImGui::TableNextColumn();
ImGui::Checkbox("##lockx", &component.LockX);
ImGui::TableNextColumn();
ComponentTableReset(component.LockX, false);
}
ImGui::TableNextColumn();
{
ImGui::Text("Lock Y axis");
ImGui::TableNextColumn();
ImGui::Checkbox("##locky", &component.LockY);
ImGui::TableNextColumn();
ComponentTableReset(component.LockY, false);
}
ImGui::TableNextColumn();
{
ImGui::Text("Lock Z axis");
ImGui::TableNextColumn();
ImGui::Checkbox("##lockz", &component.LockZ);
ImGui::TableNextColumn();
ComponentTableReset(component.LockZ, false);
}
ImGui::TableNextColumn();
}
EndComponentTable();
}
};

View File

@@ -1,172 +0,0 @@
#pragma once
#include <src/Core/Core.h>
#include "ComponentPanel.h"
#include "ModelResourceInspector.h"
#include <src/Scene/Entities/ImGuiHelper.h>
#include <src/Scene/Components/SkinnedModelComponent.h>
#include <src/Resource/ResourceLoader.h>
#include <src/Core/String.h>
class SkinnedModelPanel : ComponentPanel
{
private:
Scope<ModelResourceInspector> m_ModelInspector;
bool m_Expanded = false;
std::string m_QueuedModelPath;
public:
SkinnedModelPanel()
{
CreateScope<ModelResourceInspector>();
}
void Draw(Nuake::Entity entity) override
{
// using namespace Nuake;
// if (!entity.HasComponent<SkinnedModelComponent>())
// return;
//
// SkinnedModelComponent& component = entity.GetComponent<SkinnedModelComponent>();
// BeginComponentTable(SKINNED MESH, SkinnedModelComponent);
// {
// ImGui::Text("Model");
// ImGui::TableNextColumn();
//
// std::string label = "None";
//
// const bool isModelNone = component.ModelResource == nullptr;
// if (!isModelNone)
// {
// label = std::to_string(component.ModelResource->ID);
// }
//
// if (ImGui::Button(label.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0)))
// {
// }
//
// if (m_Expanded)
// {
// m_ModelInspector->Draw();
// }
//
// if (ImGui::BeginDragDropTarget())
// {
// if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_Model"))
// {
// char* file = (char*)payload->Data;
// std::string fullPath = std::string(file, 256);
// fullPath = Nuake::FileSystem::AbsoluteToRelative(fullPath);
//
// if (Nuake::String::EndsWith(fullPath, ".model"))
// {
//
// }
// else
// {
// m_QueuedModelPath = fullPath;
// ImGui::OpenPopup("Create Skeleton");
// }
// }
// ImGui::EndDragDropTarget();
// }
//
// if (ImGui::BeginPopupModal("Create Skeleton", NULL, ImGuiWindowFlags_AlwaysAutoResize))
// {
// ImGui::SetItemDefaultFocus();
// ImGui::Text("Would you like to create the skeleton structure in the scene tree?");
// ImGui::Separator();
//
// if (ImGui::Button("OK", ImVec2(120, 0)))
// {
// component.ModelPath = m_QueuedModelPath;
// component.LoadModel();
//
// Scene* scene = entity.GetScene();
// scene->CreateSkeleton(entity);
//
// ImGui::CloseCurrentPopup();
// }
//
// ImGui::SetItemDefaultFocus();
// ImGui::SameLine();
//
// if (ImGui::Button("Cancel", ImVec2(120, 0)))
// {
// ImGui::CloseCurrentPopup();
// }
//
// ImGui::EndPopup();
// }
//
// ImGui::TableNextColumn();
// ComponentTableReset(component.ModelPath, "");
//
// if (component.ModelResource)
// {
// auto& model = component.ModelResource;
// ImGui::TableNextColumn();
//
// {
// ImGui::Text("Playing");
// ImGui::TableNextColumn();
//
// ImGui::Checkbox("##playing", &model->IsPlaying);
//
// ImGui::TableNextColumn();
// ComponentTableReset(model->IsPlaying, true);
// ImGui::TableNextColumn();
// }
//
// if(model->GetCurrentAnimation())
// {
// ImGui::Text("Animation");
// ImGui::TableNextColumn();
//
// uint32_t animIndex = model->GetCurrentAnimationIndex();
// uint32_t oldAnimIndex = animIndex;
// auto animations = model->GetAnimations();
// if (ImGui::BeginCombo("Type", model->GetCurrentAnimation()->GetName().c_str()))
// {
// for (uint32_t n = 0; n < model->GetAnimationsCount(); n++)
// {
// bool is_selected = (animIndex == n);
// std::string animName = animations[n]->GetName();
//
// if (animName.empty())
// {
// animName = "Empty";
// }
//
// if (ImGui::Selectable(animName.c_str(), is_selected))
// {
// animIndex = n;
// }
//
// if (is_selected)
// ImGui::SetItemDefaultFocus();
// }
// ImGui::EndCombo();
// }
//
// if (animIndex != oldAnimIndex)
// {
// model->PlayAnimation(animIndex);
// }
//
// ImGui::TableNextColumn();
// ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
// std::string resetLabel = std::string(ICON_FA_UNDO) + "##ResetAnimId";
// if (ImGui::Button(resetLabel.c_str()))
// {
// model->PlayAnimation(0);
// }
// ImGui::PopStyleColor();
// }
// }
//
// }
// EndComponentTable();
}
};

View File

@@ -1,40 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include <src/Scene/Components/SphereCollider.h>
#include "src/FileSystem/FileSystem.h"
#include <src/Scene/Entities/ImGuiHelper.h>
class SphereColliderPanel : ComponentPanel {
public:
SphereColliderPanel() {}
void Draw(Nuake::Entity entity) override
{
if (!entity.HasComponent<Nuake::SphereColliderComponent>())
return;
auto& component = entity.GetComponent<Nuake::SphereColliderComponent>();
BeginComponentTable(SPHERE COLLIDER, Nuake::SphereColliderComponent);
{
{
ImGui::Text("Size");
ImGui::TableNextColumn();
ImGui::DragFloat("##Radius", &component.Radius, 0.01f, 0.001f);
component.Radius = std::max(component.Radius, 0.001f);
ImGui::TableNextColumn();
ComponentTableReset(component.Radius, 0.5f);
}
ImGui::TableNextColumn();
{
ImGui::Text("Is Trigger");
ImGui::TableNextColumn();
ImGui::Checkbox("##isTrigger", &component.IsTrigger);
ImGui::TableNextColumn();
ComponentTableReset(component.IsTrigger, false);
}
}
EndComponentTable();
}
};

View File

@@ -1,20 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include "src/FileSystem/FileSystem.h"
#include <src/Core/Maths.h>
#include <src/Scene/Components/SpriteComponent.h>
#include <src/Scene/Entities/ImGuiHelper.h>
class SpritePanel : ComponentPanel
{
public:
SpritePanel() = default;
~SpritePanel() = default;
void Draw(Nuake::Entity entity) override
{
}
};

View File

@@ -1,61 +0,0 @@
#pragma once
#include "ComponentPanel.h"
#include "src/FileSystem/FileSystem.h"
#include <src/Core/Maths.h>
#include <src/Scene/Components/UIComponent.h>
#include <src/Scene/Entities/ImGuiHelper.h>
class UIPanel : ComponentPanel
{
public:
UIPanel() = default;
~UIPanel() = default;
void Draw(Nuake::Entity entity) override
{
// using namespace Nuake;
//
// if (!entity.HasComponent<UIComponent>())
// return;
//
// auto& component = entity.GetComponent<UIComponent>();
// BeginComponentTable(UI EMITTER, UIComponent);
// {
// {
// ImGui::Text("HTML File");
// ImGui::TableNextColumn();
//
// std::string path = component.UIFilePath;
// ImGui::Button(component.UIFilePath.c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0));
// if (ImGui::BeginDragDropTarget())
// {
// if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("_UIFile"))
// {
// char* file = (char*)payload->Data;
// std::string fullPath = std::string(file, 256);
// path = Nuake::FileSystem::AbsoluteToRelative(fullPath);
// component.UIFilePath = path;
// }
// ImGui::EndDragDropTarget();
// }
//
// ImGui::TableNextColumn();
//
// ComponentTableReset(component.UIFilePath, "");
// }
// ImGui::TableNextColumn();
// {
// ImGui::Text("Worldspace");
// ImGui::TableNextColumn();
//
// ImGui::Checkbox("##WorldSpace", &component.IsWorldSpace);
// ImGui::TableNextColumn();
//
// ComponentTableReset(component.IsWorldSpace, false);
// }
// }
// EndComponentTable();
}
};

View File

@@ -159,25 +159,25 @@ void EditorSelectionPanel::DrawEntity(Nuake::Entity entity)
// Draw each component properties panels.
// mLightPanel.Draw(entity);
// mScriptPanel.Draw(entity);
// mNetScriptPanel.Draw(entity);
mLightPanel.Draw(entity);
mScriptPanel.Draw(entity);
mNetScriptPanel.Draw(entity);
// mAudioEmitterPanel.Draw(entity);
// mParticleEmitterPanel.Draw(entity);
// mSpritePanel.Draw(entity);
// mMeshPanel.Draw(entity);
// mSpritePanel.Draw(entity);
mMeshPanel.Draw(entity);
// mSkinnedModelPanel.Draw(entity);
// mBonePanel.Draw(entity);
// mQuakeMapPanel.Draw(entity);
// mCameraPanel.Draw(entity);
// mRigidbodyPanel.Draw(entity);
// mBoxColliderPanel.Draw(entity);
// mSphereColliderPanel.Draw(entity);
// mCapsuleColliderPanel.Draw(entity);
// mCylinderColliderPanel.Draw(entity);
// mMeshColliderPanel.Draw(entity);
// mCharacterControllerPanel.Draw(entity);
// mNavMeshVolumePanel.Draw(entity);
mBonePanel.Draw(entity);
// mQuakeMapPanel.Draw(entity);
mCameraPanel.Draw(entity);
// mRigidbodyPanel.Draw(entity);
mBoxColliderPanel.Draw(entity);
// mSphereColliderPanel.Draw(entity);
mCapsuleColliderPanel.Draw(entity);
mCylinderColliderPanel.Draw(entity);
mMeshColliderPanel.Draw(entity);
mCharacterControllerPanel.Draw(entity);
mNavMeshVolumePanel.Draw(entity);
// mUiPanel.Draw(entity);
using namespace Nuake;

View File

@@ -9,23 +9,16 @@
#include "../ComponentsPanel/LightPanel.h"
#include "../ComponentsPanel/ScriptPanel.h"
#include "../ComponentsPanel/MeshPanel.h"
#include "../ComponentsPanel/QuakeMapPanel.h"
#include "../ComponentsPanel/CameraPanel.h"
#include "../ComponentsPanel/RigidbodyPanel.h"
#include "../ComponentsPanel/BoxColliderPanel.h"
#include "../ComponentsPanel/CapsuleColliderPanel.h"
#include "../ComponentsPanel/CylinderColliderPanel.h"
#include "../ComponentsPanel/SphereColliderPanel.h"
#include "../ComponentsPanel/MeshColliderPanel.h"
#include "../ComponentsPanel/CharacterControllerPanel.h"
#include "../ComponentsPanel/SpritePanel.h"
#include "../ComponentsPanel/ParticleEmitterPanel.h"
#include "../ComponentsPanel/SkinnedModelPanel.h"
#include "../ComponentsPanel/BonePanel.h"
#include "../ComponentsPanel/AudioEmitterPanel.h"
#include "../ComponentsPanel/NetScriptPanel.h"
#include "../ComponentsPanel/NavMeshVolumePanel.h"
#include "../ComponentsPanel/UIPanel.h"
#include <src/Scene/Components/WrenScriptComponent.h>
#include <src/Resource/Prefab.h>
@@ -46,22 +39,14 @@ private:
ScriptPanel mScriptPanel;
NetScriptPanel mNetScriptPanel;
MeshPanel mMeshPanel;
SkinnedModelPanel mSkinnedModelPanel;
QuakeMapPanel mQuakeMapPanel;
CameraPanel mCameraPanel;
RigidbodyPanel mRigidbodyPanel;
BoxColliderPanel mBoxColliderPanel;
SphereColliderPanel mSphereColliderPanel;
MeshColliderPanel mMeshColliderPanel;
CapsuleColliderPanel mCapsuleColliderPanel;
CylinderColliderPanel mCylinderColliderPanel;
SpritePanel mSpritePanel;
CharacterControllerPanel mCharacterControllerPanel;
ParticleEmitterPanel mParticleEmitterPanel;
BonePanel mBonePanel;
AudioEmitterPanel mAudioEmitterPanel;
NavMeshVolumePanel mNavMeshVolumePanel;
UIPanel mUiPanel;
Ref<Nuake::File> currentFile;
Ref<Nuake::Resource> selectedResource;