Fixed entities not being deselected when entering game mode in editor.
added protections around physx AZ::Events handlers that are connected/disconnected on selection events. jira: LYN-2998
This commit is contained in:
+8
-2
@@ -491,6 +491,14 @@ namespace AzToolsFramework
|
||||
|
||||
EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnStartPlayInEditorBegin);
|
||||
|
||||
//cache the current selected entities.
|
||||
ToolsApplicationRequests::Bus::BroadcastResult(m_selectedBeforeStartingGame, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
//deselect entities if selected when entering game mode before deactivating the entities in StartPlayInEditor(...)
|
||||
if (!m_selectedBeforeStartingGame.empty())
|
||||
{
|
||||
ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::MarkEntitiesDeselected, m_selectedBeforeStartingGame);
|
||||
}
|
||||
|
||||
if (m_isLegacySliceService)
|
||||
{
|
||||
SliceEditorEntityOwnershipService* editorEntityOwnershipService =
|
||||
@@ -507,8 +515,6 @@ namespace AzToolsFramework
|
||||
|
||||
m_isRunningGame = true;
|
||||
|
||||
ToolsApplicationRequests::Bus::BroadcastResult(m_selectedBeforeStartingGame, &ToolsApplicationRequests::GetSelectedEntities);
|
||||
|
||||
EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnStartPlayInEditor);
|
||||
}
|
||||
|
||||
|
||||
@@ -686,8 +686,14 @@ namespace PhysX
|
||||
{
|
||||
if (auto* physXSystem = GetPhysXSystem())
|
||||
{
|
||||
physXSystem->RegisterSystemConfigurationChangedEvent(m_physXConfigChangedHandler);
|
||||
physXSystem->RegisterOnDefaultMaterialLibraryChangedEventHandler(m_onDefaultMaterialLibraryChangedEventHandler);
|
||||
if (!m_physXConfigChangedHandler.IsConnected())
|
||||
{
|
||||
physXSystem->RegisterSystemConfigurationChangedEvent(m_physXConfigChangedHandler);
|
||||
}
|
||||
if (!m_onDefaultMaterialLibraryChangedEventHandler.IsConnected())
|
||||
{
|
||||
physXSystem->RegisterOnDefaultMaterialLibraryChangedEventHandler(m_onDefaultMaterialLibraryChangedEventHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -149,7 +149,10 @@ namespace PhysX
|
||||
{
|
||||
if (auto* physXSystem = GetPhysXSystem())
|
||||
{
|
||||
physXSystem->RegisterSystemConfigurationChangedEvent(m_physXConfigChangedHandler);
|
||||
if (!m_physXConfigChangedHandler.IsConnected())
|
||||
{
|
||||
physXSystem->RegisterSystemConfigurationChangedEvent(m_physXConfigChangedHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user