#include "InspectorPanel.h" #include namespace UI { InspectorPanel::InspectorPanel() : Panel("Inspector") {} void InspectorPanel::Render() { ImGui::Begin(m_name.c_str(), &m_isOpen, ImGuiWindowFlags_None); GameObject* selected = nullptr; if (m_hierarchyPanel) { selected = m_hierarchyPanel->GetSelectedObject(); } if (selected) { ImGui::Text("%s", selected->name.c_str()); ImGui::Separator(); RenderTransformSection(); ImGui::Separator(); RenderMeshRendererSection(); } else { ImGui::Text("No object selected"); ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "Select an object in Hierarchy"); } ImGui::End(); } void InspectorPanel::RenderTransformSection() { if (ImGui::CollapsingHeader("Transform", ImGuiTreeNodeFlags_DefaultOpen)) { ImGui::Indent(10.0f); ImGui::Text("Position"); ImGui::SameLine(80); ImGui::SetNextItemWidth(180); ImGui::DragFloat3("##Position", m_position, 0.1f); ImGui::Text("Rotation"); ImGui::SameLine(80); ImGui::SetNextItemWidth(180); ImGui::DragFloat3("##Rotation", m_rotation, 1.0f); ImGui::Text("Scale"); ImGui::SameLine(80); ImGui::SetNextItemWidth(180); ImGui::DragFloat3("##Scale", m_scale, 0.1f); ImGui::Unindent(10.0f); } } void InspectorPanel::RenderMeshRendererSection() { if (ImGui::CollapsingHeader("Mesh Renderer", ImGuiTreeNodeFlags_DefaultOpen)) { ImGui::Indent(10.0f); ImGui::Text("Material"); ImGui::SameLine(80); ImGui::SetNextItemWidth(180); static char materialName[64] = "Default-Material"; ImGui::InputText("##Material", materialName, sizeof(materialName)); ImGui::Text("Mesh"); ImGui::SameLine(80); ImGui::SetNextItemWidth(180); static char meshName[64] = "Cube Mesh"; ImGui::InputText("##Mesh", meshName, sizeof(meshName)); ImGui::Unindent(10.0f); } } }