From 0bccecaa15ea756b840985ba562a1302e419b322 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 9 Dec 2021 11:36:39 -0600 Subject: [PATCH 1/2] Fixed logic for when to cull entities from having their viewport manipulators regenerated. Signed-off-by: Chris Galvan --- .../EditorTransformComponentSelection.cpp | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index 336198c183..f430d3a61e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -2504,6 +2504,29 @@ namespace AzToolsFramework { AZ_PROFILE_FUNCTION(AzToolsFramework); + // Do not create manipulators for the container entity of the focused prefab. + if (auto prefabFocusPublicInterface = AZ::Interface::Get()) + { + AzFramework::EntityContextId editorEntityContextId = GetEntityContextId(); + if (AZ::EntityId focusRoot = prefabFocusPublicInterface->GetFocusedPrefabContainerEntityId(editorEntityContextId); + focusRoot.IsValid()) + { + m_selectedEntityIds.erase(focusRoot); + } + } + + // Do not create manipulators for any entities marked as read only + if (auto readOnlyEntityPublicInterface = AZ::Interface::Get()) + { + AZStd::erase_if( + m_selectedEntityIds, + [readOnlyEntityPublicInterface](auto entityId) + { + return readOnlyEntityPublicInterface->IsReadOnly(entityId); + } + ); + } + // note: create/destroy pattern to be addressed DestroyManipulators(m_entityIdManipulators); CreateEntityIdManipulators(); @@ -3635,29 +3658,6 @@ namespace AzToolsFramework m_selectedEntityIds.clear(); m_selectedEntityIds.reserve(selectedEntityIds.size()); AZStd::copy(selectedEntityIds.begin(), selectedEntityIds.end(), AZStd::inserter(m_selectedEntityIds, m_selectedEntityIds.end())); - - // Do not create manipulators for the container entity of the focused prefab. - if (auto prefabFocusPublicInterface = AZ::Interface::Get()) - { - AzFramework::EntityContextId editorEntityContextId = GetEntityContextId(); - if (AZ::EntityId focusRoot = prefabFocusPublicInterface->GetFocusedPrefabContainerEntityId(editorEntityContextId); - focusRoot.IsValid()) - { - m_selectedEntityIds.erase(focusRoot); - } - } - - // Do not create manipulators for any entities marked as read only - if (auto readOnlyEntityPublicInterface = AZ::Interface::Get()) - { - AZStd::erase_if( - m_selectedEntityIds, - [readOnlyEntityPublicInterface](auto entityId) - { - return readOnlyEntityPublicInterface->IsReadOnly(entityId); - } - ); - } } void EditorTransformComponentSelection::OnTransformChanged( From e636ea39e3123fa576b45e21c6750aeb2cf1e17e Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 9 Dec 2021 13:15:20 -0600 Subject: [PATCH 2/2] Fixed comment casing to match rest of file. Signed-off-by: Chris Galvan --- .../ViewportSelection/EditorTransformComponentSelection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index f430d3a61e..bd9292db32 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -2504,7 +2504,7 @@ namespace AzToolsFramework { AZ_PROFILE_FUNCTION(AzToolsFramework); - // Do not create manipulators for the container entity of the focused prefab. + // do not create manipulators for the container entity of the focused prefab. if (auto prefabFocusPublicInterface = AZ::Interface::Get()) { AzFramework::EntityContextId editorEntityContextId = GetEntityContextId(); @@ -2515,7 +2515,7 @@ namespace AzToolsFramework } } - // Do not create manipulators for any entities marked as read only + // do not create manipulators for any entities marked as read only if (auto readOnlyEntityPublicInterface = AZ::Interface::Get()) { AZStd::erase_if(