Files
o3de/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabFocusInterface.h
T
Danilo Aimini 60c286dafa LYN-7483 + LYN-7052 | Correctly initialize and refresh Prefab Focus Mode handler. (#4718)
* Initialize the PrefabFocusHandler on context reset, to also cover the case of a new level being created on the welcome screen.
Relax checks/restrictions on refreshes to cover cases where an instance is reused by the Prefab EOS.
Refresh the breadcrumbs when a container is renamed and when a change is propagated to the instances to ensure the correct names are displayed.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Rename m_isInitialized to m_initialized in PrefabFocusHandler

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Use find_if to detect when a container entity in the focus path has been renamed.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Renaming and commenting variables in PrefabFocusHandler.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Undo minor naming change

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>

* Replace lazy initialization and have the UI side initialize the Editor calls in PrefabFocusHandler.
This should prevent issues with focus mode trying to access these interfaces in non-editor applications.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
2021-10-20 12:56:30 -07:00

46 lines
1.8 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Interface/Interface.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzFramework/Entity/EntityContext.h>
#include <AzToolsFramework/Prefab/Instance/Instance.h>
#include <AzToolsFramework/Prefab/Template/Template.h>
namespace AzToolsFramework::Prefab
{
using PrefabFocusOperationResult = AZ::Outcome<void, AZStd::string>;
//! Interface to handle internal operations related to the Prefab Focus system.
class PrefabFocusInterface
{
public:
AZ_RTTI(PrefabFocusInterface, "{F3CFA37B-5FD8-436A-9C30-60EB54E350E1}");
//! Initializes the editor interfaces for Prefab Focus mode.
//! If this is not called on initialization, the Prefab Focus Mode functions will still work
//! but won't trigger the Editor APIs to visualize focus mode on the UI.
virtual void InitializeEditorInterfaces() = 0;
//! 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 FocusOnPrefabInstanceOwningEntityId(AZ::EntityId entityId) = 0;
//! Returns the template id of the instance the prefab system is focusing on.
virtual TemplateId GetFocusedPrefabTemplateId(AzFramework::EntityContextId entityContextId) const = 0;
//! Returns a reference to the instance the prefab system is focusing on.
virtual InstanceOptionalReference GetFocusedPrefabInstance(AzFramework::EntityContextId entityContextId) const = 0;
};
} // namespace AzToolsFramework::Prefab