Merge branch 'development' into cmake/linux_fix_warn_unused

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Legacy/CrySystem/Log.cpp
#	Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp
#	Code/Tools/Standalone/Source/Driller/AreaChart.cpp
#	Code/Tools/Standalone/Source/Driller/AreaChart.hxx
#	Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp
#	Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp
#	Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp
This commit is contained in:
Esteban Papp
2021-08-25 11:47:19 -07:00
400 changed files with 1886 additions and 46899 deletions
@@ -312,8 +312,7 @@ namespace AzToolsFramework
#elif defined(AZ_PLATFORM_WINDOWS)
return "pc";
#elif defined(AZ_PLATFORM_LINUX)
// set this to pc because that's what bootstrap.cfg currently defines the platform to "pc", even on Linux
return "pc";
return "linux";
#else
#error Unimplemented Host Asset Platform
#endif
@@ -5,14 +5,10 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H
#define AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H
#include <AzCore/base.h>
#pragma once
#include <AzCore/base.h>
#include <AzCore/Debug/Budget.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/Math/Aabb.h>
#include <AzCore/Math/Uuid.h>
@@ -1089,4 +1085,5 @@ namespace AzToolsFramework
}
} // namespace AzToolsFramework
#endif // AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H
AZ_DECLARE_BUDGET(AzToolsFramework);
@@ -52,6 +52,8 @@
#include <AzToolsFramework/AssetBrowser/AssetBrowserComponent.h>
#include <AzToolsFramework/ViewportSelection/EditorInteractionSystemComponent.h>
AZ_DEFINE_BUDGET(AzToolsFramework);
namespace AzToolsFramework
{
AzToolsFrameworkModule::AzToolsFrameworkModule()
@@ -158,6 +158,16 @@ namespace AzToolsFramework
SetImplementation(nullptr);
}
void QtEventToAzInputMapper::EditorQtMouseDevice::SetSystemCursorState(const AzFramework::SystemCursorState systemCursorState)
{
m_systemCursorState = systemCursorState;
}
AzFramework::SystemCursorState QtEventToAzInputMapper::EditorQtMouseDevice::GetSystemCursorState() const
{
return m_systemCursorState;
}
QtEventToAzInputMapper::QtEventToAzInputMapper(QWidget* sourceWidget, int syntheticDeviceId)
: QObject(sourceWidget)
, m_sourceWidget(sourceWidget)
@@ -210,12 +220,15 @@ namespace AzToolsFramework
if (m_capturingCursor != enabled)
{
m_capturingCursor = enabled;
if (m_capturingCursor)
{
m_mouseDevice->SetSystemCursorState(AzFramework::SystemCursorState::ConstrainedAndHidden);
qApp->setOverrideCursor(Qt::BlankCursor);
}
else
{
m_mouseDevice->SetSystemCursorState(AzFramework::SystemCursorState::UnconstrainedAndVisible);
qApp->restoreOverrideCursor();
}
}
@@ -238,10 +251,22 @@ namespace AzToolsFramework
return false;
}
// If our focus changes, go ahead and reset all input devices.
if (eventType == QEvent::FocusIn || eventType == QEvent::FocusOut)
{
// If our focus changes, go ahead and reset all input devices.
HandleFocusChange(event);
// If we focus in on the source widget and the mouse is contained in its
// bounds, refresh the cached cursor position to ensure it is up to date (this
// ensures cursor positions are refreshed correctly with context menu focus changes)
if (eventType == QEvent::FocusIn)
{
const auto widgetCursorPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
if (m_sourceWidget->geometry().contains(widgetCursorPosition))
{
HandleMouseMoveEvent(widgetCursorPosition);
}
}
}
// Map key events to input channels.
// ShortcutOverride is used in lieu of KeyPress for high priority input channels like Alt
@@ -249,7 +274,7 @@ namespace AzToolsFramework
else if (
eventType == QEvent::Type::KeyPress || eventType == QEvent::Type::KeyRelease || eventType == QEvent::Type::ShortcutOverride)
{
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
auto keyEvent = static_cast<QKeyEvent*>(event);
HandleKeyEvent(keyEvent);
}
// Map mouse events to input channels.
@@ -257,20 +282,20 @@ namespace AzToolsFramework
eventType == QEvent::Type::MouseButtonPress || eventType == QEvent::Type::MouseButtonRelease ||
eventType == QEvent::Type::MouseButtonDblClick)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
auto mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseButtonEvent(mouseEvent);
}
// Map mouse movement to the movement input channels.
// This includes SystemCursorPosition alongside Movement::X and Movement::Y.
else if (eventType == QEvent::Type::MouseMove)
{
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseMoveEvent(mouseEvent);
auto mouseEvent = static_cast<QMouseEvent*>(event);
HandleMouseMoveEvent(mouseEvent->pos());
}
// Map wheel events to the mouse Z movement channel.
else if (eventType == QEvent::Type::Wheel)
{
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
auto wheelEvent = static_cast<QWheelEvent*>(event);
HandleWheelEvent(wheelEvent);
}
@@ -345,9 +370,8 @@ namespace AzToolsFramework
return QPoint{ denormalizedX, denormalizedY };
}
void QtEventToAzInputMapper::HandleMouseMoveEvent(QMouseEvent* mouseEvent)
void QtEventToAzInputMapper::HandleMouseMoveEvent(const QPoint& cursorPosition)
{
const QPoint cursorPosition = mouseEvent->pos();
const QPoint cursorDelta = cursorPosition - m_previousCursorPosition;
m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(cursorPosition);
@@ -357,17 +381,14 @@ namespace AzToolsFramework
if (m_capturingCursor)
{
// Reset our cursor position to the previous point.
const QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition);
AzQtComponents::SetCursorPos(targetScreenPosition);
// Even though we just set the cursor position, there are edge cases such as remote desktop that will leave
// the cursor position unchanged. For safety, we re-cache our last cursor position for delta generation.
const QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos());
m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(actualWidgetPosition);
// Reset our cursor position to the previous point
const QPoint screenCursorPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition);
AzQtComponents::SetCursorPos(screenCursorPosition);
}
else
{
m_previousCursorPosition = cursorPosition;
}
m_previousCursorPosition = cursorPosition;
}
void QtEventToAzInputMapper::HandleKeyEvent(QKeyEvent* keyEvent)
@@ -105,7 +105,14 @@ namespace AzToolsFramework
public:
EditorQtMouseDevice(AzFramework::InputDeviceId id);
// AzFramework::InputDeviceMouse overrides ...
void SetSystemCursorState(AzFramework::SystemCursorState systemCursorState) override;
AzFramework::SystemCursorState GetSystemCursorState() const override;
friend class QtEventToAzInputMapper;
private:
AzFramework::SystemCursorState m_systemCursorState = AzFramework::SystemCursorState::UnconstrainedAndVisible;
};
// Emits InputChannelUpdated if channel has transitioned in state (i.e. has gone from active to inactive or vice versa).
@@ -122,7 +129,7 @@ namespace AzToolsFramework
// Handle mouse click events.
void HandleMouseButtonEvent(QMouseEvent* mouseEvent);
// Handle mouse move events.
void HandleMouseMoveEvent(QMouseEvent* mouseEvent);
void HandleMouseMoveEvent(const QPoint& cursorPosition);
// Handles key press / release events (or ShortcutOverride events for keys listed in m_highPriorityKeys).
void HandleKeyEvent(QKeyEvent* keyEvent);
// Handles mouse wheel events.
@@ -35,10 +35,8 @@
#include <AzFramework/Asset/AssetCatalogComponent.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/TargetManagement/TargetManagementComponent.h>
#include <AzFramework/Driller/RemoteDrillerInterface.h>
#include <AzCore/Driller/Driller.h>
#include <AzCore/Debug/ProfilerDriller.h>
#ifdef AZ_PLATFORM_WINDOWS
#include "shlobj.h"
@@ -485,8 +483,6 @@ namespace LegacyFramework
void Application::CreateApplicationComponents()
{
EnsureComponentCreated(AzFramework::TargetManagementComponent::RTTI_Type());
EnsureComponentCreated(AzFramework::DrillerNetworkConsoleComponent::RTTI_Type());
EnsureComponentCreated(AzFramework::DrillerNetworkAgentComponent::RTTI_Type());
}
void Application::CreateSystemComponents()
@@ -507,8 +503,6 @@ namespace LegacyFramework
ComponentApplication::RegisterCoreComponents();
RegisterComponentDescriptor(AzFramework::TargetManagementComponent::CreateDescriptor());
RegisterComponentDescriptor(AzFramework::DrillerNetworkConsoleComponent::CreateDescriptor());
RegisterComponentDescriptor(AzFramework::DrillerNetworkAgentComponent::CreateDescriptor());
RegisterComponentDescriptor(AzToolsFramework::Framework::CreateDescriptor());
}
}
@@ -5,7 +5,10 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/base.h>
#include <AzCore/Debug/Budget.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Math/Uuid.h>
#include <AzCore/RTTI/RTTI.h>
@@ -14,8 +17,6 @@
#include <AzCore/Component/ComponentBus.h>
#include "PropertyEditorAPI_Internals.h"
#pragma once
class QWidget;
class QCheckBox;
class QLabel;
@@ -25,6 +25,8 @@ class QColor;
class QString;
class QPoint;
AZ_DECLARE_BUDGET(AzToolsFramework);
namespace AzToolsFramework
{
namespace Components
@@ -9,8 +9,11 @@
#pragma once
#include <AzCore/Component/Entity.h>
#include <AzCore/Debug/Budget.h>
#include <AzCore/Interface/Interface.h>
AZ_DECLARE_BUDGET(AzToolsFramework);
namespace AzToolsFramework
{
namespace UndoSystem
@@ -115,7 +115,7 @@ namespace UnitTest
handled, AzToolsFramework::GetEntityContextId(),
&EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction,
AzToolsFramework::ViewportInteraction::MouseInteractionEvent(
mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down));
mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down, /*captured=*/false));
return handled;
}
}
@@ -41,7 +41,8 @@ namespace AzToolsFramework
ViewportInteraction::QPointFromScreenPoint(mouseInteraction.m_mouseInteraction.m_mousePick.m_screenCoordinates);
// if the mouse hasn't moved, open the pop-up menu
if ((currentScreenCoords - contextMenu.m_clickPoint).manhattanLength() < ed_contextMenuDisplayThreshold)
if ((currentScreenCoords - contextMenu.m_clickPoint).manhattanLength() < ed_contextMenuDisplayThreshold &&
!mouseInteraction.m_captured)
{
QWidget* parent = nullptr;
ViewportInteraction::MainEditorViewportInteractionRequestBus::EventResult(
@@ -212,9 +212,10 @@ namespace AzToolsFramework
static void Reflect(AZ::SerializeContext& context);
//! Constructor to create a default MouseInteractionEvent
MouseInteractionEvent(MouseInteraction mouseInteraction, const MouseEvent mouseEvent)
MouseInteractionEvent(MouseInteraction mouseInteraction, const MouseEvent mouseEvent, const bool captured)
: m_mouseInteraction(std::move(mouseInteraction))
, m_mouseEvent(mouseEvent)
, m_captured(captured)
{
}
@@ -228,6 +229,7 @@ namespace AzToolsFramework
MouseInteraction m_mouseInteraction; //!< Mouse state.
MouseEvent m_mouseEvent; //!< Mouse event.
bool m_captured = false; //!< Is the mouse cursor being captured during the event.
//! Special friend function to return the mouse wheel delta (scroll amount)
//! if the event was of type MouseEvent::Wheel.
@@ -65,7 +65,8 @@ namespace UnitTest
AzToolsFramework::AssetSeedManager assetSeedManager;
AzFramework::AssetRegistry assetRegistry;
const AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(AzFramework::PlatformId::PC);
const AZ::PlatformId thisPlatform = AZ::PlatformHelper::GetPlatformIdFromName(AZ::OSPlatformToDefaultAssetPlatform(AZ_TRAIT_OS_PLATFORM_CODENAME));
const AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(thisPlatform);
for (int idx = 0; idx < TotalAssets; idx++)
{
@@ -113,17 +114,18 @@ namespace UnitTest
// Currently I am serializing the asset registry to disk
// and invoking the LoadCatalog API to populate the asset catalog created by the azframework app.
AZStd::string pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
const AZStd::string catalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(thisPlatform);
bool catalogSaved = AzFramework::AssetCatalog::SaveCatalog(pcCatalogFile.c_str(), &assetRegistry);
bool catalogSaved = AzFramework::AssetCatalog::SaveCatalog(catalogFile.c_str(), &assetRegistry);
EXPECT_TRUE(catalogSaved) << "Unable to save the asset catalog file.\n";
m_pcCatalog = new AzToolsFramework::PlatformAddressedAssetCatalog(AzFramework::PlatformId::PC);
m_catalog = new AzToolsFramework::PlatformAddressedAssetCatalog(thisPlatform);
assetSeedManager.AddSeedAsset(m_assets[0], AzFramework::PlatformFlags::Platform_PC);
assetSeedManager.AddSeedAsset(m_assets[1], AzFramework::PlatformFlags::Platform_PC);
const auto thisPlatformFlags = AZ::PlatformHelper::GetPlatformFlag(AZ::OSPlatformToDefaultAssetPlatform(AZ_TRAIT_OS_PLATFORM_CODENAME));
assetSeedManager.AddSeedAsset(m_assets[0], thisPlatformFlags);
assetSeedManager.AddSeedAsset(m_assets[1], thisPlatformFlags);
bool firstAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::FirstAssetFileInfoList], AzFramework::PlatformFlags::Platform_PC, {});
bool firstAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::FirstAssetFileInfoList], thisPlatformFlags, {});
EXPECT_TRUE(firstAssetFileInfoListSaved);
// Modify contents of asset2
@@ -156,10 +158,10 @@ namespace UnitTest
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to open asset file.\n").c_str());
}
assetSeedManager.RemoveSeedAsset(m_assets[0], AzFramework::PlatformFlags::Platform_PC);
assetSeedManager.AddSeedAsset(m_assets[5], AzFramework::PlatformFlags::Platform_PC);
assetSeedManager.RemoveSeedAsset(m_assets[0], thisPlatformFlags);
assetSeedManager.AddSeedAsset(m_assets[5], thisPlatformFlags);
bool secondAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::SecondAssetFileInfoList], AzFramework::PlatformFlags::Platform_PC, {});
bool secondAssetFileInfoListSaved = assetSeedManager.SaveAssetFileInfo(TempFiles[FileIndex::SecondAssetFileInfoList], thisPlatformFlags, {});
EXPECT_TRUE(secondAssetFileInfoListSaved);
}
@@ -202,7 +204,7 @@ namespace UnitTest
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
}
delete m_pcCatalog;
delete m_catalog;
m_application->Stop();
delete m_application;
@@ -754,7 +756,7 @@ namespace UnitTest
ToolsTestApplication* m_application = nullptr;
UnitTest::ScopedTemporaryDirectory m_tempDir;
AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog = nullptr;
AzToolsFramework::PlatformAddressedAssetCatalog* m_catalog = nullptr;
AZ::IO::FileIOStream m_fileStreams[TotalAssets];
AZ::Data::AssetId m_assets[TotalAssets];
AZStd::string m_assetsPath[TotalAssets];
@@ -1117,7 +1117,6 @@ namespace UnitTest
const char* GetAppRoot() const override { return nullptr; }
const char* GetEngineRoot() const override { return nullptr; }
const char* GetExecutableFolder() const override { return nullptr; }
Debug::DrillerManager* GetDrillerManager() override { return nullptr; }
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {}
//////////////////////////////////////////////////////////////////////////