feat: update editor ui framework and assets

This commit is contained in:
2026-03-28 15:07:19 +08:00
parent 4a12e26860
commit 4717b595c4
45 changed files with 2434 additions and 461 deletions

View File

@@ -48,25 +48,33 @@ void InspectorPanel::OnSelectionChanged(const SelectionChangedEvent& event) {
}
void InspectorPanel::Render() {
UI::PanelWindowScope panel(m_name.c_str());
if (!panel.IsOpen()) {
return;
}
Actions::ObserveInactiveActionRoute(*m_context);
if (m_selectedEntityId) {
auto& sceneManager = m_context->GetSceneManager();
auto* gameObject = sceneManager.GetEntity(m_selectedEntityId);
if (gameObject) {
RenderGameObject(gameObject);
} else {
RenderEmptyState("Object not found");
ImGui::PushStyleColor(ImGuiCol_WindowBg, UI::HierarchyInspectorPanelBackgroundColor());
ImGui::PushStyleColor(ImGuiCol_ChildBg, UI::HierarchyInspectorPanelBackgroundColor());
{
UI::PanelWindowScope panel(m_name.c_str());
if (!panel.IsOpen()) {
ImGui::PopStyleColor(2);
return;
}
Actions::ObserveInactiveActionRoute(*m_context);
if (m_selectedEntityId) {
auto& sceneManager = m_context->GetSceneManager();
auto* gameObject = sceneManager.GetEntity(m_selectedEntityId);
if (gameObject) {
RenderGameObject(gameObject);
} else {
RenderEmptyState("Object not found");
}
} else {
UI::PanelContentScope content(
"InspectorEmpty",
UI::InspectorPanelContentPadding(),
ImGuiChildFlags_None);
}
} else {
RenderEmptyState("No Selection", "Select an object in Hierarchy");
}
ImGui::PopStyleColor(2);
}
void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameObject) {
@@ -74,6 +82,7 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
UI::PanelContentScope content(
"InspectorContent",
UI::InspectorPanelContentPadding(),
ImGuiChildFlags_None,
ImGuiWindowFlags_None,
true,
ImVec2(style.ItemSpacing.x, 0.0f));
@@ -93,7 +102,10 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
}
void InspectorPanel::RenderEmptyState(const char* title, const char* subtitle) {
UI::PanelContentScope content("InspectorEmptyState", UI::InspectorPanelContentPadding());
UI::PanelContentScope content(
"InspectorEmptyState",
UI::InspectorPanelContentPadding(),
ImGuiChildFlags_None);
if (!content.IsOpen()) {
return;
}
@@ -120,6 +132,8 @@ void InspectorPanel::RenderComponent(::XCEngine::Components::Component* componen
}
if (section.open) {
ImGui::Indent(section.contentIndent);
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, UI::InspectorComponentControlSpacing());
if (editor) {
if (editor->Render(component, &m_context->GetUndoManager())) {
m_context->GetSceneManager().MarkSceneDirty();
@@ -127,8 +141,9 @@ void InspectorPanel::RenderComponent(::XCEngine::Components::Component* componen
} else {
UI::DrawHintText("No registered editor for this component");
}
ImGui::PopStyleVar();
UI::EndComponentSection();
UI::EndComponentSection(section);
}
}