Minor fixes to variable names and comments.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
Danilo Aimini
2021-09-21 10:26:41 -07:00
parent b8c78caa2f
commit 5a4476a0e4
6 changed files with 51 additions and 62 deletions
@@ -14,10 +14,6 @@
namespace AzToolsFramework::Prefab
{
FocusModeInterface* PrefabFocusHandler::s_focusModeInterface = nullptr;
InstanceEntityMapperInterface* PrefabFocusHandler::s_instanceEntityMapperInterface = nullptr;
PrefabEditorEntityOwnershipInterface* PrefabFocusHandler::s_prefabEditorEntityOwnershipInterface = nullptr;
PrefabFocusHandler::~PrefabFocusHandler()
{
AZ::Interface<PrefabFocusInterface>::Unregister(this);
@@ -25,23 +21,23 @@ namespace AzToolsFramework::Prefab
void PrefabFocusHandler::Initialize()
{
s_focusModeInterface = AZ::Interface<FocusModeInterface>::Get();
m_focusModeInterface = AZ::Interface<FocusModeInterface>::Get();
AZ_Assert(
s_focusModeInterface,
m_focusModeInterface,
"Prefab - PrefabFocusHandler - "
"Focus Mode Interface could not be found. "
"Check that it is being correctly initialized.");
s_instanceEntityMapperInterface = AZ::Interface<InstanceEntityMapperInterface>::Get();
m_instanceEntityMapperInterface = AZ::Interface<InstanceEntityMapperInterface>::Get();
AZ_Assert(
s_instanceEntityMapperInterface,
m_instanceEntityMapperInterface,
"Prefab - PrefabFocusHandler - "
"Instance Entity Mapper Interface could not be found. "
"Check that it is being correctly initialized.");
s_prefabEditorEntityOwnershipInterface = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
m_prefabEditorEntityOwnershipInterface = AZ::Interface<PrefabEditorEntityOwnershipInterface>::Get();
AZ_Assert(
s_prefabEditorEntityOwnershipInterface,
m_prefabEditorEntityOwnershipInterface,
"Prefab - PrefabFocusHandler - "
"Prefab Editor Entity Ownership Interface could not be found. "
"Check that it is being correctly initialized.");
@@ -51,16 +47,9 @@ namespace AzToolsFramework::Prefab
PrefabFocusOperationResult PrefabFocusHandler::FocusOnOwningPrefab(AZ::EntityId entityId)
{
InstanceOptionalReference focusedInstance;
if (entityId == AZ::EntityId())
{
focusedInstance = s_prefabEditorEntityOwnershipInterface->GetRootPrefabInstance();
}
else
{
focusedInstance = s_instanceEntityMapperInterface->FindOwningInstance(entityId);
}
InstanceOptionalReference focusedInstance = (entityId == AZ::EntityId())
? m_prefabEditorEntityOwnershipInterface->GetRootPrefabInstance()
: m_instanceEntityMapperInterface->FindOwningInstance(entityId);
if (!focusedInstance.has_value())
{
@@ -70,7 +59,7 @@ namespace AzToolsFramework::Prefab
m_focusedInstance = focusedInstance;
m_focusedTemplateId = focusedInstance->get().GetTemplateId();
s_focusModeInterface->SetFocusRoot(focusedInstance->get().GetContainerEntityId());
m_focusModeInterface->SetFocusRoot(focusedInstance->get().GetContainerEntityId());
return AZ::Success();
}
@@ -92,7 +81,7 @@ namespace AzToolsFramework::Prefab
return false;
}
InstanceOptionalReference instance = s_instanceEntityMapperInterface->FindOwningInstance(entityId);
InstanceOptionalReference instance = m_instanceEntityMapperInterface->FindOwningInstance(entityId);
return instance.has_value() && (&instance->get() == &m_focusedInstance->get());
}
@@ -24,6 +24,7 @@ namespace AzToolsFramework::Prefab
{
class InstanceEntityMapperInterface;
//! Handles Prefab Focus mode, determining which prefab file entity changes will target.
class PrefabFocusHandler final
: private PrefabFocusInterface
{
@@ -34,7 +35,7 @@ namespace AzToolsFramework::Prefab
void Initialize();
// PrefabFocusInterface...
// PrefabFocusInterface override ...
PrefabFocusOperationResult FocusOnOwningPrefab(AZ::EntityId entityId) override;
TemplateId GetFocusedPrefabTemplateId() override;
InstanceOptionalReference GetFocusedPrefabInstance() override;
@@ -44,9 +45,9 @@ namespace AzToolsFramework::Prefab
InstanceOptionalReference m_focusedInstance;
TemplateId m_focusedTemplateId;
static FocusModeInterface* s_focusModeInterface;
static InstanceEntityMapperInterface* s_instanceEntityMapperInterface;
static PrefabEditorEntityOwnershipInterface* s_prefabEditorEntityOwnershipInterface;
FocusModeInterface* m_focusModeInterface;
InstanceEntityMapperInterface* m_instanceEntityMapperInterface;
PrefabEditorEntityOwnershipInterface* m_prefabEditorEntityOwnershipInterface;
};
} // namespace AzToolsFramework::Prefab
@@ -16,17 +16,15 @@
namespace AzToolsFramework::Prefab
{
typedef AZ::Outcome<void, AZStd::string> PrefabFocusOperationResult;
using PrefabFocusOperationResult = AZ::Outcome<void, AZStd::string>;
/*!
* PrefabFocusInterface
*/
//! Interface to handle operations related to the Prefab Focus system.
class PrefabFocusInterface
{
public:
AZ_RTTI(PrefabFocusInterface, "{F3CFA37B-5FD8-436A-9C30-60EB54E350E1}");
//! Set the focused prefab instance to the owning instance of the entityId provided
//! Set the focused prefab instance to the owning instance of the entityId provided.
//! @param entityId The entityId of the entity whose owning instance we want the prefab system to focus on.
virtual PrefabFocusOperationResult FocusOnOwningPrefab(AZ::EntityId entityId) = 0;