Addressed multiple minor CR comments.
Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
+6
-2
@@ -13,12 +13,16 @@
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
//! Used to notify when the editor focus changes.
|
||||
class FocusModeNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual ~FocusModeNotifications() = default;
|
||||
protected:
|
||||
~FocusModeNotifications() = default;
|
||||
|
||||
public:
|
||||
//! Triggered when the editor focus is changed to a different entity.
|
||||
//! @param entityId The entity the focus has been moved to.
|
||||
virtual void OnEditorFocusChanged(AZ::EntityId entityId) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace AzToolsFramework::Prefab
|
||||
return AZ::Failure(AZStd::string("Prefab Focus Handler: invalid instance to focus on."));
|
||||
}
|
||||
|
||||
if (&m_focusedInstance->get() != &focusedInstance->get())
|
||||
if (!m_focusedInstance.has_value() || &m_focusedInstance->get() != &focusedInstance->get())
|
||||
{
|
||||
m_focusedInstance = focusedInstance;
|
||||
m_focusedTemplateId = focusedInstance->get().GetTemplateId();
|
||||
@@ -90,8 +90,7 @@ namespace AzToolsFramework::Prefab
|
||||
AzToolsFramework::SelectEntity(containerEntityId);
|
||||
|
||||
// Focus on the descendants of the container entity
|
||||
FocusModeInterface* focusModeInterface = AZ::Interface<FocusModeInterface>::Get();
|
||||
if (focusModeInterface)
|
||||
if (FocusModeInterface* focusModeInterface = AZ::Interface<FocusModeInterface>::Get())
|
||||
{
|
||||
focusModeInterface->SetFocusRoot(containerEntityId);
|
||||
}
|
||||
@@ -104,17 +103,17 @@ namespace AzToolsFramework::Prefab
|
||||
return AZ::Success();
|
||||
}
|
||||
|
||||
TemplateId PrefabFocusHandler::GetFocusedPrefabTemplateId()
|
||||
TemplateId PrefabFocusHandler::GetFocusedPrefabTemplateId() const
|
||||
{
|
||||
return m_focusedTemplateId;
|
||||
}
|
||||
|
||||
InstanceOptionalReference PrefabFocusHandler::GetFocusedPrefabInstance()
|
||||
InstanceOptionalReference PrefabFocusHandler::GetFocusedPrefabInstance() const
|
||||
{
|
||||
return m_focusedInstance;
|
||||
}
|
||||
|
||||
bool PrefabFocusHandler::IsOwningPrefabBeingFocused(AZ::EntityId entityId)
|
||||
bool PrefabFocusHandler::IsOwningPrefabBeingFocused(AZ::EntityId entityId) const
|
||||
{
|
||||
if (!m_focusedInstance.has_value())
|
||||
{
|
||||
@@ -132,12 +131,12 @@ namespace AzToolsFramework::Prefab
|
||||
return instance.has_value() && (&instance->get() == &m_focusedInstance->get());
|
||||
}
|
||||
|
||||
const AZ::IO::Path& PrefabFocusHandler::GetPrefabFocusPath()
|
||||
const AZ::IO::Path& PrefabFocusHandler::GetPrefabFocusPath() const
|
||||
{
|
||||
return m_instanceFocusPath;
|
||||
}
|
||||
|
||||
const int PrefabFocusHandler::GetPrefabFocusPathLength()
|
||||
const int PrefabFocusHandler::GetPrefabFocusPathLength() const
|
||||
{
|
||||
return aznumeric_cast<int>(m_instanceFocusVector.size());
|
||||
}
|
||||
|
||||
@@ -30,16 +30,16 @@ namespace AzToolsFramework::Prefab
|
||||
PrefabFocusHandler();
|
||||
~PrefabFocusHandler();
|
||||
|
||||
// PrefabFocusInterface override ...
|
||||
// PrefabFocusInterface overrides ...
|
||||
PrefabFocusOperationResult FocusOnOwningPrefab(AZ::EntityId entityId) override;
|
||||
PrefabFocusOperationResult FocusOnPathIndex(int index) override;
|
||||
TemplateId GetFocusedPrefabTemplateId() override;
|
||||
InstanceOptionalReference GetFocusedPrefabInstance() override;
|
||||
bool IsOwningPrefabBeingFocused(AZ::EntityId entityId) override;
|
||||
const AZ::IO::Path& GetPrefabFocusPath() override;
|
||||
const int GetPrefabFocusPathLength() override;
|
||||
TemplateId GetFocusedPrefabTemplateId() const override;
|
||||
InstanceOptionalReference GetFocusedPrefabInstance() const override;
|
||||
bool IsOwningPrefabBeingFocused(AZ::EntityId entityId) const override;
|
||||
const AZ::IO::Path& GetPrefabFocusPath() const override;
|
||||
const int GetPrefabFocusPathLength() const override;
|
||||
|
||||
// EditorEntityContextNotificationBus...
|
||||
// EditorEntityContextNotificationBus overrides ...
|
||||
void OnEntityStreamLoadSuccess() override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -33,22 +33,22 @@ namespace AzToolsFramework::Prefab
|
||||
virtual PrefabFocusOperationResult FocusOnPathIndex(int index) = 0;
|
||||
|
||||
//! Returns the template id of the instance the prefab system is focusing on.
|
||||
virtual TemplateId GetFocusedPrefabTemplateId() = 0;
|
||||
virtual TemplateId GetFocusedPrefabTemplateId() const = 0;
|
||||
|
||||
//! Returns a reference to the instance the prefab system is focusing on.
|
||||
virtual InstanceOptionalReference GetFocusedPrefabInstance() = 0;
|
||||
virtual InstanceOptionalReference GetFocusedPrefabInstance() const = 0;
|
||||
|
||||
//! Returns whether the entity belongs to the instance that is being focused on, or one of its descendants.
|
||||
//! @param entityId The entityId of the queried entity.
|
||||
//! @return true if the entity belongs to the focused instance or one of its descendants, false otherwise.
|
||||
virtual bool IsOwningPrefabBeingFocused(AZ::EntityId entityId) = 0;
|
||||
virtual bool IsOwningPrefabBeingFocused(AZ::EntityId entityId) const = 0;
|
||||
|
||||
//! Returns the path from the root instance to the currently focused instance.
|
||||
//! @return A path composed from the names of the container entities for the instance path.
|
||||
virtual const AZ::IO::Path& GetPrefabFocusPath() = 0;
|
||||
virtual const AZ::IO::Path& GetPrefabFocusPath() const = 0;
|
||||
|
||||
//! Returns the size of the path to the currently focused instance.
|
||||
virtual const int GetPrefabFocusPathLength() = 0;
|
||||
virtual const int GetPrefabFocusPathLength() const = 0;
|
||||
};
|
||||
|
||||
} // namespace AzToolsFramework::Prefab
|
||||
|
||||
+8
-3
@@ -9,14 +9,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzFramework/Entity/EntityContext.h>
|
||||
|
||||
namespace AzToolsFramework::Prefab
|
||||
{
|
||||
class PrefabFocusNotifications : public AZ::EBusTraits
|
||||
//! Used to notify when the editor focus changes.
|
||||
class PrefabFocusNotifications
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
virtual ~PrefabFocusNotifications() = default;
|
||||
protected:
|
||||
~PrefabFocusNotifications() = default;
|
||||
|
||||
public:
|
||||
//! Triggered when the editor focus is changed to a different prefab.
|
||||
virtual void OnPrefabFocusChanged() = 0;
|
||||
};
|
||||
|
||||
|
||||
+1
-3
@@ -49,9 +49,7 @@ namespace AzToolsFramework::Prefab
|
||||
connect(m_backButton, &QToolButton::clicked, this,
|
||||
[&]()
|
||||
{
|
||||
int length = m_prefabFocusInterface->GetPrefabFocusPathLength();
|
||||
|
||||
if (length > 1)
|
||||
if (int length = m_prefabFocusInterface->GetPrefabFocusPathLength(); length > 1)
|
||||
{
|
||||
m_prefabFocusInterface->FocusOnPathIndex(length - 2);
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ namespace AzToolsFramework::Prefab
|
||||
|
||||
void Initialize(AzQtComponents::BreadCrumbs* breadcrumbsWidget, QToolButton* backButton);
|
||||
|
||||
// PrefabFocusNotificationBus...
|
||||
// PrefabFocusNotificationBus overrides ...
|
||||
void OnPrefabFocusChanged() override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user