Refactor editor panel services boundary
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "Features/Inspector/AddComponentPanel.h"
|
||||
|
||||
#include "Composition/EditorContext.h"
|
||||
#include "Core/Panels/EditorPanelServices.h"
|
||||
#include "Features/Inspector/Components/IInspectorComponentEditor.h"
|
||||
#include "Features/Inspector/Components/InspectorComponentEditorRegistry.h"
|
||||
|
||||
@@ -122,7 +122,7 @@ void AddComponentPanel::RebuildEntries(
|
||||
}
|
||||
|
||||
bool AddComponentPanel::TryActivateEntry(
|
||||
EditorContext& context,
|
||||
EditorPanelServices& services,
|
||||
std::size_t entryIndex) {
|
||||
if (entryIndex >= m_entries.size()) {
|
||||
return false;
|
||||
@@ -133,13 +133,13 @@ bool AddComponentPanel::TryActivateEntry(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!context.GetSceneRuntime().AddComponentToSelectedGameObject(entry.componentTypeName)) {
|
||||
if (!services.sceneRuntime.AddComponentToSelectedGameObject(entry.componentTypeName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hasTarget = context.GetSceneRuntime().GetSelectedGameObject() != nullptr;
|
||||
m_targetDisplayName = context.GetSceneRuntime().GetSelectedDisplayName();
|
||||
RebuildEntries(context.GetSceneRuntime().GetSelectedGameObject());
|
||||
m_hasTarget = services.sceneRuntime.GetSelectedGameObject() != nullptr;
|
||||
m_targetDisplayName = services.sceneRuntime.GetSelectedDisplayName();
|
||||
RebuildEntries(services.sceneRuntime.GetSelectedGameObject());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ std::size_t AddComponentPanel::HitTestEntry(const UIPoint& point) const {
|
||||
}
|
||||
|
||||
void AddComponentPanel::Update(
|
||||
EditorContext& context,
|
||||
EditorPanelServices& services,
|
||||
const EditorUtilityWindowHostContext& hostContext,
|
||||
const std::vector<UIInputEvent>& inputEvents) {
|
||||
if (!hostContext.mounted) {
|
||||
@@ -164,9 +164,9 @@ void AddComponentPanel::Update(
|
||||
|
||||
m_visible = true;
|
||||
m_bounds = hostContext.bounds;
|
||||
m_hasTarget = context.GetSceneRuntime().GetSelectedGameObject() != nullptr;
|
||||
m_targetDisplayName = context.GetSceneRuntime().GetSelectedDisplayName();
|
||||
RebuildEntries(context.GetSceneRuntime().GetSelectedGameObject());
|
||||
m_hasTarget = services.sceneRuntime.GetSelectedGameObject() != nullptr;
|
||||
m_targetDisplayName = services.sceneRuntime.GetSelectedDisplayName();
|
||||
RebuildEntries(services.sceneRuntime.GetSelectedGameObject());
|
||||
|
||||
if (hostContext.focusLost) {
|
||||
ResetInteractionState();
|
||||
@@ -204,7 +204,7 @@ void AddComponentPanel::Update(
|
||||
m_hoveredEntryIndex = HitTestEntry(event.position);
|
||||
if (m_pressedEntryIndex != kInvalidEntryIndex &&
|
||||
m_pressedEntryIndex == m_hoveredEntryIndex) {
|
||||
TryActivateEntry(context, m_pressedEntryIndex);
|
||||
TryActivateEntry(services, m_pressedEntryIndex);
|
||||
}
|
||||
m_pressedEntryIndex = kInvalidEntryIndex;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user