Extract editor interaction states

This commit is contained in:
2026-03-26 21:30:46 +08:00
parent 6467d87b81
commit f6286d432c
6 changed files with 106 additions and 25 deletions

View File

@@ -28,6 +28,7 @@ void InspectorPanel::OnSelectionChanged(const SelectionChangedEvent& event) {
m_context->GetUndoManager().FinalizeInteractiveChange();
}
m_selectedEntityId = event.primarySelection;
m_addComponentPopup.Clear();
}
void InspectorPanel::Render() {
@@ -78,7 +79,7 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
}
if (Actions::DrawInspectorAction(Actions::MakeAddComponentButtonAction(gameObject != nullptr))) {
ImGui::OpenPopup("AddComponent");
m_addComponentPopup.RequestOpen();
}
RenderAddComponentPopup(gameObject);
@@ -97,6 +98,8 @@ void InspectorPanel::RenderEmptyState(const char* title, const char* subtitle) {
}
void InspectorPanel::RenderAddComponentPopup(::XCEngine::Components::GameObject* gameObject) {
m_addComponentPopup.ConsumeOpenRequest("AddComponent");
if (!UI::BeginTitledPopup("AddComponent", "Components")) {
return;
}