Refine editor action shell and add regression tests
This commit is contained in:
@@ -44,11 +44,7 @@ void InspectorPanel::OnDetach() {
|
||||
}
|
||||
|
||||
void InspectorPanel::OnSelectionChanged(const SelectionChangedEvent& event) {
|
||||
if (m_context && m_context->GetUndoManager().HasPendingInteractiveChange()) {
|
||||
m_context->GetUndoManager().FinalizeInteractiveChange();
|
||||
}
|
||||
m_selectedEntityId = event.primarySelection;
|
||||
m_addComponentPopup.Clear();
|
||||
Actions::HandleInspectorSelectionChanged(*m_context, event, m_selectedEntityId, m_addComponentPopup);
|
||||
}
|
||||
|
||||
void InspectorPanel::Render() {
|
||||
@@ -90,14 +86,10 @@ void InspectorPanel::RenderGameObject(::XCEngine::Components::GameObject* gameOb
|
||||
RenderComponent(component, gameObject);
|
||||
}
|
||||
|
||||
if (Actions::DrawInspectorAction(Actions::MakeAddComponentButtonAction(gameObject != nullptr))) {
|
||||
m_addComponentPopup.RequestOpen();
|
||||
}
|
||||
RenderAddComponentPopup(gameObject);
|
||||
Actions::DrawInspectorAddComponentButton(m_addComponentPopup, gameObject != nullptr);
|
||||
Actions::DrawInspectorAddComponentPopup(*m_context, m_addComponentPopup, gameObject);
|
||||
|
||||
if (m_context->GetUndoManager().HasPendingInteractiveChange() && !ImGui::IsAnyItemActive()) {
|
||||
m_context->GetUndoManager().FinalizeInteractiveChange();
|
||||
}
|
||||
Actions::FinalizeInspectorInteractiveChangeIfIdle(*m_context);
|
||||
}
|
||||
|
||||
void InspectorPanel::RenderEmptyState(const char* title, const char* subtitle) {
|
||||
@@ -109,20 +101,6 @@ void InspectorPanel::RenderEmptyState(const char* title, const char* subtitle) {
|
||||
UI::DrawEmptyState(title, subtitle);
|
||||
}
|
||||
|
||||
void InspectorPanel::RenderAddComponentPopup(::XCEngine::Components::GameObject* gameObject) {
|
||||
m_addComponentPopup.ConsumeOpenRequest("AddComponent");
|
||||
|
||||
if (!UI::BeginTitledPopup("AddComponent", "Components")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Actions::DrawInspectorAddComponentMenu(*m_context, gameObject)) {
|
||||
UI::DrawHintText("No registered component editors");
|
||||
}
|
||||
|
||||
UI::EndTitledPopup();
|
||||
}
|
||||
|
||||
void InspectorPanel::RenderComponent(::XCEngine::Components::Component* component, ::XCEngine::Components::GameObject* gameObject) {
|
||||
if (!component) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user