Merge pull request #83 from SHADE-DP/SP3-4-editor_fix

This commit is contained in:
XiaoQiDigipen 2022-10-02 11:01:33 +08:00 committed by GitHub
commit 3ebf42fc1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View File

@ -18,6 +18,8 @@
#include "ECS_Base/Managers/SHSystemManager.h" #include "ECS_Base/Managers/SHSystemManager.h"
#include "AudioSystem/SHAudioSystem.h" #include "AudioSystem/SHAudioSystem.h"
#include "Physics/Components/SHRigidBodyComponent.h"
#include "Physics/Components/SHColliderComponent.h"
namespace SHADE namespace SHADE
{ {
@ -70,23 +72,28 @@ namespace SHADE
{ {
DrawComponent(renderableComponent); DrawComponent(renderableComponent);
} }
if(auto testComponent = SHComponentManager::GetComponent_s<SHComponent_ENUM>(eid)) if(auto colliderComponent = SHComponentManager::GetComponent_s<SHColliderComponent>(eid))
{ {
DrawComponent(testComponent); DrawComponent(colliderComponent);
} }
if(auto rigidbodyComponent = SHComponentManager::GetComponent_s<SHRigidBodyComponent>(eid))
{
DrawComponent(rigidbodyComponent);
}
ImGui::Separator();
// Render Scripts
SHScriptEngine* scriptEngine = static_cast<SHScriptEngine*>(SHSystemManager::GetSystem<SHScriptEngine>());
scriptEngine->RenderScriptsInInspector(eid);
ImGui::Separator(); ImGui::Separator();
if(ImGui::BeginMenu(std::format("{} Add Component", ICON_MD_LIBRARY_ADD).data())) if(ImGui::BeginMenu(std::format("{} Add Component", ICON_MD_LIBRARY_ADD).data()))
{ {
DrawAddComponentButton<SHTransformComponent>(eid); DrawAddComponentButton<SHTransformComponent>(eid);
DrawAddComponentButton<SHRenderable>(eid); DrawAddComponentButton<SHRenderable>(eid);
DrawAddComponentButton<SHComponent_ENUM>(eid); DrawAddComponentButton<SHColliderComponent>(eid);
DrawAddComponentButton<SHRigidBodyComponent>(eid);
ImGui::EndMenu(); ImGui::EndMenu();
} }
// Render Scripts
SHScriptEngine* scriptEngine = static_cast<SHScriptEngine*>(SHSystemManager::GetSystem<SHScriptEngine>());
scriptEngine->RenderScriptsInInspector(eid);
} }
ImGui::End(); ImGui::End();
} }

View File

@ -390,6 +390,13 @@ RTTR_REGISTRATION
using namespace SHADE; using namespace SHADE;
using namespace rttr; using namespace rttr;
registration::enumeration<SHRigidBodyComponent::Type>("RigidBody Type")
(
value("Static", SHRigidBodyComponent::Type::STATIC),
value("Dynamic", SHRigidBodyComponent::Type::DYNAMIC),
value("Kinematic", SHRigidBodyComponent::Type::KINEMATIC)
);
registration::class_<SHRigidBodyComponent>("RigidBody Component") registration::class_<SHRigidBodyComponent>("RigidBody Component")
.property("Type" , &SHRigidBodyComponent::GetType , &SHRigidBodyComponent::SetType ) .property("Type" , &SHRigidBodyComponent::GetType , &SHRigidBodyComponent::SetType )
.property("Mass" , &SHRigidBodyComponent::GetMass , &SHRigidBodyComponent::SetMass ) .property("Mass" , &SHRigidBodyComponent::GetMass , &SHRigidBodyComponent::SetMass )