Correctly set focused entity in case the root prefab instance is focused.

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
Danilo Aimini
2021-09-28 17:48:36 -07:00
parent 1f32076ca5
commit ce334f9443
@@ -84,11 +84,20 @@ namespace AzToolsFramework::Prefab
m_focusedInstance = focusedInstance;
m_focusedTemplateId = focusedInstance->get().GetTemplateId();
AZ::EntityId containerEntityId = focusedInstance->get().GetContainerEntityId();
AZ::EntityId containerEntityId;
// Select the container entity
AzToolsFramework::SelectEntity(containerEntityId);
if (focusedInstance->get().GetParentInstance() != AZStd::nullopt)
{
containerEntityId = focusedInstance->get().GetContainerEntityId();
// Select the container entity
AzToolsFramework::SelectEntity(containerEntityId);
}
else
{
containerEntityId = AZ::EntityId();
}
// Focus on the descendants of the container entity
if (FocusModeInterface* focusModeInterface = AZ::Interface<FocusModeInterface>::Get())
{
@@ -96,7 +105,6 @@ namespace AzToolsFramework::Prefab
}
RefreshInstanceFocusList();
PrefabFocusNotificationBus::Broadcast(&PrefabFocusNotifications::OnPrefabFocusChanged);
}