Merge branch 'development' of https://github.com/o3de/o3de into carlitosan/development

monroegm-disable-blank-issue-2
chcurran 4 years ago
commit a244d429c4

@ -0,0 +1,7 @@
<svg width="24" height="33" viewBox="0 0 24 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5" y="7" width="2" height="12" fill="#808080"/>
<rect x="5" y="19" width="2" height="14" fill="#808080"/>
<rect x="17" y="16" width="2" height="12" transform="rotate(90 17 16)" fill="#808080"/>
<circle cx="6" cy="6" r="2" fill="#808080"/>
<circle cx="18" cy="17" r="2" fill="#808080"/>
</svg>

After

Width:  |  Height:  |  Size: 398 B

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5" width="2" height="12" fill="grey"/>
<rect x="17" y="12" width="2" height="12" transform="rotate(90 17 12)" fill="grey"/>
<circle cx="18" cy="13" r="2" fill="grey"/>
</svg>

After

Width:  |  Height:  |  Size: 280 B

@ -0,0 +1,6 @@
<svg width="24" height="26" viewBox="0 0 24 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5" width="2" height="12" fill="grey"/>
<rect x="5" y="14" width="2" height="12" fill="grey"/>
<rect x="17" y="12" width="2" height="12" transform="rotate(90 17 12)" fill="grey"/>
<circle cx="18" cy="13" r="2" fill="grey"/>
</svg>

After

Width:  |  Height:  |  Size: 335 B

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5" y="7" width="2" height="7" fill="#808080"/>
<rect x="17" y="12" width="2" height="12" transform="rotate(90 17 12)" fill="#808080"/>
<circle cx="6" cy="6" r="2" fill="#808080"/>
<circle cx="18" cy="13" r="2" fill="#808080"/>
</svg>

After

Width:  |  Height:  |  Size: 339 B

@ -8098,7 +8098,7 @@
</message> </message>
<message id="COLOR_FROMVALUES_PARAM0_TOOLTIP"> <message id="COLOR_FROMVALUES_PARAM0_TOOLTIP">
<source>COLOR_FROMVALUES_PARAM0_TOOLTIP</source> <source>COLOR_FROMVALUES_PARAM0_TOOLTIP</source>
<translation type="unfinished">The Red value of hte Color [0, 255]</translation> <translation type="unfinished">The Red value of the Color [0.0-1.0]</translation>
</message> </message>
<message id="COLOR_FROMVALUES_PARAM1_NAME"> <message id="COLOR_FROMVALUES_PARAM1_NAME">
<source>COLOR_FROMVALUES_PARAM1_NAME</source> <source>COLOR_FROMVALUES_PARAM1_NAME</source>
@ -8107,7 +8107,7 @@
</message> </message>
<message id="COLOR_FROMVALUES_PARAM1_TOOLTIP"> <message id="COLOR_FROMVALUES_PARAM1_TOOLTIP">
<source>COLOR_FROMVALUES_PARAM1_TOOLTIP</source> <source>COLOR_FROMVALUES_PARAM1_TOOLTIP</source>
<translation type="unfinished">The Green value of the Color [0, 255]</translation> <translation type="unfinished">The Green value of the Color [0.0-1.0]</translation>
</message> </message>
<message id="COLOR_FROMVALUES_PARAM2_NAME"> <message id="COLOR_FROMVALUES_PARAM2_NAME">
<source>COLOR_FROMVALUES_PARAM2_NAME</source> <source>COLOR_FROMVALUES_PARAM2_NAME</source>
@ -8116,7 +8116,7 @@
</message> </message>
<message id="COLOR_FROMVALUES_PARAM2_TOOLTIP"> <message id="COLOR_FROMVALUES_PARAM2_TOOLTIP">
<source>COLOR_FROMVALUES_PARAM2_TOOLTIP</source> <source>COLOR_FROMVALUES_PARAM2_TOOLTIP</source>
<translation type="unfinished">The Blue value of the Color [0, 255]</translation> <translation type="unfinished">The Blue value of the Color [0.0-1.0]</translation>
</message> </message>
<message id="COLOR_FROMVALUES_PARAM3_NAME"> <message id="COLOR_FROMVALUES_PARAM3_NAME">
<source>COLOR_FROMVALUES_PARAM3_NAME</source> <source>COLOR_FROMVALUES_PARAM3_NAME</source>
@ -8125,7 +8125,7 @@
</message> </message>
<message id="COLOR_FROMVALUES_PARAM3_TOOLTIP"> <message id="COLOR_FROMVALUES_PARAM3_TOOLTIP">
<source>COLOR_FROMVALUES_PARAM3_TOOLTIP</source> <source>COLOR_FROMVALUES_PARAM3_TOOLTIP</source>
<translation type="unfinished">The Alpha value of the Color [0, 255]</translation> <translation type="unfinished">The Alpha value of the Color [0.0-1.0]</translation>
</message> </message>
</context> </context>
<context> <context>

@ -17,5 +17,14 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
AZ::AssetProcessorBatch AZ::AssetProcessorBatch
AZ::AssetProcessor AZ::AssetProcessor
) )
ly_add_pytest(
NAME AssetPipelineTests.Fbx_Tests
PATH ${CMAKE_CURRENT_LIST_DIR}/fbx_test/fbx_test.py
TEST_SUITE sandbox
RUNTIME_DEPENDENCIES
AZ::AssetProcessorBatch
AZ::AssetProcessor
)
endif() endif()

@ -34,11 +34,13 @@ logger = logging.getLogger(__name__)
targetProjects = ["AutomatedTesting"] targetProjects = ["AutomatedTesting"]
@pytest.fixture @pytest.fixture
@pytest.mark.SUITE_sandbox
def local_resources(request, workspace, ap_setup_fixture): def local_resources(request, workspace, ap_setup_fixture):
ap_setup_fixture["tests_dir"] = os.path.dirname(os.path.realpath(__file__)) ap_setup_fixture["tests_dir"] = os.path.dirname(os.path.realpath(__file__))
@dataclass @dataclass
@pytest.mark.SUITE_sandbox
class BlackboxAssetTest: class BlackboxAssetTest:
test_name: str test_name: str
asset_folder: str asset_folder: str
@ -338,9 +340,11 @@ blackbox_fbx_special_tests = [
@pytest.mark.usefixtures("local_resources") @pytest.mark.usefixtures("local_resources")
@pytest.mark.parametrize("project", targetProjects) @pytest.mark.parametrize("project", targetProjects)
@pytest.mark.assetpipeline @pytest.mark.assetpipeline
@pytest.mark.SUITE_sandbox
class TestsFBX_AllPlatforms(object): class TestsFBX_AllPlatforms(object):
@pytest.mark.BAT @pytest.mark.BAT
@pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("blackbox_param", blackbox_fbx_tests) @pytest.mark.parametrize("blackbox_param", blackbox_fbx_tests)
def test_FBXBlackboxTest_SourceFiles_Processed_ResultInExpectedProducts(self, workspace, def test_FBXBlackboxTest_SourceFiles_Processed_ResultInExpectedProducts(self, workspace,
ap_setup_fixture, asset_processor, project, ap_setup_fixture, asset_processor, project,
@ -359,6 +363,7 @@ class TestsFBX_AllPlatforms(object):
asset_processor, project, blackbox_param) asset_processor, project, blackbox_param)
@pytest.mark.BAT @pytest.mark.BAT
@pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("blackbox_param", blackbox_fbx_special_tests) @pytest.mark.parametrize("blackbox_param", blackbox_fbx_special_tests)
def test_FBXBlackboxTest_AssetInfoModified_AssetReprocessed_ResultInExpectedProducts(self, def test_FBXBlackboxTest_AssetInfoModified_AssetReprocessed_ResultInExpectedProducts(self,
workspace, ap_setup_fixture, workspace, ap_setup_fixture,

@ -7,7 +7,6 @@
*/ */
#pragma once #pragma once
#include <AzCore/Serialization/SerializeContext.h>
#include <AzToolsFramework/AssetEditor/AssetEditorBus.h> #include <AzToolsFramework/AssetEditor/AssetEditorBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h> #include <AzToolsFramework/API/ToolsApplicationAPI.h>

@ -9,7 +9,6 @@
#if !defined(Q_MOC_RUN) #if !defined(Q_MOC_RUN)
#include <AzCore/Asset/AssetCommon.h> #include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/UserSettings/UserSettings.h> #include <AzCore/UserSettings/UserSettings.h>
#include <AzToolsFramework/AssetEditor/AssetEditorBus.h> #include <AzToolsFramework/AssetEditor/AssetEditorBus.h>
#include <QWidget> #include <QWidget>

@ -141,6 +141,10 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_ui->m_assetBrowserTreeViewWidget, &AzAssetBrowser::AssetBrowserTreeView::ClearTypeFilter, m_ui->m_searchWidget, m_ui->m_assetBrowserTreeViewWidget, &AzAssetBrowser::AssetBrowserTreeView::ClearTypeFilter, m_ui->m_searchWidget,
&AzAssetBrowser::SearchWidget::ClearTypeFilter); &AzAssetBrowser::SearchWidget::ClearTypeFilter);
connect(
this, &AzAssetBrowserWindow::SizeChangedSignal, m_ui->m_assetBrowserTableViewWidget,
&AzAssetBrowser::AssetBrowserTableView::UpdateSizeSlot);
m_ui->m_assetBrowserTreeViewWidget->SetName("AssetBrowserTreeView_main"); m_ui->m_assetBrowserTreeViewWidget->SetName("AssetBrowserTreeView_main");
} }
@ -164,6 +168,25 @@ QObject* AzAssetBrowserWindow::createListenerForShowAssetEditorEvent(QObject* pa
return listener; return listener;
} }
void AzAssetBrowserWindow::resizeEvent(QResizeEvent* resizeEvent)
{
// leftLayout is the parent of the tableView
// rightLayout is the parent of the preview window.
// Workaround: When docking windows this event keeps holding the old size of the widgets instead of the new one
// but the resizeEvent holds the new size of the whole widget
// So we have to save the proportions somehow
const QWidget* leftLayout = m_ui->m_leftLayout;
const QVBoxLayout* rightLayout = m_ui->m_rightLayout;
const float oldLeftLayoutWidth = aznumeric_cast<float>(leftLayout->geometry().width());
const float oldWidth = aznumeric_cast<float>(leftLayout->geometry().width() + rightLayout->geometry().width());
const float newWidth = oldLeftLayoutWidth * aznumeric_cast<float>(resizeEvent->size().width()) / oldWidth;
emit SizeChangedSignal(aznumeric_cast<int>(newWidth));
QWidget::resizeEvent(resizeEvent);
}
void AzAssetBrowserWindow::OnInitViewToggleButton() void AzAssetBrowserWindow::OnInitViewToggleButton()
{ {
CreateSwitchViewMenu(); CreateSwitchViewMenu();

@ -53,9 +53,17 @@ public:
static QObject* createListenerForShowAssetEditorEvent(QObject* parent); static QObject* createListenerForShowAssetEditorEvent(QObject* parent);
Q_SIGNALS:
void SizeChangedSignal(int newWidth);
protected:
void resizeEvent(QResizeEvent* resizeEvent) override;
private: private:
void OnInitViewToggleButton(); void OnInitViewToggleButton();
void UpdateDisplayInfo(); void UpdateDisplayInfo();
protected slots: protected slots:
void CreateSwitchViewMenu(); void CreateSwitchViewMenu();
void SetExpandedAssetBrowserMode(); void SetExpandedAssetBrowserMode();

@ -26,6 +26,9 @@
#include <AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.hxx> #include <AzToolsFramework/UI/SearchWidget/SearchCriteriaWidget.hxx>
#include <AzToolsFramework/Editor/EditorSettingsAPIBus.h> #include <AzToolsFramework/Editor/EditorSettingsAPIBus.h>
//AzCore
#include <AzCore/Component/ComponentApplicationBus.h>
// Editor // Editor
#include "Clipboard.h" #include "Clipboard.h"

@ -12,7 +12,6 @@
#if !defined(Q_MOC_RUN) #if !defined(Q_MOC_RUN)
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h> #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/smart_ptr/unique_ptr.h> #include <AzCore/std/smart_ptr/unique_ptr.h>
#include "Include/EditorCoreAPI.h" #include "Include/EditorCoreAPI.h"
#include "ReflectedPropertyItem.h" #include "ReflectedPropertyItem.h"

@ -10,10 +10,10 @@
#define CRYINCLUDE_EDITOR_UTILS_REFLECTEDVAR_H #define CRYINCLUDE_EDITOR_UTILS_REFLECTEDVAR_H
#pragma once #pragma once
#include <AzCore/Serialization/SerializeContext.h>
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include "Util/VariablePropertyType.h" #include "Util/VariablePropertyType.h"
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Math/Vector2.h> #include <AzCore/Math/Vector2.h>
#include <AzCore/Math/Vector3.h> #include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Vector4.h> #include <AzCore/Math/Vector4.h>

@ -44,7 +44,7 @@ enum
{ {
// in milliseconds // in milliseconds
GameModeIdleFrequency = 0, GameModeIdleFrequency = 0,
EditorModeIdleFrequency = 0, EditorModeIdleFrequency = 1,
InactiveModeFrequency = 10, InactiveModeFrequency = 10,
UninitializedFrequency = 9999, UninitializedFrequency = 9999,
}; };

@ -9,7 +9,7 @@
#include "QtEditorApplication.h" #include "QtEditorApplication.h"
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB #ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
#include <AzFramework/API/ApplicationAPI_Linux.h> #include <AzFramework/XcbEventHandler.h>
#endif #endif
namespace Editor namespace Editor
@ -19,7 +19,7 @@ namespace Editor
if (GetIEditor()->IsInGameMode()) if (GetIEditor()->IsInGameMode())
{ {
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB #ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
AzFramework::LinuxXcbEventHandlerBus::Broadcast(&AzFramework::LinuxXcbEventHandler::HandleXcbEvent, static_cast<xcb_generic_event_t*>(message)); AzFramework::XcbEventHandlerBus::Broadcast(&AzFramework::XcbEventHandler::HandleXcbEvent, static_cast<xcb_generic_event_t*>(message));
#endif #endif
return true; return true;
} }

@ -13,6 +13,7 @@
#include <AzCore/std/smart_ptr/make_shared.h> #include <AzCore/std/smart_ptr/make_shared.h>
#include <AzFramework/Render/IntersectorInterface.h> #include <AzFramework/Render/IntersectorInterface.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h> #include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
#include <EditorViewportSettings.h> #include <EditorViewportSettings.h>
namespace SandboxEditor namespace SandboxEditor
@ -94,7 +95,7 @@ namespace SandboxEditor
cameras.AddCamera(m_firstPersonPanCamera); cameras.AddCamera(m_firstPersonPanCamera);
cameras.AddCamera(m_firstPersonTranslateCamera); cameras.AddCamera(m_firstPersonTranslateCamera);
cameras.AddCamera(m_firstPersonScrollCamera); cameras.AddCamera(m_firstPersonScrollCamera);
cameras.AddCamera(m_orbitCamera); cameras.AddCamera(m_pivotCamera);
}); });
return controller; return controller;
@ -131,8 +132,8 @@ namespace SandboxEditor
m_firstPersonRotateCamera->SetActivationBeganFn(hideCursor); m_firstPersonRotateCamera->SetActivationBeganFn(hideCursor);
m_firstPersonRotateCamera->SetActivationEndedFn(showCursor); m_firstPersonRotateCamera->SetActivationEndedFn(showCursor);
m_firstPersonPanCamera = m_firstPersonPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(
AZStd::make_shared<AzFramework::PanCameraInput>(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan); SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan, AzFramework::TranslatePivot);
m_firstPersonPanCamera->m_panSpeedFn = [] m_firstPersonPanCamera->m_panSpeedFn = []
{ {
@ -151,8 +152,8 @@ namespace SandboxEditor
const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds(); const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds();
m_firstPersonTranslateCamera = m_firstPersonTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(
AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation, translateCameraInputChannelIds); translateCameraInputChannelIds, AzFramework::LookTranslation, AzFramework::TranslatePivot);
m_firstPersonTranslateCamera->m_translateSpeedFn = [] m_firstPersonTranslateCamera->m_translateSpeedFn = []
{ {
@ -171,120 +172,97 @@ namespace SandboxEditor
return SandboxEditor::CameraScrollSpeed(); return SandboxEditor::CameraScrollSpeed();
}; };
m_orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>(SandboxEditor::CameraOrbitChannelId()); m_pivotCamera = AZStd::make_shared<AzFramework::PivotCameraInput>(SandboxEditor::CameraPivotChannelId());
m_orbitCamera->SetLookAtFn( m_pivotCamera->SetPivotFn(
[viewportId = m_viewportId](const AZ::Vector3& position, const AZ::Vector3& direction) -> AZStd::optional<AZ::Vector3> []([[maybe_unused]] const AZ::Vector3& position, [[maybe_unused]] const AZ::Vector3& direction)
{ {
AZStd::optional<AZ::Vector3> lookAtAfterInterpolation; // use the manipulator transform as the pivot point
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult( AZStd::optional<AZ::Transform> entityPivot;
lookAtAfterInterpolation, viewportId, AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::LookAtAfterInterpolation); entityPivot, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequestBus::Events::GetManipulatorTransform);
// initially attempt to use the last set look at point after an interpolation has finished
if (lookAtAfterInterpolation.has_value()) // otherwise just use the identity
{ return entityPivot.value_or(AZ::Transform::CreateIdentity()).GetTranslation();
return *lookAtAfterInterpolation;
}
const float RayDistance = 1000.0f;
AzFramework::RenderGeometry::RayRequest ray;
ray.m_startWorldPosition = position;
ray.m_endWorldPosition = position + direction * RayDistance;
ray.m_onlyVisible = true;
AzFramework::RenderGeometry::RayResult renderGeometryIntersectionResult;
AzFramework::RenderGeometry::IntersectorBus::EventResult(
renderGeometryIntersectionResult, AzToolsFramework::GetEntityContextId(),
&AzFramework::RenderGeometry::IntersectorBus::Events::RayIntersect, ray);
// attempt a ray intersection with any visible mesh and return the intersection position if successful
if (renderGeometryIntersectionResult)
{
return renderGeometryIntersectionResult.m_worldPosition;
}
// if there is no selection or no intersection, fallback to default camera orbit behavior (ground plane
// intersection)
return {};
}); });
m_orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraOrbitLookChannelId()); m_pivotRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraPivotLookChannelId());
m_orbitRotateCamera->m_rotateSpeedFn = [] m_pivotRotateCamera->m_rotateSpeedFn = []
{ {
return SandboxEditor::CameraRotateSpeed(); return SandboxEditor::CameraRotateSpeed();
}; };
m_orbitRotateCamera->m_invertYawFn = [] m_pivotRotateCamera->m_invertYawFn = []
{ {
return SandboxEditor::CameraOrbitYawRotationInverted(); return SandboxEditor::CameraPivotYawRotationInverted();
}; };
m_orbitTranslateCamera = m_pivotTranslateCamera = AZStd::make_shared<AzFramework::TranslateCameraInput>(
AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation, translateCameraInputChannelIds); translateCameraInputChannelIds, AzFramework::LookTranslation, AzFramework::TranslateOffset);
m_orbitTranslateCamera->m_translateSpeedFn = [] m_pivotTranslateCamera->m_translateSpeedFn = []
{ {
return SandboxEditor::CameraTranslateSpeed(); return SandboxEditor::CameraTranslateSpeed();
}; };
m_orbitTranslateCamera->m_boostMultiplierFn = [] m_pivotTranslateCamera->m_boostMultiplierFn = []
{ {
return SandboxEditor::CameraBoostMultiplier(); return SandboxEditor::CameraBoostMultiplier();
}; };
m_orbitDollyScrollCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>(); m_pivotDollyScrollCamera = AZStd::make_shared<AzFramework::PivotDollyScrollCameraInput>();
m_orbitDollyScrollCamera->m_scrollSpeedFn = [] m_pivotDollyScrollCamera->m_scrollSpeedFn = []
{ {
return SandboxEditor::CameraScrollSpeed(); return SandboxEditor::CameraScrollSpeed();
}; };
m_orbitDollyMoveCamera = m_pivotDollyMoveCamera = AZStd::make_shared<AzFramework::PivotDollyMotionCameraInput>(SandboxEditor::CameraPivotDollyChannelId());
AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>(SandboxEditor::CameraOrbitDollyChannelId());
m_orbitDollyMoveCamera->m_cursorSpeedFn = [] m_pivotDollyMoveCamera->m_motionSpeedFn = []
{ {
return SandboxEditor::CameraDollyMotionSpeed(); return SandboxEditor::CameraDollyMotionSpeed();
}; };
m_orbitPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(SandboxEditor::CameraOrbitPanChannelId(), AzFramework::OrbitPan); m_pivotPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(
SandboxEditor::CameraPivotPanChannelId(), AzFramework::LookPan, AzFramework::TranslateOffset);
m_orbitPanCamera->m_panSpeedFn = [] m_pivotPanCamera->m_panSpeedFn = []
{ {
return SandboxEditor::CameraPanSpeed(); return SandboxEditor::CameraPanSpeed();
}; };
m_orbitPanCamera->m_invertPanXFn = [] m_pivotPanCamera->m_invertPanXFn = []
{ {
return SandboxEditor::CameraPanInvertedX(); return SandboxEditor::CameraPanInvertedX();
}; };
m_orbitPanCamera->m_invertPanYFn = [] m_pivotPanCamera->m_invertPanYFn = []
{ {
return SandboxEditor::CameraPanInvertedY(); return SandboxEditor::CameraPanInvertedY();
}; };
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitRotateCamera); m_pivotCamera->m_pivotCameras.AddCamera(m_pivotRotateCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitTranslateCamera); m_pivotCamera->m_pivotCameras.AddCamera(m_pivotTranslateCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyScrollCamera); m_pivotCamera->m_pivotCameras.AddCamera(m_pivotDollyScrollCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyMoveCamera); m_pivotCamera->m_pivotCameras.AddCamera(m_pivotDollyMoveCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitPanCamera); m_pivotCamera->m_pivotCameras.AddCamera(m_pivotPanCamera);
} }
void EditorModularViewportCameraComposer::OnEditorModularViewportCameraComposerSettingsChanged() void EditorModularViewportCameraComposer::OnEditorModularViewportCameraComposerSettingsChanged()
{ {
const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds(); const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds();
m_firstPersonTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds); m_firstPersonTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
m_orbitTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
m_firstPersonPanCamera->SetPanInputChannelId(SandboxEditor::CameraFreePanChannelId()); m_firstPersonPanCamera->SetPanInputChannelId(SandboxEditor::CameraFreePanChannelId());
m_orbitPanCamera->SetPanInputChannelId(SandboxEditor::CameraOrbitPanChannelId());
m_firstPersonRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraFreeLookChannelId()); m_firstPersonRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraFreeLookChannelId());
m_orbitRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraOrbitLookChannelId());
m_orbitCamera->SetOrbitInputChannelId(SandboxEditor::CameraOrbitChannelId()); m_pivotCamera->SetPivotInputChannelId(SandboxEditor::CameraPivotChannelId());
m_orbitDollyMoveCamera->SetDollyInputChannelId(SandboxEditor::CameraOrbitDollyChannelId()); m_pivotTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
m_pivotPanCamera->SetPanInputChannelId(SandboxEditor::CameraPivotPanChannelId());
m_pivotRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraPivotLookChannelId());
m_pivotDollyMoveCamera->SetDollyInputChannelId(SandboxEditor::CameraPivotDollyChannelId());
} }
void EditorModularViewportCameraComposer::OnViewportViewEntityChanged(const AZ::EntityId& viewEntityId) void EditorModularViewportCameraComposer::OnViewportViewEntityChanged(const AZ::EntityId& viewEntityId)
@ -295,8 +273,7 @@ namespace SandboxEditor
AZ::TransformBus::EventResult(worldFromLocal, viewEntityId, &AZ::TransformBus::Events::GetWorldTM); AZ::TransformBus::EventResult(worldFromLocal, viewEntityId, &AZ::TransformBus::Events::GetWorldTM);
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event( AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, worldFromLocal);
worldFromLocal);
} }
else else
{ {

@ -42,12 +42,12 @@ namespace SandboxEditor
AZStd::shared_ptr<AzFramework::PanCameraInput> m_firstPersonPanCamera; AZStd::shared_ptr<AzFramework::PanCameraInput> m_firstPersonPanCamera;
AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_firstPersonTranslateCamera; AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_firstPersonTranslateCamera;
AZStd::shared_ptr<AzFramework::ScrollTranslationCameraInput> m_firstPersonScrollCamera; AZStd::shared_ptr<AzFramework::ScrollTranslationCameraInput> m_firstPersonScrollCamera;
AZStd::shared_ptr<AzFramework::OrbitCameraInput> m_orbitCamera; AZStd::shared_ptr<AzFramework::PivotCameraInput> m_pivotCamera;
AZStd::shared_ptr<AzFramework::RotateCameraInput> m_orbitRotateCamera; AZStd::shared_ptr<AzFramework::RotateCameraInput> m_pivotRotateCamera;
AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_orbitTranslateCamera; AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_pivotTranslateCamera;
AZStd::shared_ptr<AzFramework::OrbitDollyScrollCameraInput> m_orbitDollyScrollCamera; AZStd::shared_ptr<AzFramework::PivotDollyScrollCameraInput> m_pivotDollyScrollCamera;
AZStd::shared_ptr<AzFramework::OrbitDollyCursorMoveCameraInput> m_orbitDollyMoveCamera; AZStd::shared_ptr<AzFramework::PivotDollyMotionCameraInput> m_pivotDollyMoveCamera;
AZStd::shared_ptr<AzFramework::PanCameraInput> m_orbitPanCamera; AZStd::shared_ptr<AzFramework::PanCameraInput> m_pivotPanCamera;
AzFramework::ViewportId m_viewportId; AzFramework::ViewportId m_viewportId;
}; };

@ -61,7 +61,7 @@ static AZStd::vector<AZStd::string> GetEditorInputNames()
void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serialize) void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serialize)
{ {
serialize.Class<CameraMovementSettings>() serialize.Class<CameraMovementSettings>()
->Version(2) ->Version(3)
->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed) ->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed)
->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed) ->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed)
->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier) ->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier)
@ -73,12 +73,12 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Field("TranslateSmoothing", &CameraMovementSettings::m_translateSmoothing) ->Field("TranslateSmoothing", &CameraMovementSettings::m_translateSmoothing)
->Field("TranslateSmoothness", &CameraMovementSettings::m_translateSmoothness) ->Field("TranslateSmoothness", &CameraMovementSettings::m_translateSmoothness)
->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook) ->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook)
->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted) ->Field("PivotYawRotationInverted", &CameraMovementSettings::m_pivotYawRotationInverted)
->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX) ->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX)
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY); ->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY);
serialize.Class<CameraInputSettings>() serialize.Class<CameraInputSettings>()
->Version(1) ->Version(2)
->Field("TranslateForward", &CameraInputSettings::m_translateForwardChannelId) ->Field("TranslateForward", &CameraInputSettings::m_translateForwardChannelId)
->Field("TranslateBackward", &CameraInputSettings::m_translateBackwardChannelId) ->Field("TranslateBackward", &CameraInputSettings::m_translateBackwardChannelId)
->Field("TranslateLeft", &CameraInputSettings::m_translateLeftChannelId) ->Field("TranslateLeft", &CameraInputSettings::m_translateLeftChannelId)
@ -86,12 +86,12 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Field("TranslateUp", &CameraInputSettings::m_translateUpChannelId) ->Field("TranslateUp", &CameraInputSettings::m_translateUpChannelId)
->Field("TranslateDown", &CameraInputSettings::m_translateDownChannelId) ->Field("TranslateDown", &CameraInputSettings::m_translateDownChannelId)
->Field("Boost", &CameraInputSettings::m_boostChannelId) ->Field("Boost", &CameraInputSettings::m_boostChannelId)
->Field("Orbit", &CameraInputSettings::m_orbitChannelId) ->Field("Pivot", &CameraInputSettings::m_pivotChannelId)
->Field("FreeLook", &CameraInputSettings::m_freeLookChannelId) ->Field("FreeLook", &CameraInputSettings::m_freeLookChannelId)
->Field("FreePan", &CameraInputSettings::m_freePanChannelId) ->Field("FreePan", &CameraInputSettings::m_freePanChannelId)
->Field("OrbitLook", &CameraInputSettings::m_orbitLookChannelId) ->Field("PivotLook", &CameraInputSettings::m_pivotLookChannelId)
->Field("OrbitDolly", &CameraInputSettings::m_orbitDollyChannelId) ->Field("PivotDolly", &CameraInputSettings::m_pivotDollyChannelId)
->Field("OrbitPan", &CameraInputSettings::m_orbitPanChannelId); ->Field("PivotPan", &CameraInputSettings::m_pivotPanChannelId);
serialize.Class<CEditorPreferencesPage_ViewportCamera>() serialize.Class<CEditorPreferencesPage_ViewportCamera>()
->Version(1) ->Version(1)
@ -143,8 +143,8 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Attribute(AZ::Edit::Attributes::Min, minValue) ->Attribute(AZ::Edit::Attributes::Min, minValue)
->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::TranslateSmoothingVisibility) ->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::TranslateSmoothingVisibility)
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_orbitYawRotationInverted, "Camera Orbit Yaw Inverted", AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_pivotYawRotationInverted, "Camera Pivot Yaw Inverted",
"Inverted yaw rotation while orbiting") "Inverted yaw rotation while pivoting")
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedX, "Invert Pan X", AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedX, "Invert Pan X",
"Invert direction of pan in local X axis") "Invert direction of pan in local X axis")
@ -185,8 +185,8 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
"Key/button to move the camera more quickly") "Key/button to move the camera more quickly")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitChannelId, "Orbit", AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotChannelId, "Pivot",
"Key/button to begin the camera orbit behavior") "Key/button to begin the camera pivot behavior")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freeLookChannelId, "Free Look", AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freeLookChannelId, "Free Look",
@ -196,16 +196,16 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freePanChannelId, "Free Pan", "Key/button to begin camera free pan") AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freePanChannelId, "Free Pan", "Key/button to begin camera free pan")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitLookChannelId, "Orbit Look", AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotLookChannelId, "Pivot Look",
"Key/button to begin camera orbit look") "Key/button to begin camera pivot look")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitDollyChannelId, "Orbit Dolly", AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotDollyChannelId, "Pivot Dolly",
"Key/button to begin camera orbit dolly") "Key/button to begin camera pivot dolly")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement( ->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitPanChannelId, "Orbit Pan", AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotPanChannelId, "Pivot Pan",
"Key/button to begin camera orbit pan") "Key/button to begin camera pivot pan")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames); ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames);
editContext->Class<CEditorPreferencesPage_ViewportCamera>("Viewport Preferences", "Viewport Preferences") editContext->Class<CEditorPreferencesPage_ViewportCamera>("Viewport Preferences", "Viewport Preferences")
@ -264,7 +264,7 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
SandboxEditor::SetCameraTranslateSmoothness(m_cameraMovementSettings.m_translateSmoothness); SandboxEditor::SetCameraTranslateSmoothness(m_cameraMovementSettings.m_translateSmoothness);
SandboxEditor::SetCameraTranslateSmoothingEnabled(m_cameraMovementSettings.m_translateSmoothing); SandboxEditor::SetCameraTranslateSmoothingEnabled(m_cameraMovementSettings.m_translateSmoothing);
SandboxEditor::SetCameraCaptureCursorForLook(m_cameraMovementSettings.m_captureCursorLook); SandboxEditor::SetCameraCaptureCursorForLook(m_cameraMovementSettings.m_captureCursorLook);
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted); SandboxEditor::SetCameraPivotYawRotationInverted(m_cameraMovementSettings.m_pivotYawRotationInverted);
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX); SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX);
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY); SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY);
@ -275,12 +275,12 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
SandboxEditor::SetCameraTranslateUpChannelId(m_cameraInputSettings.m_translateUpChannelId); SandboxEditor::SetCameraTranslateUpChannelId(m_cameraInputSettings.m_translateUpChannelId);
SandboxEditor::SetCameraTranslateDownChannelId(m_cameraInputSettings.m_translateDownChannelId); SandboxEditor::SetCameraTranslateDownChannelId(m_cameraInputSettings.m_translateDownChannelId);
SandboxEditor::SetCameraTranslateBoostChannelId(m_cameraInputSettings.m_boostChannelId); SandboxEditor::SetCameraTranslateBoostChannelId(m_cameraInputSettings.m_boostChannelId);
SandboxEditor::SetCameraOrbitChannelId(m_cameraInputSettings.m_orbitChannelId); SandboxEditor::SetCameraPivotChannelId(m_cameraInputSettings.m_pivotChannelId);
SandboxEditor::SetCameraFreeLookChannelId(m_cameraInputSettings.m_freeLookChannelId); SandboxEditor::SetCameraFreeLookChannelId(m_cameraInputSettings.m_freeLookChannelId);
SandboxEditor::SetCameraFreePanChannelId(m_cameraInputSettings.m_freePanChannelId); SandboxEditor::SetCameraFreePanChannelId(m_cameraInputSettings.m_freePanChannelId);
SandboxEditor::SetCameraOrbitLookChannelId(m_cameraInputSettings.m_orbitLookChannelId); SandboxEditor::SetCameraPivotLookChannelId(m_cameraInputSettings.m_pivotLookChannelId);
SandboxEditor::SetCameraOrbitDollyChannelId(m_cameraInputSettings.m_orbitDollyChannelId); SandboxEditor::SetCameraPivotDollyChannelId(m_cameraInputSettings.m_pivotDollyChannelId);
SandboxEditor::SetCameraOrbitPanChannelId(m_cameraInputSettings.m_orbitPanChannelId); SandboxEditor::SetCameraPivotPanChannelId(m_cameraInputSettings.m_pivotPanChannelId);
SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Broadcast( SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Broadcast(
&SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Events::OnEditorModularViewportCameraComposerSettingsChanged); &SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Events::OnEditorModularViewportCameraComposerSettingsChanged);
@ -299,7 +299,7 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
m_cameraMovementSettings.m_translateSmoothness = SandboxEditor::CameraTranslateSmoothness(); m_cameraMovementSettings.m_translateSmoothness = SandboxEditor::CameraTranslateSmoothness();
m_cameraMovementSettings.m_translateSmoothing = SandboxEditor::CameraTranslateSmoothingEnabled(); m_cameraMovementSettings.m_translateSmoothing = SandboxEditor::CameraTranslateSmoothingEnabled();
m_cameraMovementSettings.m_captureCursorLook = SandboxEditor::CameraCaptureCursorForLook(); m_cameraMovementSettings.m_captureCursorLook = SandboxEditor::CameraCaptureCursorForLook();
m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted(); m_cameraMovementSettings.m_pivotYawRotationInverted = SandboxEditor::CameraPivotYawRotationInverted();
m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX(); m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX();
m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY(); m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY();
@ -310,10 +310,10 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
m_cameraInputSettings.m_translateUpChannelId = SandboxEditor::CameraTranslateUpChannelId().GetName(); m_cameraInputSettings.m_translateUpChannelId = SandboxEditor::CameraTranslateUpChannelId().GetName();
m_cameraInputSettings.m_translateDownChannelId = SandboxEditor::CameraTranslateDownChannelId().GetName(); m_cameraInputSettings.m_translateDownChannelId = SandboxEditor::CameraTranslateDownChannelId().GetName();
m_cameraInputSettings.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId().GetName(); m_cameraInputSettings.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId().GetName();
m_cameraInputSettings.m_orbitChannelId = SandboxEditor::CameraOrbitChannelId().GetName(); m_cameraInputSettings.m_pivotChannelId = SandboxEditor::CameraPivotChannelId().GetName();
m_cameraInputSettings.m_freeLookChannelId = SandboxEditor::CameraFreeLookChannelId().GetName(); m_cameraInputSettings.m_freeLookChannelId = SandboxEditor::CameraFreeLookChannelId().GetName();
m_cameraInputSettings.m_freePanChannelId = SandboxEditor::CameraFreePanChannelId().GetName(); m_cameraInputSettings.m_freePanChannelId = SandboxEditor::CameraFreePanChannelId().GetName();
m_cameraInputSettings.m_orbitLookChannelId = SandboxEditor::CameraOrbitLookChannelId().GetName(); m_cameraInputSettings.m_pivotLookChannelId = SandboxEditor::CameraPivotLookChannelId().GetName();
m_cameraInputSettings.m_orbitDollyChannelId = SandboxEditor::CameraOrbitDollyChannelId().GetName(); m_cameraInputSettings.m_pivotDollyChannelId = SandboxEditor::CameraPivotDollyChannelId().GetName();
m_cameraInputSettings.m_orbitPanChannelId = SandboxEditor::CameraOrbitPanChannelId().GetName(); m_cameraInputSettings.m_pivotPanChannelId = SandboxEditor::CameraPivotPanChannelId().GetName();
} }

@ -54,7 +54,7 @@ private:
float m_translateSmoothness; float m_translateSmoothness;
bool m_translateSmoothing; bool m_translateSmoothing;
bool m_captureCursorLook; bool m_captureCursorLook;
bool m_orbitYawRotationInverted; bool m_pivotYawRotationInverted;
bool m_panInvertedX; bool m_panInvertedX;
bool m_panInvertedY; bool m_panInvertedY;
@ -80,12 +80,12 @@ private:
AZStd::string m_translateUpChannelId; AZStd::string m_translateUpChannelId;
AZStd::string m_translateDownChannelId; AZStd::string m_translateDownChannelId;
AZStd::string m_boostChannelId; AZStd::string m_boostChannelId;
AZStd::string m_orbitChannelId; AZStd::string m_pivotChannelId;
AZStd::string m_freeLookChannelId; AZStd::string m_freeLookChannelId;
AZStd::string m_freePanChannelId; AZStd::string m_freePanChannelId;
AZStd::string m_orbitLookChannelId; AZStd::string m_pivotLookChannelId;
AZStd::string m_orbitDollyChannelId; AZStd::string m_pivotDollyChannelId;
AZStd::string m_orbitPanChannelId; AZStd::string m_pivotPanChannelId;
}; };
CameraMovementSettings m_cameraMovementSettings; CameraMovementSettings m_cameraMovementSettings;

@ -9,6 +9,9 @@
#include "EditorPreferencesTreeWidgetItem.h" #include "EditorPreferencesTreeWidgetItem.h"
// AzCore
#include <AzCore/Component/ComponentApplicationBus.h>
// AzToolsFramework // AzToolsFramework
#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx> #include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>

@ -48,7 +48,7 @@ namespace SandboxEditor
{ {
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event( AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
viewportContext->GetId(), &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, viewportContext->GetId(), &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
AZ::Transform::CreateFromQuaternionAndTranslation(CameraRotation(pitch, yaw), position), 0.0f); AZ::Transform::CreateFromQuaternionAndTranslation(CameraRotation(pitch, yaw), position));
} }
} }

@ -28,7 +28,7 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraRotateSpeedSetting = "/Amazon/Preferences/Editor/Camera/RotateSpeed"; constexpr AZStd::string_view CameraRotateSpeedSetting = "/Amazon/Preferences/Editor/Camera/RotateSpeed";
constexpr AZStd::string_view CameraScrollSpeedSetting = "/Amazon/Preferences/Editor/Camera/DollyScrollSpeed"; constexpr AZStd::string_view CameraScrollSpeedSetting = "/Amazon/Preferences/Editor/Camera/DollyScrollSpeed";
constexpr AZStd::string_view CameraDollyMotionSpeedSetting = "/Amazon/Preferences/Editor/Camera/DollyMotionSpeed"; constexpr AZStd::string_view CameraDollyMotionSpeedSetting = "/Amazon/Preferences/Editor/Camera/DollyMotionSpeed";
constexpr AZStd::string_view CameraOrbitYawRotationInvertedSetting = "/Amazon/Preferences/Editor/Camera/YawRotationInverted"; constexpr AZStd::string_view CameraPivotYawRotationInvertedSetting = "/Amazon/Preferences/Editor/Camera/YawRotationInverted";
constexpr AZStd::string_view CameraPanInvertedXSetting = "/Amazon/Preferences/Editor/Camera/PanInvertedX"; constexpr AZStd::string_view CameraPanInvertedXSetting = "/Amazon/Preferences/Editor/Camera/PanInvertedX";
constexpr AZStd::string_view CameraPanInvertedYSetting = "/Amazon/Preferences/Editor/Camera/PanInvertedY"; constexpr AZStd::string_view CameraPanInvertedYSetting = "/Amazon/Preferences/Editor/Camera/PanInvertedY";
constexpr AZStd::string_view CameraPanSpeedSetting = "/Amazon/Preferences/Editor/Camera/PanSpeed"; constexpr AZStd::string_view CameraPanSpeedSetting = "/Amazon/Preferences/Editor/Camera/PanSpeed";
@ -44,12 +44,12 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraTranslateUpIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateUpId"; constexpr AZStd::string_view CameraTranslateUpIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateUpId";
constexpr AZStd::string_view CameraTranslateDownIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateUpDownId"; constexpr AZStd::string_view CameraTranslateDownIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateUpDownId";
constexpr AZStd::string_view CameraTranslateBoostIdSetting = "/Amazon/Preferences/Editor/Camera/TranslateBoostId"; constexpr AZStd::string_view CameraTranslateBoostIdSetting = "/Amazon/Preferences/Editor/Camera/TranslateBoostId";
constexpr AZStd::string_view CameraOrbitIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitId"; constexpr AZStd::string_view CameraPivotIdSetting = "/Amazon/Preferences/Editor/Camera/PivotId";
constexpr AZStd::string_view CameraFreeLookIdSetting = "/Amazon/Preferences/Editor/Camera/FreeLookId"; constexpr AZStd::string_view CameraFreeLookIdSetting = "/Amazon/Preferences/Editor/Camera/FreeLookId";
constexpr AZStd::string_view CameraFreePanIdSetting = "/Amazon/Preferences/Editor/Camera/FreePanId"; constexpr AZStd::string_view CameraFreePanIdSetting = "/Amazon/Preferences/Editor/Camera/FreePanId";
constexpr AZStd::string_view CameraOrbitLookIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitLookId"; constexpr AZStd::string_view CameraPivotLookIdSetting = "/Amazon/Preferences/Editor/Camera/PivotLookId";
constexpr AZStd::string_view CameraOrbitDollyIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitDollyId"; constexpr AZStd::string_view CameraPivotDollyIdSetting = "/Amazon/Preferences/Editor/Camera/PivotDollyId";
constexpr AZStd::string_view CameraOrbitPanIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitPanId"; constexpr AZStd::string_view CameraPivotPanIdSetting = "/Amazon/Preferences/Editor/Camera/PivotPanId";
template<typename T> template<typename T>
void SetRegistry(const AZStd::string_view setting, T&& value) void SetRegistry(const AZStd::string_view setting, T&& value)
@ -239,14 +239,14 @@ namespace SandboxEditor
SetRegistry(CameraDollyMotionSpeedSetting, speed); SetRegistry(CameraDollyMotionSpeedSetting, speed);
} }
bool CameraOrbitYawRotationInverted() bool CameraPivotYawRotationInverted()
{ {
return GetRegistry(CameraOrbitYawRotationInvertedSetting, false); return GetRegistry(CameraPivotYawRotationInvertedSetting, false);
} }
void SetCameraOrbitYawRotationInverted(const bool inverted) void SetCameraPivotYawRotationInverted(const bool inverted)
{ {
SetRegistry(CameraOrbitYawRotationInvertedSetting, inverted); SetRegistry(CameraPivotYawRotationInvertedSetting, inverted);
} }
bool CameraPanInvertedX() bool CameraPanInvertedX()
@ -403,14 +403,14 @@ namespace SandboxEditor
SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId); SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId);
} }
AzFramework::InputChannelId CameraOrbitChannelId() AzFramework::InputChannelId CameraPivotChannelId()
{ {
return AzFramework::InputChannelId(GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str()); return AzFramework::InputChannelId(GetRegistry(CameraPivotIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str());
} }
void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId) void SetCameraPivotChannelId(AZStd::string_view cameraPivotId)
{ {
SetRegistry(CameraOrbitIdSetting, cameraOrbitId); SetRegistry(CameraPivotIdSetting, cameraPivotId);
} }
AzFramework::InputChannelId CameraFreeLookChannelId() AzFramework::InputChannelId CameraFreeLookChannelId()
@ -433,33 +433,33 @@ namespace SandboxEditor
SetRegistry(CameraFreePanIdSetting, cameraFreePanId); SetRegistry(CameraFreePanIdSetting, cameraFreePanId);
} }
AzFramework::InputChannelId CameraOrbitLookChannelId() AzFramework::InputChannelId CameraPivotLookChannelId()
{ {
return AzFramework::InputChannelId(GetRegistry(CameraOrbitLookIdSetting, AZStd::string("mouse_button_left")).c_str()); return AzFramework::InputChannelId(GetRegistry(CameraPivotLookIdSetting, AZStd::string("mouse_button_left")).c_str());
} }
void SetCameraOrbitLookChannelId(AZStd::string_view cameraOrbitLookId) void SetCameraPivotLookChannelId(AZStd::string_view cameraPivotLookId)
{ {
SetRegistry(CameraOrbitLookIdSetting, cameraOrbitLookId); SetRegistry(CameraPivotLookIdSetting, cameraPivotLookId);
} }
AzFramework::InputChannelId CameraOrbitDollyChannelId() AzFramework::InputChannelId CameraPivotDollyChannelId()
{ {
return AzFramework::InputChannelId(GetRegistry(CameraOrbitDollyIdSetting, AZStd::string("mouse_button_right")).c_str()); return AzFramework::InputChannelId(GetRegistry(CameraPivotDollyIdSetting, AZStd::string("mouse_button_right")).c_str());
} }
void SetCameraOrbitDollyChannelId(AZStd::string_view cameraOrbitDollyId) void SetCameraPivotDollyChannelId(AZStd::string_view cameraPivotDollyId)
{ {
SetRegistry(CameraOrbitDollyIdSetting, cameraOrbitDollyId); SetRegistry(CameraPivotDollyIdSetting, cameraPivotDollyId);
} }
AzFramework::InputChannelId CameraOrbitPanChannelId() AzFramework::InputChannelId CameraPivotPanChannelId()
{ {
return AzFramework::InputChannelId(GetRegistry(CameraOrbitPanIdSetting, AZStd::string("mouse_button_middle")).c_str()); return AzFramework::InputChannelId(GetRegistry(CameraPivotPanIdSetting, AZStd::string("mouse_button_middle")).c_str());
} }
void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId) void SetCameraPivotPanChannelId(AZStd::string_view cameraPivotPanId)
{ {
SetRegistry(CameraOrbitPanIdSetting, cameraOrbitPanId); SetRegistry(CameraPivotPanIdSetting, cameraPivotPanId);
} }
} // namespace SandboxEditor } // namespace SandboxEditor

@ -71,8 +71,8 @@ namespace SandboxEditor
SANDBOX_API float CameraDollyMotionSpeed(); SANDBOX_API float CameraDollyMotionSpeed();
SANDBOX_API void SetCameraDollyMotionSpeed(float speed); SANDBOX_API void SetCameraDollyMotionSpeed(float speed);
SANDBOX_API bool CameraOrbitYawRotationInverted(); SANDBOX_API bool CameraPivotYawRotationInverted();
SANDBOX_API void SetCameraOrbitYawRotationInverted(bool inverted); SANDBOX_API void SetCameraPivotYawRotationInverted(bool inverted);
SANDBOX_API bool CameraPanInvertedX(); SANDBOX_API bool CameraPanInvertedX();
SANDBOX_API void SetCameraPanInvertedX(bool inverted); SANDBOX_API void SetCameraPanInvertedX(bool inverted);
@ -119,8 +119,8 @@ namespace SandboxEditor
SANDBOX_API AzFramework::InputChannelId CameraTranslateBoostChannelId(); SANDBOX_API AzFramework::InputChannelId CameraTranslateBoostChannelId();
SANDBOX_API void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId); SANDBOX_API void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId);
SANDBOX_API AzFramework::InputChannelId CameraOrbitChannelId(); SANDBOX_API AzFramework::InputChannelId CameraPivotChannelId();
SANDBOX_API void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId); SANDBOX_API void SetCameraPivotChannelId(AZStd::string_view cameraPivotId);
SANDBOX_API AzFramework::InputChannelId CameraFreeLookChannelId(); SANDBOX_API AzFramework::InputChannelId CameraFreeLookChannelId();
SANDBOX_API void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId); SANDBOX_API void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId);
@ -128,12 +128,12 @@ namespace SandboxEditor
SANDBOX_API AzFramework::InputChannelId CameraFreePanChannelId(); SANDBOX_API AzFramework::InputChannelId CameraFreePanChannelId();
SANDBOX_API void SetCameraFreePanChannelId(AZStd::string_view cameraFreePanId); SANDBOX_API void SetCameraFreePanChannelId(AZStd::string_view cameraFreePanId);
SANDBOX_API AzFramework::InputChannelId CameraOrbitLookChannelId(); SANDBOX_API AzFramework::InputChannelId CameraPivotLookChannelId();
SANDBOX_API void SetCameraOrbitLookChannelId(AZStd::string_view cameraOrbitLookId); SANDBOX_API void SetCameraPivotLookChannelId(AZStd::string_view cameraPivotLookId);
SANDBOX_API AzFramework::InputChannelId CameraOrbitDollyChannelId(); SANDBOX_API AzFramework::InputChannelId CameraPivotDollyChannelId();
SANDBOX_API void SetCameraOrbitDollyChannelId(AZStd::string_view cameraOrbitDollyId); SANDBOX_API void SetCameraPivotDollyChannelId(AZStd::string_view cameraPivotDollyId);
SANDBOX_API AzFramework::InputChannelId CameraOrbitPanChannelId(); SANDBOX_API AzFramework::InputChannelId CameraPivotPanChannelId();
SANDBOX_API void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId); SANDBOX_API void SetCameraPivotPanChannelId(AZStd::string_view cameraPivotPanId);
} // namespace SandboxEditor } // namespace SandboxEditor

@ -2428,7 +2428,7 @@ void EditorViewportWidget::RestoreViewportAfterGameMode()
} }
else else
{ {
AZ_Error("CryLegacy", false, "Not restoring the editor viewport camera is currently unsupported"); AZ_Warning("CryLegacy", false, "Not restoring the editor viewport camera is currently unsupported");
SetViewTM(preGameModeViewTM); SetViewTM(preGameModeViewTM);
} }
} }

@ -167,7 +167,7 @@ namespace UnitTest
AZ::Quaternion::CreateRotationZ(AZ::DegToRad(90.0f)), AZ::Vector3(20.0f, 40.0f, 60.0f)); AZ::Quaternion::CreateRotationZ(AZ::DegToRad(90.0f)), AZ::Vector3(20.0f, 40.0f, 60.0f));
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event( AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
transformToInterpolateTo, 0.0f); transformToInterpolateTo);
// simulate interpolation // simulate interpolation
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() }); m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
@ -193,7 +193,7 @@ namespace UnitTest
// When // When
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event( AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
transformToInterpolateTo, 0.0f); transformToInterpolateTo);
// simulate interpolation // simulate interpolation
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() }); m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });

@ -27,10 +27,11 @@ AZ_POP_DISABLE_WARNING
#endif #endif
// AzCore // AzCore
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Component/ComponentApplication.h> #include <AzCore/Component/ComponentApplication.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/Interface/Interface.h> #include <AzCore/Interface/Interface.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Utils/Utils.h> #include <AzCore/Utils/Utils.h>
// AzFramework // AzFramework

@ -1739,8 +1739,7 @@ void SandboxIntegrationManager::GoToEntitiesInViewports(const AzToolsFramework::
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event( AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
viewportContext->GetId(), viewportContext->GetId(),
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, nextCameraTransform, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, nextCameraTransform);
distanceToLookAt);
} }
} }
} }

@ -18,6 +18,7 @@
#include <AzCore/Utils/Utils.h> #include <AzCore/Utils/Utils.h>
// AzToolsFramework // AzToolsFramework
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h> #include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h> #include <AzToolsFramework/UI/UICore/WidgetHelpers.h>

@ -36,9 +36,6 @@
#include "CryEdit.h" #include "CryEdit.h"
#include "Viewport.h" #include "Viewport.h"
// Atom Renderer
#include <Atom/RPI.Public/RPISystemInterface.h>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <TrackView/ui_SequenceBatchRenderDialog.h> #include <TrackView/ui_SequenceBatchRenderDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
@ -1237,13 +1234,6 @@ void CSequenceBatchRenderDialog::OnKickIdleTimout()
{ {
componentApplication->TickSystem(); componentApplication->TickSystem();
} }
// Directly tick the renderer, as it's no longer part of the system tick
if (auto rpiSystem = AZ::RPI::RPISystemInterface::Get())
{
rpiSystem->SimulationTick();
rpiSystem->RenderTick();
}
} }
} }

@ -19,6 +19,7 @@
// Editor // Editor
#include "AnimationContext.h" #include "AnimationContext.h"
#include <AzCore/Asset/AssetSerializer.h>
namespace namespace
{ {

@ -15,6 +15,7 @@
#include "ViewportTitleDlg.h" #include "ViewportTitleDlg.h"
// Qt // Qt
#include <QLabel>
#include <QInputDialog> #include <QInputDialog>
#include <AtomLyIntegration/AtomViewportDisplayInfo/AtomViewportInfoDisplayBus.h> #include <AtomLyIntegration/AtomViewportDisplayInfo/AtomViewportInfoDisplayBus.h>
@ -36,8 +37,10 @@
#include "MathConversion.h" #include "MathConversion.h"
#include "EditorViewportSettings.h" #include "EditorViewportSettings.h"
#include <AzCore/std/algorithm.h> #include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Casting/numeric_cast.h> #include <AzCore/Casting/numeric_cast.h>
#include <AzCore/std/algorithm.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h> #include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <LmbrCentral/Audio/AudioSystemComponentBus.h> #include <LmbrCentral/Audio/AudioSystemComponentBus.h>
@ -145,6 +148,11 @@ CViewportTitleDlg::~CViewportTitleDlg()
AZ::VR::VREventBus::Handler::BusDisconnect(); AZ::VR::VREventBus::Handler::BusDisconnect();
GetISystem()->GetISystemEventDispatcher()->RemoveListener(this); GetISystem()->GetISystemEventDispatcher()->RemoveListener(this);
GetIEditor()->UnregisterNotifyListener(this); GetIEditor()->UnregisterNotifyListener(this);
if (m_prefabViewportFocusPathHandler)
{
delete m_prefabViewportFocusPathHandler;
}
} }
void CViewportTitleDlg::SetupCameraDropdownMenu() void CViewportTitleDlg::SetupCameraDropdownMenu()
@ -292,8 +300,6 @@ void CViewportTitleDlg::SetViewPane(CLayoutViewPane* pViewPane)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnInitDialog() void CViewportTitleDlg::OnInitDialog()
{ {
m_ui->m_titleBtn->setText(m_title);
// Add a child parented to us that listens for r_displayInfo changes. // Add a child parented to us that listens for r_displayInfo changes.
auto displayInfoHelper = new CViewportTitleDlgDisplayInfoHelper(this); auto displayInfoHelper = new CViewportTitleDlgDisplayInfoHelper(this);
connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo); connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo);
@ -314,13 +320,28 @@ void CViewportTitleDlg::OnInitDialog()
m_cameraSpeed->setFixedWidth(width); m_cameraSpeed->setFixedWidth(width);
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (isPrefabSystemEnabled)
{
m_prefabViewportFocusPathHandler = new AzToolsFramework::Prefab::PrefabViewportFocusPathHandler();
m_prefabViewportFocusPathHandler->Initialize(m_ui->m_prefabFocusPath, m_ui->m_prefabFocusBackButton);
}
else
{
m_ui->m_prefabFocusPath->setEnabled(false);
m_ui->m_prefabFocusBackButton->setEnabled(false);
m_ui->m_prefabFocusPath->hide();
m_ui->m_prefabFocusBackButton->hide();
}
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SetTitle(const QString& title) void CViewportTitleDlg::SetTitle(const QString& title)
{ {
m_title = title; m_title = title;
m_ui->m_titleBtn->setText(m_title);
} }
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

@ -19,6 +19,7 @@
#include <QWidgetAction> #include <QWidgetAction>
#include <QComboBox> #include <QComboBox>
#include <AzToolsFramework/UI/Prefab/PrefabViewportFocusPathHandler.h>
#include <AzQtComponents/Components/Widgets/SpinBox.h> #include <AzQtComponents/Components/Widgets/SpinBox.h>
#include <HMDBus.h> #include <HMDBus.h>
@ -176,6 +177,8 @@ protected:
QWidgetAction* m_gridSizeActionWidget = nullptr; QWidgetAction* m_gridSizeActionWidget = nullptr;
QWidgetAction* m_angleSizeActionWidget = nullptr; QWidgetAction* m_angleSizeActionWidget = nullptr;
AzToolsFramework::Prefab::PrefabViewportFocusPathHandler* m_prefabViewportFocusPathHandler = nullptr;
QScopedPointer<Ui::ViewportTitleDlg> m_ui; QScopedPointer<Ui::ViewportTitleDlg> m_ui;
}; };

@ -28,7 +28,7 @@
<height>29</height> <height>29</height>
</size> </size>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,0,0,0,0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,0,0,0,0,0">
<property name="leftMargin"> <property name="leftMargin">
<number>10</number> <number>10</number>
</property> </property>
@ -42,102 +42,112 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="m_titleBtn"> <widget class="QToolButton" name="m_prefabFocusBackButton">
<property name="toolTip">
<string>Up one level</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/Breadcrumb/img/UI20/Breadcrumb/arrow_left-default.svg</normaloff>:/Breadcrumb/img/UI20/Breadcrumb/arrow_left-default.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::BreadCrumbs" name="m_prefabFocusPath" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="contextMenuPolicy"> </widget>
<enum>Qt::NoContextMenu</enum> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property> </property>
<property name="text"> </spacer>
<string>Static</string> </item>
<item>
<widget class="QToolButton" name="m_cameraMenu">
<property name="toolTip">
<string>Camera settings</string>
</property> </property>
<property name="indent"> <property name="icon">
<number>11</number> <iconset>
<normaloff>:/Menu/camera.svg</normaloff>:/Menu/camera.svg</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="m_cameraMenu"> <widget class="QToolButton" name="m_debugInformationMenu">
<property name="icon"> <property name="toolTip">
<iconset> <string>Debug information</string>
<normaloff>:/Menu/camera.svg</normaloff>:/Menu/camera.svg </property>
</iconset> <property name="icon">
</property> <iconset>
<property name="toolTip"> <normaloff>:/Menu/debug.svg</normaloff>:/Menu/debug.svg</iconset>
<string>Camera settings</string> </property>
</property> <property name="checkable">
</widget> <bool>true</bool>
</item> </property>
<item> </widget>
<widget class="QToolButton" name="m_debugInformationMenu"> </item>
<property name="toolTip">
<string>Debug information</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/Menu/debug.svg</normaloff>:/Menu/debug.svg
</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="m_helpers"> <widget class="QToolButton" name="m_helpers">
<property name="toolTip"> <property name="toolTip">
<string>Toggle viewport helpers</string> <string>Toggle viewport helpers</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:/Menu/helpers.svg</normaloff>:/Menu/helpers.svg <normaloff>:/Menu/helpers.svg</normaloff>:/Menu/helpers.svg</iconset>
</iconset> </property>
</property> <property name="checkable">
<property name="checkable"> <bool>true</bool>
<bool>true</bool> </property>
</property> </widget>
</widget> </item>
</item>
<item> <item>
<widget class="QToolButton" name="m_resolutionMenu"> <widget class="QToolButton" name="m_resolutionMenu">
<property name="toolTip"> <property name="toolTip">
<string>Viewport resolution</string> <string>Viewport resolution</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:/Menu/resolution.svg</normaloff>:/Menu/resolution.svg <normaloff>:/Menu/resolution.svg</normaloff>:/Menu/resolution.svg</iconset>
</iconset> </property>
</property> </widget>
</widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="m_overflowBtn"> <widget class="QToolButton" name="m_overflowBtn">
<property name="toolTip"> <property name="toolTip">
<string>Other settings</string> <string>Other settings</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:/Menu/menu.svg</normaloff>:/Menu/menu.svg <normaloff>:/Menu/menu.svg</normaloff>:/Menu/menu.svg</iconset>
</iconset> </property>
</property> </widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>AzQtComponents::ButtonDivider</class> <class>AzQtComponents::BreadCrumbs</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>AzQtComponents/Components/ButtonDivider.h</header> <header>AzQtComponents/Components/Widgets/BreadCrumbs.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../../Framework/AzQtComponents/AzQtComponents/Images/resources.qrc"/> <include location="../../Framework/AzQtComponents/AzQtComponents/Images/resources.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

@ -89,6 +89,9 @@ namespace AZ
// Tracks the asset type used to create the instance. // Tracks the asset type used to create the instance.
AssetType m_assetType; AssetType m_assetType;
// Boolean to indicate if the instance has been orphaned from the instance database
bool m_isOrphaned = false;
}; };
/// @cond EXCLUDE_DOCS /// @cond EXCLUDE_DOCS

@ -203,6 +203,16 @@ namespace AZ
//! Calls FindOrCreate using a random InstanceId //! Calls FindOrCreate using a random InstanceId
Data::Instance<Type> Create(const Asset<AssetData>& asset, const AZStd::any* param = nullptr); Data::Instance<Type> Create(const Asset<AssetData>& asset, const AZStd::any* param = nullptr);
/**
* Removes the instance data from the database. Does not release it.
* References to existing instances will remain valid, but new calls to Create/FindOrCreate will create a new instance
* This function is temporary, to provide functionality needed for Model hot-reloading, but will be removed
* once the Model class does not need it anymore.
*
* @param id The id of the instance to remove
*/
void TEMPOrphan(const InstanceId& id);
private: private:
InstanceDatabase(const AssetType& assetType); InstanceDatabase(const AssetType& assetType);
~InstanceDatabase(); ~InstanceDatabase();
@ -356,6 +366,20 @@ namespace AZ
return FindOrCreate(Data::InstanceId::CreateRandom(), asset, param); return FindOrCreate(Data::InstanceId::CreateRandom(), asset, param);
} }
template<typename Type>
void InstanceDatabase<Type>::TEMPOrphan(const InstanceId& id)
{
AZStd::scoped_lock<AZStd::recursive_mutex> lock(m_databaseMutex);
// Check if the instance is still in the database, in case it was orphaned twice
auto instanceItr = m_database.find(id);
if (instanceItr != m_database.end())
{
// Mark the instance as orphaned, and remove it from the database
instanceItr->second->m_isOrphaned = true;
m_database.erase(instanceItr);
}
}
template<typename Type> template<typename Type>
void InstanceDatabase<Type>::ReleaseInstance(InstanceData* instance, const InstanceId& instanceId) void InstanceDatabase<Type>::ReleaseInstance(InstanceData* instance, const InstanceId& instanceId)
{ {
@ -374,6 +398,12 @@ namespace AZ
m_database.erase(instance->GetId()); m_database.erase(instance->GetId());
m_instanceHandler.m_deleteFunction(static_cast<Type*>(instance)); m_instanceHandler.m_deleteFunction(static_cast<Type*>(instance));
} }
else if (instance->m_isOrphaned && instance->m_useCount.compare_exchange_strong(expectedRefCount, -1))
{
// If the instance was orphaned, it has already been removed from the database,
// but still needs to be deleted when the refcount drops to 0
m_instanceHandler.m_deleteFunction(static_cast<Type*>(instance));
}
} }
template<typename Type> template<typename Type>

@ -181,7 +181,76 @@ namespace UnitTest
EXPECT_EQ(instance, instance3); EXPECT_EQ(instance, instance3);
} }
void ParallelInstanceCreateHelper(size_t threadCountMax, size_t assetIdCount, size_t durationSeconds) TEST_F(InstanceDatabaseTest, InstanceOrphan)
{
auto& assetManager = AssetManager::Instance();
auto& instanceDatabase = InstanceDatabase<TestInstanceA>::Instance();
Asset<TestAssetType> someAsset = assetManager.CreateAsset<TestAssetType>(s_assetId0, AZ::Data::AssetLoadBehavior::Default);
Instance<TestInstanceA> orphanedInstance = instanceDatabase.FindOrCreate(s_instanceId0, someAsset);
EXPECT_NE(orphanedInstance, nullptr);
instanceDatabase.TEMPOrphan(s_instanceId0);
// After orphan, the instance should not be found in the database, but it should still be valid
EXPECT_EQ(instanceDatabase.Find(s_instanceId0), nullptr);
EXPECT_NE(orphanedInstance, nullptr);
instanceDatabase.TEMPOrphan(s_instanceId0);
// Orphaning twice should be a no-op
EXPECT_EQ(instanceDatabase.Find(s_instanceId0), nullptr);
EXPECT_NE(orphanedInstance, nullptr);
Instance<TestInstanceA> instance2 = instanceDatabase.FindOrCreate(s_instanceId0, someAsset);
// Creating another instance with the same id should return a different instance than the one that was orphaned
EXPECT_NE(orphanedInstance, instance2);
}
enum class ParallelInstanceTestCases
{
Create,
CreateAndDeferRemoval,
CreateAndOrphan,
CreateDeferRemovalAndOrphan
};
enum class ParralleInstanceCurrentAction
{
Create,
DeferredRemoval,
Orphan
};
ParralleInstanceCurrentAction ParallelInstanceGetCurrentAction(ParallelInstanceTestCases testCase)
{
switch (testCase)
{
case ParallelInstanceTestCases::CreateAndDeferRemoval:
switch (rand() % 2)
{
case 0: return ParralleInstanceCurrentAction::Create;
case 1: return ParralleInstanceCurrentAction::DeferredRemoval;
}
case ParallelInstanceTestCases::CreateAndOrphan:
switch (rand() % 2)
{
case 0: return ParralleInstanceCurrentAction::Create;
case 1: return ParralleInstanceCurrentAction::Orphan;
}
case ParallelInstanceTestCases::CreateDeferRemovalAndOrphan:
switch (rand() % 3)
{
case 0: return ParralleInstanceCurrentAction::Create;
case 1: return ParralleInstanceCurrentAction::DeferredRemoval;
case 2: return ParralleInstanceCurrentAction::Orphan;
}
case ParallelInstanceTestCases::Create:
default:
return ParralleInstanceCurrentAction::Create;
}
}
void ParallelInstanceCreateHelper(size_t threadCountMax, size_t assetIdCount, float durationSeconds, ParallelInstanceTestCases testCase)
{ {
printf("Testing threads=%zu assetIds=%zu ... ", threadCountMax, assetIdCount); printf("Testing threads=%zu assetIds=%zu ... ", threadCountMax, assetIdCount);
@ -192,6 +261,7 @@ namespace UnitTest
auto& instanceManager = InstanceDatabase<TestInstanceA>::Instance(); auto& instanceManager = InstanceDatabase<TestInstanceA>::Instance();
AZStd::vector<Uuid> guids; AZStd::vector<Uuid> guids;
AZStd::vector<Data::Instance<Data::InstanceData>> instances;
AZStd::vector<Asset<TestAssetType>> assets; AZStd::vector<Asset<TestAssetType>> assets;
for (size_t i = 0; i < assetIdCount; ++i) for (size_t i = 0; i < assetIdCount; ++i)
@ -199,6 +269,7 @@ namespace UnitTest
Uuid guid = Uuid::CreateRandom(); Uuid guid = Uuid::CreateRandom();
guids.emplace_back(guid); guids.emplace_back(guid);
instances.emplace_back(nullptr);
// Pre-create asset so we don't attempt to load it from the catalog. // Pre-create asset so we don't attempt to load it from the catalog.
assets.emplace_back(assetManager.CreateAsset<TestAssetType>(guid, AZ::Data::AssetLoadBehavior::Default)); assets.emplace_back(assetManager.CreateAsset<TestAssetType>(guid, AZ::Data::AssetLoadBehavior::Default));
@ -206,6 +277,7 @@ namespace UnitTest
AZStd::vector<AZStd::thread> threads; AZStd::vector<AZStd::thread> threads;
AZStd::mutex mutex; AZStd::mutex mutex;
AZStd::mutex referenceTableMutex;
AZStd::atomic<int> threadCount((int)threadCountMax); AZStd::atomic<int> threadCount((int)threadCountMax);
AZStd::condition_variable cv; AZStd::condition_variable cv;
AZStd::atomic_bool keepDispatching(true); AZStd::atomic_bool keepDispatching(true);
@ -225,11 +297,15 @@ namespace UnitTest
for (size_t i = 0; i < threadCountMax; ++i) for (size_t i = 0; i < threadCountMax; ++i)
{ {
threads.emplace_back( threads.emplace_back(
[&instanceManager, &threadCount, &cv, &guids, &assets, &durationSeconds]() [&instanceManager, &threadCount, &cv, &guids, &instances, &assets, &durationSeconds, &testCase, &referenceTableMutex]()
{ {
AZ::Debug::Timer timer; AZ::Debug::Timer timer;
timer.Stamp(); timer.Stamp();
bool deferRemoval = testCase == ParallelInstanceTestCases::CreateAndDeferRemoval ||
testCase == ParallelInstanceTestCases::CreateDeferRemovalAndOrphan
? true : false;
while (timer.GetDeltaTimeInSeconds() < durationSeconds) while (timer.GetDeltaTimeInSeconds() < durationSeconds)
{ {
const size_t index = rand() % guids.size(); const size_t index = rand() % guids.size();
@ -237,11 +313,36 @@ namespace UnitTest
const InstanceId instanceId{ uuid }; const InstanceId instanceId{ uuid };
const AssetId assetId{ uuid }; const AssetId assetId{ uuid };
Instance<TestInstanceA> instance = ParralleInstanceCurrentAction currentAction = ParallelInstanceGetCurrentAction(testCase);
instanceManager.FindOrCreate(instanceId, Asset<TestAssetType>(assetId, azrtti_typeid<TestAssetType>()));
EXPECT_NE(instance, nullptr); if (currentAction == ParralleInstanceCurrentAction::Orphan)
EXPECT_EQ(instance->GetId(), instanceId); {
EXPECT_EQ(instance->m_asset, assets[index]); // Orphan the instance, but don't decrease its refcount
instanceManager.TEMPOrphan(instanceId);
}
else if (currentAction == ParralleInstanceCurrentAction::DeferredRemoval)
{
// Drop the refcount to zero so the instance will be released
referenceTableMutex.lock();
instances[index] = nullptr;
referenceTableMutex.unlock();
}
else
{
// Otherwise, add a new instance
Instance<TestInstanceA> instance = instanceManager.FindOrCreate(instanceId, assets[index]);
EXPECT_NE(instance, nullptr);
EXPECT_EQ(instance->GetId(), instanceId);
EXPECT_EQ(instance->m_asset, assets[index]);
if (deferRemoval)
{
// Keep a reference to the instance alive so it can be removed later
referenceTableMutex.lock();
instances[index] = instance;
referenceTableMutex.unlock();
}
}
} }
threadCount--; threadCount--;
@ -254,10 +355,12 @@ namespace UnitTest
// Used to detect a deadlock. If we wait for more than 10 seconds, it's likely a deadlock has occurred // Used to detect a deadlock. If we wait for more than 10 seconds, it's likely a deadlock has occurred
while (threadCount > 0 && !timedOut) while (threadCount > 0 && !timedOut)
{ {
size_t durationSecondsRoundedUp = static_cast<size_t>(std::ceil(durationSeconds));
AZStd::unique_lock<AZStd::mutex> lock(mutex); AZStd::unique_lock<AZStd::mutex> lock(mutex);
timedOut = timedOut =
(AZStd::cv_status::timeout == (AZStd::cv_status::timeout ==
cv.wait_until(lock, AZStd::chrono::system_clock::now() + AZStd::chrono::seconds(durationSeconds * 2))); cv.wait_until(lock, AZStd::chrono::system_clock::now() + AZStd::chrono::seconds(durationSecondsRoundedUp * 2)));
} }
EXPECT_TRUE(threadCount == 0) << "One or more threads appear to be deadlocked at " << timer.GetDeltaTimeInSeconds() << " seconds"; EXPECT_TRUE(threadCount == 0) << "One or more threads appear to be deadlocked at " << timer.GetDeltaTimeInSeconds() << " seconds";
@ -273,11 +376,11 @@ namespace UnitTest
printf("Took %f seconds\n", timer.GetDeltaTimeInSeconds()); printf("Took %f seconds\n", timer.GetDeltaTimeInSeconds());
} }
TEST_F(InstanceDatabaseTest, ParallelInstanceCreate) void ParallelCreateTest(ParallelInstanceTestCases testCase)
{ {
// This is the original test scenario from when InstanceDatabase was first implemented // This is the original test scenario from when InstanceDatabase was first implemented
// threads, AssetIds, seconds // threads, AssetIds, seconds
ParallelInstanceCreateHelper(8, 100, 5); ParallelInstanceCreateHelper(8, 100, 5, testCase);
// This value is checked in as 1 so this test doesn't take too much time, but can be increased locally to soak the test. // This value is checked in as 1 so this test doesn't take too much time, but can be increased locally to soak the test.
const size_t attempts = 1; const size_t attempts = 1;
@ -289,11 +392,11 @@ namespace UnitTest
// The idea behind this series of tests is that there are two threads sharing one Instance, and both threads try to // The idea behind this series of tests is that there are two threads sharing one Instance, and both threads try to
// create or release that instance at the same time. // create or release that instance at the same time.
// At the time, this set of scenarios has something like a 10% failure rate. // At the time, this set of scenarios has something like a 10% failure rate.
const size_t duration = 2; const float duration = 2.0f;
// threads, AssetIds, seconds // threads, AssetIds, seconds
ParallelInstanceCreateHelper(2, 1, duration); ParallelInstanceCreateHelper(2, 1, duration, testCase);
ParallelInstanceCreateHelper(4, 1, duration); ParallelInstanceCreateHelper(4, 1, duration, testCase);
ParallelInstanceCreateHelper(8, 1, duration); ParallelInstanceCreateHelper(8, 1, duration, testCase);
} }
for (size_t i = 0; i < attempts; ++i) for (size_t i = 0; i < attempts; ++i)
@ -301,19 +404,39 @@ namespace UnitTest
printf("Attempt %zu of %zu... \n", i, attempts); printf("Attempt %zu of %zu... \n", i, attempts);
// Here we try a bunch of different threadCount:assetCount ratios to be thorough // Here we try a bunch of different threadCount:assetCount ratios to be thorough
const size_t duration = 2; const float duration = 2.0f;
// threads, AssetIds, seconds // threads, AssetIds, seconds
ParallelInstanceCreateHelper(2, 1, duration); ParallelInstanceCreateHelper(2, 1, duration, testCase);
ParallelInstanceCreateHelper(4, 1, duration); ParallelInstanceCreateHelper(4, 1, duration, testCase);
ParallelInstanceCreateHelper(4, 2, duration); ParallelInstanceCreateHelper(4, 2, duration, testCase);
ParallelInstanceCreateHelper(4, 4, duration); ParallelInstanceCreateHelper(4, 4, duration, testCase);
ParallelInstanceCreateHelper(8, 1, duration); ParallelInstanceCreateHelper(8, 1, duration, testCase);
ParallelInstanceCreateHelper(8, 2, duration); ParallelInstanceCreateHelper(8, 2, duration, testCase);
ParallelInstanceCreateHelper(8, 3, duration); ParallelInstanceCreateHelper(8, 3, duration, testCase);
ParallelInstanceCreateHelper(8, 4, duration); ParallelInstanceCreateHelper(8, 4, duration, testCase);
} }
} }
TEST_F(InstanceDatabaseTest, ParallelInstanceCreate)
{
ParallelCreateTest(ParallelInstanceTestCases::Create);
}
TEST_F(InstanceDatabaseTest, ParallelInstanceCreateAndDeferRemoval)
{
ParallelCreateTest(ParallelInstanceTestCases::CreateAndDeferRemoval);
}
TEST_F(InstanceDatabaseTest, ParallelInstanceCreateAndOrphan)
{
ParallelCreateTest(ParallelInstanceTestCases::CreateAndOrphan);
}
TEST_F(InstanceDatabaseTest, ParallelInstanceCreateDeferRemovalAndOrphan)
{
ParallelCreateTest(ParallelInstanceTestCases::CreateDeferRemovalAndOrphan);
}
TEST_F(InstanceDatabaseTest, InstanceCreateNoDatabase) TEST_F(InstanceDatabaseTest, InstanceCreateNoDatabase)
{ {
bool m_deleted = false; bool m_deleted = false;

@ -340,6 +340,14 @@ namespace AZ
// (Load jobs will attempt to reuse blocked threads before spinning off new job threads) // (Load jobs will attempt to reuse blocked threads before spinning off new job threads)
ProcessLoadJob(); ProcessLoadJob();
} }
// Pump the AssetBus function queue once more after the load has completed in case additional
// functions have been queued between the last call to DispatchEvents and the completion
// of the current load job
if (m_shouldDispatchEvents)
{
AssetManager::Instance().DispatchEvents();
}
} }
void Finish() void Finish()

@ -13,6 +13,7 @@
#include <AzCore/Serialization/EditContext.h> #include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/BehaviorContext.h> #include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Serialization/Json/RegistrationContext.h> #include <AzCore/Serialization/Json/RegistrationContext.h>
#include <AzCore/Slice/SliceAssetHandler.h> #include <AzCore/Slice/SliceAssetHandler.h>
#include <AzCore/Slice/SliceComponent.h> #include <AzCore/Slice/SliceComponent.h>

@ -8,6 +8,7 @@
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/IO/SystemFile.h> #include <AzCore/IO/SystemFile.h>
namespace AZ { namespace AZ {

@ -22,6 +22,7 @@
#include <AzCore/Memory/Memory.h> #include <AzCore/Memory/Memory.h>
#include <AzCore/Memory/SystemAllocator.h> // Used as the allocator for most components. #include <AzCore/Memory/SystemAllocator.h> // Used as the allocator for most components.
#include <AzCore/Outcome/Outcome.h> #include <AzCore/Outcome/Outcome.h>
#include <AzCore/std/containers/unordered_set.h>
namespace AZ namespace AZ
{ {

@ -74,8 +74,6 @@
#include <AzCore/Module/Environment.h> #include <AzCore/Module/Environment.h>
#include <AzCore/std/string/conversions.h> #include <AzCore/std/string/conversions.h>
AZ_CVAR(float, g_simulation_tick_rate, 0, nullptr, AZ::ConsoleFunctorFlags::Null, "The rate at which the game simulation tick loop runs, or 0 for as fast as possible");
static void PrintEntityName(const AZ::ConsoleCommandContainer& arguments) static void PrintEntityName(const AZ::ConsoleCommandContainer& arguments)
{ {
if (arguments.empty()) if (arguments.empty())
@ -1396,23 +1394,6 @@ namespace AZ
AZ_PROFILE_SCOPE(AzCore, "ComponentApplication::Tick:OnTick"); AZ_PROFILE_SCOPE(AzCore, "ComponentApplication::Tick:OnTick");
EBUS_EVENT(TickBus, OnTick, m_deltaTime, ScriptTimePoint(now)); EBUS_EVENT(TickBus, OnTick, m_deltaTime, ScriptTimePoint(now));
} }
// If tick rate limiting is on, ensure (1 / g_simulation_tick_rate) ms has elapsed since the last frame,
// sleeping if there's still time remaining.
if (g_simulation_tick_rate > 0.f)
{
now = AZStd::chrono::system_clock::now();
// Work in microsecond durations here as that's the native measurement time for time_point
constexpr float microsecondsPerSecond = 1000.f * 1000.f;
const AZStd::chrono::microseconds timeBudgetPerTick(static_cast<int>(microsecondsPerSecond / g_simulation_tick_rate));
AZStd::chrono::microseconds timeUntilNextTick = m_currentTime + timeBudgetPerTick - now;
if (timeUntilNextTick.count() > 0)
{
AZStd::this_thread::sleep_for(timeUntilNextTick);
}
}
} }
} }

@ -649,6 +649,16 @@ namespace AZ
m_stateEvent.Signal(oldState, m_state); m_stateEvent.Signal(oldState, m_state);
} }
void Entity::SetSpawnTicketId(u32 spawnTicketId)
{
m_spawnTicketId = spawnTicketId;
}
u32 Entity::GetSpawnTicketId() const
{
return m_spawnTicketId;
}
void Entity::OnNameChanged() const void Entity::OnNameChanged() const
{ {
EBUS_EVENT_ID(GetId(), EntityBus, OnEntityNameChanged, m_name); EBUS_EVENT_ID(GetId(), EntityBus, OnEntityNameChanged, m_name);

@ -133,6 +133,14 @@ namespace AZ
//! @return The state of the entity. For example, the entity has been initialized, the entity is active, and so on. //! @return The state of the entity. For example, the entity has been initialized, the entity is active, and so on.
State GetState() const { return m_state; } State GetState() const { return m_state; }
//! Gets the ticket id used to spawn the entity.
//! @return the ticket id used to spawn the entity. If entity is not spawned, the id will be 0.
u32 GetSpawnTicketId() const;
//! Sets the ticket id used to spawn the entity. The ticket id in the entity will remain 0 unless it's set using this function.
//! @param spawnTicketId the ticket id used to spawn the entity.
void SetSpawnTicketId(u32 spawnTicketId);
//! Connects an entity state event handler to the entity. //! Connects an entity state event handler to the entity.
//! All state changes will be signaled through this event. //! All state changes will be signaled through this event.
//! @param handler reference to the EntityStateEvent handler to attach to the entities state event. //! @param handler reference to the EntityStateEvent handler to attach to the entities state event.
@ -410,6 +418,8 @@ namespace AZ
//! A user-friendly name for the entity. This makes error messages easier to read. //! A user-friendly name for the entity. This makes error messages easier to read.
AZStd::string m_name; AZStd::string m_name;
u32 m_spawnTicketId = 0;
//! The state of the entity. //! The state of the entity.
State m_state; State m_state;

@ -5,8 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT * SPDX-License-Identifier: Apache-2.0 OR MIT
* *
*/ */
#ifndef AZCORE_ENTITY_UTILS_H #pragma once
#define AZCORE_ENTITY_UTILS_H
#include <AzCore/Component/Entity.h> #include <AzCore/Component/Entity.h>
#include <AzCore/Debug/Profiler.h> #include <AzCore/Debug/Profiler.h>
@ -217,6 +216,3 @@ namespace AZ
} // namespace EntityUtils } // namespace EntityUtils
} // namespace AZ } // namespace AZ
#endif // AZCORE_ENTITY_UTILS_H
#pragma once

@ -46,8 +46,6 @@ namespace AZ
TICK_PRE_RENDER = 750, ///< Suggested tick handler position to update render-related data. TICK_PRE_RENDER = 750, ///< Suggested tick handler position to update render-related data.
TICK_RENDER = 800, ///< Suggested tick handler position for rendering.
TICK_DEFAULT = 1000, ///< Default tick handler position when the handler is constructed. TICK_DEFAULT = 1000, ///< Default tick handler position when the handler is constructed.
TICK_UI = 2000, ///< Suggested tick handler position for UI components. TICK_UI = 2000, ///< Suggested tick handler position for UI components.

@ -8,6 +8,7 @@
#pragma once #pragma once
#include <AzCore/Memory/OSAllocator.h>
#include <AzCore/std/smart_ptr/unique_ptr.h> #include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/EBus/Policies.h> #include <AzCore/EBus/Policies.h>

@ -19,14 +19,11 @@
#pragma once #pragma once
#include <AzCore/EBus/BusImpl.h> #include <AzCore/EBus/BusImpl.h>
#include <AzCore/EBus/Environment.h>
#include <AzCore/EBus/Results.h> #include <AzCore/EBus/Results.h>
#include <AzCore/EBus/Internal/Debug.h> #include <AzCore/EBus/Internal/Debug.h>
// Included for backwards compatibility purposes
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/std/containers/unordered_set.h>
#include <AzCore/std/typetraits/is_same.h> #include <AzCore/std/typetraits/is_same.h>
// End backwards compat
#include <AzCore/std/utils.h> #include <AzCore/std/utils.h>
#include <AzCore/std/parallel/scoped_lock.h> #include <AzCore/std/parallel/scoped_lock.h>
@ -90,14 +87,14 @@ namespace AZ
* For available settings, see AZ::EBusHandlerPolicy. * For available settings, see AZ::EBusHandlerPolicy.
* By default, an EBus supports any number of handlers. * By default, an EBus supports any number of handlers.
*/ */
static const EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Multiple; static constexpr EBusHandlerPolicy HandlerPolicy = EBusHandlerPolicy::Multiple;
/** /**
* Defines how many addresses exist on the EBus. * Defines how many addresses exist on the EBus.
* For available settings, see AZ::EBusAddressPolicy. * For available settings, see AZ::EBusAddressPolicy.
* By default, an EBus uses a single address. * By default, an EBus uses a single address.
*/ */
static const EBusAddressPolicy AddressPolicy = EBusAddressPolicy::Single; static constexpr EBusAddressPolicy AddressPolicy = EBusAddressPolicy::Single;
/** /**
* The type of ID that is used to address the EBus. * The type of ID that is used to address the EBus.
@ -152,14 +149,14 @@ namespace AZ
* `<BusName>::ExecuteQueuedEvents()`. * `<BusName>::ExecuteQueuedEvents()`.
* By default, the event queue is disabled. * By default, the event queue is disabled.
*/ */
static const bool EnableEventQueue = false; static constexpr bool EnableEventQueue = false;
/** /**
* Specifies whether the bus should accept queued messages by default or not. * Specifies whether the bus should accept queued messages by default or not.
* If set to false, Bus::AllowFunctionQueuing(true) must be called before events are accepted. * If set to false, Bus::AllowFunctionQueuing(true) must be called before events are accepted.
* Used only when #EnableEventQueue is true. * Used only when #EnableEventQueue is true.
*/ */
static const bool EventQueueingActiveByDefault = true; static constexpr bool EventQueueingActiveByDefault = true;
/** /**
* Specifies whether the EBus supports queueing functions which take reference * Specifies whether the EBus supports queueing functions which take reference
@ -168,7 +165,7 @@ namespace AZ
* You should only use this if you know that the data being passed as arguments will * You should only use this if you know that the data being passed as arguments will
* outlive the dispatch of the queued event. * outlive the dispatch of the queued event.
*/ */
static const bool EnableQueuedReferences = false; static constexpr bool EnableQueuedReferences = false;
/** /**
* Locking primitive that is used when adding and removing * Locking primitive that is used when adding and removing
@ -197,7 +194,7 @@ namespace AZ
* to do. * to do.
* By default, the standard policy is used, which locks around all dispatches * By default, the standard policy is used, which locks around all dispatches
*/ */
static const bool LocklessDispatch = false; static constexpr bool LocklessDispatch = false;
/** /**
* Specifies where EBus data is stored. * Specifies where EBus data is stored.

@ -13,6 +13,7 @@
#include <AzCore/EBus/EBus.h> #include <AzCore/EBus/EBus.h>
#include <AzCore/RTTI/RTTI.h> #include <AzCore/RTTI/RTTI.h>
#include <AzCore/RTTI/TypeSafeIntegral.h> #include <AzCore/RTTI/TypeSafeIntegral.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
namespace AZ namespace AZ
{ {

@ -18,9 +18,8 @@
#include <AzCore/std/function/invoke.h> #include <AzCore/std/function/invoke.h>
#include <AzCore/std/containers/queue.h> #include <AzCore/std/containers/queue.h>
#include <AzCore/std/containers/intrusive_set.h> #include <AzCore/std/containers/intrusive_set.h>
#include <AzCore/std/parallel/scoped_lock.h>
#include <AzCore/Module/Environment.h>
#include <AzCore/EBus/Environment.h>
namespace AZ namespace AZ
{ {
@ -251,29 +250,21 @@ namespace AZ
void Execute() void Execute()
{ {
AZ_Warning("System", m_isActive, "You are calling execute queued functions on a bus which has not activated its function queuing! Call YourBus::AllowFunctionQueuing(true)!"); AZ_Warning("System", m_isActive, "You are calling execute queued functions on a bus which has not activated its function queuing! Call YourBus::AllowFunctionQueuing(true)!");
while (true)
MessageQueueType localMessages;
// Swap the current list of queue functions with a local instance
{
AZStd::scoped_lock lock(m_messagesMutex);
AZStd::swap(localMessages, m_messages);
}
// Execute the queue functions safely now that are owned by the function
while (!localMessages.empty())
{ {
BusMessageCall invoke; const BusMessageCall& localMessage = localMessages.front();
localMessage();
////////////////////////////////////////////////////////////////////////// localMessages.pop();
// Pop element from the queue.
{
AZStd::lock_guard<MutexType> lock(m_messagesMutex);
size_t numMessages = m_messages.size();
if (numMessages == 0)
{
break;
}
AZStd::swap(invoke, m_messages.front());
m_messages.pop();
if (numMessages == 1)
{
m_messages = {};
}
}
//////////////////////////////////////////////////////////////////////////
invoke();
} }
} }

@ -0,0 +1,200 @@
/*
* 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
*
*/
#include <AzCore/IO/FileReader.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/Path/Path.h>
namespace AZ::IO
{
FileReader::FileReader() = default;
FileReader::FileReader(AZ::IO::FileIOBase* fileIoBase, const char* filePath)
{
Open(fileIoBase, filePath);
}
FileReader::~FileReader()
{
Close();
}
FileReader::FileReader(FileReader&& other)
{
AZStd::swap(m_file, other.m_file);
AZStd::swap(m_fileIoBase, other.m_fileIoBase);
}
FileReader& FileReader::operator=(FileReader&& other)
{
// Close the current file and take over other file
Close();
m_file = AZStd::move(other.m_file);
m_fileIoBase = AZStd::move(other.m_fileIoBase);
other.m_file = AZStd::monostate{};
other.m_fileIoBase = {};
return *this;
}
bool FileReader::Open(AZ::IO::FileIOBase* fileIoBase, const char* filePath)
{
// Close file if the FileReader has an instance open
Close();
if (fileIoBase != nullptr)
{
AZ::IO::HandleType fileHandle;
if (fileIoBase->Open(filePath, IO::OpenMode::ModeRead, fileHandle))
{
m_file = fileHandle;
m_fileIoBase = fileIoBase;
return true;
}
}
else
{
AZ::IO::SystemFile file;
if (file.Open(filePath, IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY))
{
m_file = AZStd::move(file);
return true;
}
}
return false;
}
bool FileReader::IsOpen() const
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
return *fileHandle != AZ::IO::InvalidHandle;
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->IsOpen();
}
return false;
}
void FileReader::Close()
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (AZ::IO::FileIOBase* fileIo = m_fileIoBase; fileIo != nullptr)
{
fileIo->Close(*fileHandle);
}
}
m_file = AZStd::monostate{};
m_fileIoBase = {};
}
auto FileReader::Length() const -> SizeType
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (SizeType fileSize{}; m_fileIoBase->Size(*fileHandle, fileSize))
{
return fileSize;
}
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->Length();
}
return 0;
}
auto FileReader::Read(SizeType byteSize, void* buffer) -> SizeType
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (SizeType bytesRead{}; m_fileIoBase->Read(*fileHandle, buffer, byteSize, false, &bytesRead))
{
return bytesRead;
}
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->Read(byteSize, buffer);
}
return 0;
}
auto FileReader::Tell() const -> SizeType
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (SizeType fileOffset{}; m_fileIoBase->Tell(*fileHandle, fileOffset))
{
return fileOffset;
}
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->Tell();
}
return 0;
}
bool FileReader::Seek(AZ::s64 offset, SeekType type)
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
return m_fileIoBase->Seek(*fileHandle, offset, type);
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
systemFile->Seek(offset, static_cast<AZ::IO::SystemFile::SeekMode>(type));
return true;
}
return false;
}
bool FileReader::Eof() const
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
return m_fileIoBase->Eof(*fileHandle);
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->Eof();
}
return false;
}
bool FileReader::GetFilePath(AZ::IO::FixedMaxPath& filePath) const
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
AZ::IO::FixedMaxPathString& pathStringRef = filePath.Native();
if (m_fileIoBase->GetFilename(*fileHandle, pathStringRef.data(), pathStringRef.capacity()))
{
pathStringRef.resize_no_construct(AZStd::char_traits<char>::length(pathStringRef.data()));
return true;
}
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
filePath = systemFile->Name();
return true;
}
return false;
}
}

@ -0,0 +1,92 @@
/*
* 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/IO/Path/Path_fwd.h>
#include <AzCore/IO/SystemFile.h>
#include <AzCore/std/containers/variant.h>
namespace AZ::IO
{
class FileIOBase;
enum class SeekType : AZ::u32;
//! Structure which encapsulates delegates File Read operations
//! to either the FileIOBase or SystemFile classes based if a FileIOBase* instance has been supplied
//! to the FileSystemReader class
//! the SettingsRegistry option to use FileIO
class FileReader
{
using HandleType = AZ::u32;
using FileHandleType = AZStd::variant<AZStd::monostate, AZ::IO::SystemFile, HandleType>;
public:
using SizeType = AZ::u64;
//! Creates FileReader instance in the default state with no file opend
FileReader();
~FileReader();
//! Creates a new FileReader instance and attempts to open the file at the supplied path
//! Uses the FileIOBase instance if supplied
//! @param fileIOBase pointer to fileIOBase instance
//! @param null-terminated filePath to open
FileReader(AZ::IO::FileIOBase* fileIoBase, const char* filePath);
//! Takes ownership of the supplied FileReader handle
FileReader(FileReader&& other);
//! Moves ownership of FileReader handle to this instance
FileReader& operator=(FileReader&& other);
//! Opens a File using the FileIOBase instance if non-nullptr
//! Otherwise fall back to use SystemFile
//! @param fileIOBase pointer to fileIOBase instance
//! @param null-terminated filePath to open
//! @return true if the File is opened successfully
bool Open(AZ::IO::FileIOBase* fileIoBase, const char* filePath);
//! Returns true if a file is currently open
//! @return true if the file is open
bool IsOpen() const;
//! Closes the File
void Close();
//! Retrieve the length of the OpenFile
SizeType Length() const;
//! Attempts to read up to byte size bytes into the supplied buffer
//! @param byteSize - Maximum number of bytes to read
//! @param buffer - Buffer to read bytes into
//! @returns the number of bytes read if the file is open, otherwise 0
SizeType Read(SizeType byteSize, void* buffer);
//! Returns the current file offset
//! @returns file offset if the file is open, otherwise 0
SizeType Tell() const;
//! Seeks within the open file to the offset supplied
//! @param offset File offset to seek to
//! @param type parameter to indicate the reference point to start the seek from
//! @returns true if the file is open and the seek succeeded
bool Seek(AZ::s64 offset, SeekType type);
//! Returns true if the file is open and in the EOF state
bool Eof() const;
//! Store the file path of the open file into the output file path parameter
//! The filePath reference is left unmodified, if the path was not stored
//! @return true if the filePath was stored
bool GetFilePath(AZ::IO::FixedMaxPath& filePath) const;
private:
FileHandleType m_file;
AZ::IO::FileIOBase* m_fileIoBase{};
};
}

@ -160,12 +160,12 @@ void SystemFile::Seek(SeekSizeType offset, SeekMode mode)
Platform::Seek(m_handle, this, offset, mode); Platform::Seek(m_handle, this, offset, mode);
} }
SystemFile::SizeType SystemFile::Tell() SystemFile::SizeType SystemFile::Tell() const
{ {
return Platform::Tell(m_handle, this); return Platform::Tell(m_handle, this);
} }
bool SystemFile::Eof() bool SystemFile::Eof() const
{ {
return Platform::Eof(m_handle, this); return Platform::Eof(m_handle, this);
} }

@ -72,9 +72,9 @@ namespace AZ
/// Seek in current file. /// Seek in current file.
void Seek(SeekSizeType offset, SeekMode mode); void Seek(SeekSizeType offset, SeekMode mode);
/// Get the cursor position in the current file. /// Get the cursor position in the current file.
SizeType Tell(); SizeType Tell() const;
/// Is the cursor at the end of the file? /// Is the cursor at the end of the file?
bool Eof(); bool Eof() const;
/// Get the time the file was last modified. /// Get the time the file was last modified.
AZ::u64 ModificationTime(); AZ::u64 ModificationTime();
/// Read data from a file synchronous. Return number of bytes actually read in the buffer. /// Read data from a file synchronous. Return number of bytes actually read in the buffer.

@ -7,6 +7,7 @@
*/ */
#include <AzCore/Name/NameSerializer.h> #include <AzCore/Name/NameSerializer.h>
#include <AzCore/IO/GenericStreams.h>
namespace AZ namespace AZ
{ {

@ -14,6 +14,7 @@
#include <AzCore/RTTI/ReflectContext.h> #include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/std/containers/array.h> #include <AzCore/std/containers/array.h>
#include <AzCore/std/containers/unordered_map.h> #include <AzCore/std/containers/unordered_map.h>
#include <AzCore/std/containers/unordered_set.h>
#include <AzCore/std/function/invoke.h> #include <AzCore/std/function/invoke.h>
#include <AzCore/std/string/string.h> #include <AzCore/std/string/string.h>
#include <AzCore/std/string/string_view.h> #include <AzCore/std/string/string_view.h>

@ -5,11 +5,13 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT * SPDX-License-Identifier: Apache-2.0 OR MIT
* *
*/ */
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Script/ScriptContext.h> #include <AzCore/Script/ScriptContext.h>
#include <AzCore/RTTI/BehaviorContext.h> #include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Script/lua/lua.h> #include <AzCore/Script/lua/lua.h>
#include <AzCore/Script/ScriptProperty.h> #include <AzCore/Script/ScriptProperty.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ namespace AZ
{ {

@ -5,8 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT * SPDX-License-Identifier: Apache-2.0 OR MIT
* *
*/ */
#ifndef AZCORE_SCRIPT_SCRIPTPROPERTY_H #pragma once
#define AZCORE_SCRIPT_SCRIPTPROPERTY_H
#include <AzCore/Component/EntityId.h> #include <AzCore/Component/EntityId.h>
#include <AzCore/Memory/SystemAllocator.h> #include <AzCore/Memory/SystemAllocator.h>
@ -490,5 +489,4 @@ namespace AZ
}; };
} }
#endif

@ -8,6 +8,7 @@
#include <cinttypes> #include <cinttypes>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Serialization/DataPatch.h> #include <AzCore/Serialization/DataPatch.h>
#include <AzCore/Serialization/DataPatchBus.h> #include <AzCore/Serialization/DataPatchBus.h>
#include <AzCore/Serialization/DataPatchUpgradeManager.h> #include <AzCore/Serialization/DataPatchUpgradeManager.h>

@ -9,6 +9,7 @@
#include "AzCore/RTTI/TypeInfo.h" #include "AzCore/RTTI/TypeInfo.h"
#include <AzCore/Math/UuidSerializer.h> #include <AzCore/Math/UuidSerializer.h>
#include <AzCore/RTTI/AttributeReader.h> #include <AzCore/RTTI/AttributeReader.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/Json/CastingHelpers.h> #include <AzCore/Serialization/Json/CastingHelpers.h>
#include <AzCore/Serialization/Json/JsonDeserializer.h> #include <AzCore/Serialization/Json/JsonDeserializer.h>
#include <AzCore/Serialization/Json/JsonStringConversionUtils.h> #include <AzCore/Serialization/Json/JsonStringConversionUtils.h>

@ -6,7 +6,9 @@
* *
*/ */
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/RTTI/AttributeReader.h> #include <AzCore/RTTI/AttributeReader.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/Json/JsonSerializer.h> #include <AzCore/Serialization/Json/JsonSerializer.h>
#include <AzCore/Serialization/Json/BaseJsonSerializer.h> #include <AzCore/Serialization/Json/BaseJsonSerializer.h>
#include <AzCore/Serialization/Json/JsonSerialization.h> #include <AzCore/Serialization/Json/JsonSerialization.h>

@ -7,6 +7,7 @@
*/ */
#include <algorithm> #include <algorithm>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/Json/BasicContainerSerializer.h> #include <AzCore/Serialization/Json/BasicContainerSerializer.h>
#include <AzCore/Serialization/Json/JsonSerialization.h> #include <AzCore/Serialization/Json/JsonSerialization.h>
#include <AzCore/Serialization/Json/MapSerializer.h> #include <AzCore/Serialization/Json/MapSerializer.h>

@ -7,6 +7,7 @@
*/ */
#include <AzCore/RTTI/AttributeReader.h> #include <AzCore/RTTI/AttributeReader.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Serialization/ObjectStream.h> #include <AzCore/Serialization/ObjectStream.h>
#include <AzCore/Serialization/DataOverlayInstanceMsgs.h> #include <AzCore/Serialization/DataOverlayInstanceMsgs.h>
#include <AzCore/Serialization/DataOverlayProviderMsgs.h> #include <AzCore/Serialization/DataOverlayProviderMsgs.h>

@ -37,7 +37,8 @@ namespace AZ
class GenericStream; class GenericStream;
} }
namespace ObjectStreamInternal { namespace ObjectStreamInternal
{
class ObjectStreamImpl; class ObjectStreamImpl;
} }

@ -7,6 +7,8 @@
*/ */
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Serialization/EditContext.h> #include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/DataOverlay.h> #include <AzCore/Serialization/DataOverlay.h>
#include <AzCore/Serialization/DynamicSerializableField.h> #include <AzCore/Serialization/DynamicSerializableField.h>

@ -5,8 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT * SPDX-License-Identifier: Apache-2.0 OR MIT
* *
*/ */
#ifndef AZCORE_SERIALIZE_CONTEXT_H #pragma once
#define AZCORE_SERIALIZE_CONTEXT_H
#include <limits> #include <limits>
@ -43,6 +42,12 @@
namespace AZ namespace AZ
{ {
namespace Data
{
template<typename T>
class Asset;
}
class EditContext; class EditContext;
class ObjectStream; class ObjectStream;
@ -2562,11 +2567,13 @@ namespace AZ
#include <AzCore/Serialization/AZStdContainers.inl> #include <AzCore/Serialization/AZStdContainers.inl>
#include <AzCore/Serialization/std/VariantReflection.inl> #include <AzCore/Serialization/std/VariantReflection.inl>
/// include asset generics // Forward declare asset serialization helper specialization
#include <AzCore/Asset/AssetSerializer.h> namespace AZ
{
template<typename T>
struct SerializeGenericTypeInfo< Data::Asset<T> >;
}
/// include implementation of SerializeContext::EnumBuilder /// include implementation of SerializeContext::EnumBuilder
#include <AzCore/Serialization/SerializeContextEnum.inl> #include <AzCore/Serialization/SerializeContextEnum.inl>
#endif // AZCORE_SERIALIZE_CONTEXT_H
#pragma once

@ -10,6 +10,7 @@
#include <cerrno> #include <cerrno>
#include <AzCore/Casting/numeric_cast.h> #include <AzCore/Casting/numeric_cast.h>
#include <AzCore/IO/FileIO.h> #include <AzCore/IO/FileIO.h>
#include <AzCore/IO/FileReader.h>
#include <AzCore/IO/Path/Path.h> #include <AzCore/IO/Path/Path.h>
#include <AzCore/JSON/error/en.h> #include <AzCore/JSON/error/en.h>
#include <AzCore/NativeUI//NativeUIRequests.h> #include <AzCore/NativeUI//NativeUIRequests.h>
@ -1116,118 +1117,6 @@ namespace AZ
} }
} }
//! Structure which encapsulates Commands to either the FileIOBase or SystemFile classes based on
//! the SettingsRegistry option to use FileIO
struct SettingsRegistryFileReader
{
using FileHandleType = AZStd::variant<AZStd::monostate, AZ::IO::SystemFile, AZ::IO::HandleType>;
SettingsRegistryFileReader() = default;
SettingsRegistryFileReader(bool useFileIo, const char* filePath)
{
Open(useFileIo, filePath);
}
~SettingsRegistryFileReader()
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (AZ::IO::FileIOBase* fileIo = AZ::IO::FileIOBase::GetInstance(); fileIo != nullptr)
{
fileIo->Close(*fileHandle);
}
}
}
bool Open(bool useFileIo, const char* filePath)
{
Close();
if (AZ::IO::FileIOBase* fileIo = useFileIo ? AZ::IO::FileIOBase::GetInstance() : nullptr; fileIo != nullptr)
{
AZ::IO::HandleType fileHandle;
if (fileIo->Open(filePath, IO::OpenMode::ModeRead, fileHandle))
{
m_file = fileHandle;
return true;
}
}
else
{
AZ::IO::SystemFile file;
if (file.Open(filePath, IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY))
{
m_file = AZStd::move(file);
return true;
}
}
return false;
}
bool IsOpen() const
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
return *fileHandle != AZ::IO::InvalidHandle;
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->IsOpen();
}
return false;
}
void Close()
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (AZ::IO::FileIOBase* fileIo = AZ::IO::FileIOBase::GetInstance(); fileIo != nullptr)
{
fileIo->Close(*fileHandle);
}
}
m_file = AZStd::monostate{};
}
u64 Length() const
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (u64 fileSize{}; AZ::IO::FileIOBase::GetInstance()->Size(*fileHandle, fileSize))
{
return fileSize;
}
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->Length();
}
return 0;
}
AZ::IO::SizeType Read(AZ::IO::SizeType byteSize, void* buffer)
{
if (auto fileHandle = AZStd::get_if<AZ::IO::HandleType>(&m_file); fileHandle != nullptr)
{
if (AZ::u64 bytesRead{}; AZ::IO::FileIOBase::GetInstance()->Read(*fileHandle, buffer, byteSize, false, &bytesRead))
{
return bytesRead;
}
}
else if (auto systemFile = AZStd::get_if<AZ::IO::SystemFile>(&m_file); systemFile != nullptr)
{
return systemFile->Read(byteSize, buffer);
}
return 0;
}
FileHandleType m_file;
};
bool SettingsRegistryImpl::MergeSettingsFileInternal(const char* path, Format format, AZStd::string_view rootKey, bool SettingsRegistryImpl::MergeSettingsFileInternal(const char* path, Format format, AZStd::string_view rootKey,
AZStd::vector<char>& scratchBuffer) AZStd::vector<char>& scratchBuffer)
{ {
@ -1236,7 +1125,7 @@ namespace AZ
Pointer pointer(AZ_SETTINGS_REGISTRY_HISTORY_KEY "/-"); Pointer pointer(AZ_SETTINGS_REGISTRY_HISTORY_KEY "/-");
SettingsRegistryFileReader fileReader(m_useFileIo, path); FileReader fileReader(m_useFileIo ? AZ::IO::FileIOBase::GetInstance(): nullptr, path);
if (!fileReader.IsOpen()) if (!fileReader.IsOpen())
{ {
AZ_Error("Settings Registry", false, R"(Unable to open registry file "%s".)", path); AZ_Error("Settings Registry", false, R"(Unable to open registry file "%s".)", path);

@ -6,6 +6,8 @@
* *
*/ */
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/FileReader.h>
#include <AzCore/IO/GenericStreams.h> #include <AzCore/IO/GenericStreams.h>
#include <AzCore/IO/Path/Path.h> #include <AzCore/IO/Path/Path.h>
#include <AzCore/IO/TextStreamWriters.h> #include <AzCore/IO/TextStreamWriters.h>
@ -388,8 +390,36 @@ namespace AZ::SettingsRegistryMergeUtils
const ConfigParserSettings& configParserSettings) const ConfigParserSettings& configParserSettings)
{ {
auto configPath = FindEngineRoot(registry) / filePath; auto configPath = FindEngineRoot(registry) / filePath;
IO::SystemFile configFile; IO::FileReader configFile;
if (!configFile.Open(configPath.c_str(), IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY)) bool configFileOpened{};
switch (configParserSettings.m_fileReaderClass)
{
case ConfigParserSettings::FileReaderClass::UseFileIOIfAvailableFallbackToSystemFile:
{
auto fileIo = AZ::IO::FileIOBase::GetInstance();
configFileOpened = configFile.Open(fileIo, configPath.c_str());
break;
}
case ConfigParserSettings::FileReaderClass::UseSystemFileOnly:
{
configFileOpened = configFile.Open(nullptr, configPath.c_str());
break;
}
case ConfigParserSettings::FileReaderClass::UseFileIOOnly:
{
auto fileIo = AZ::IO::FileIOBase::GetInstance();
if (fileIo == nullptr)
{
return false;
}
configFileOpened = configFile.Open(fileIo, configPath.c_str());
break;
}
default:
AZ_Error("SettingsRegistryMergeUtils", false, "An Invalid FileReaderClass enum value has been supplied");
return false;
}
if (!configFileOpened)
{ {
AZ_Warning("SettingsRegistryMergeUtils", false, R"(Unable to open file "%s")", configPath.c_str()); AZ_Warning("SettingsRegistryMergeUtils", false, R"(Unable to open file "%s")", configPath.c_str());
return false; return false;
@ -480,7 +510,7 @@ namespace AZ::SettingsRegistryMergeUtils
AZ_Error("SettingsRegistryMergeUtils", false, AZ_Error("SettingsRegistryMergeUtils", false,
R"(The config file "%s" contains a line which is longer than the max line length of %zu.)" "\n" R"(The config file "%s" contains a line which is longer than the max line length of %zu.)" "\n"
R"(Parsing will halt. The line content so far is:)" "\n" R"(Parsing will halt. The line content so far is:)" "\n"
R"("%.*s")" "\n", configFile.Name(), configBuffer.max_size(), R"("%.*s")" "\n", configPath.c_str(), configBuffer.max_size(),
aznumeric_cast<int>(configBuffer.size()), configBuffer.data()); aznumeric_cast<int>(configBuffer.size()), configBuffer.data());
configFileParsed = false; configFileParsed = false;
break; break;

@ -155,6 +155,15 @@ namespace AZ::SettingsRegistryMergeUtils
//! structure which is forwarded to the SettingsRegistryInterface MergeCommandLineArgument function //! structure which is forwarded to the SettingsRegistryInterface MergeCommandLineArgument function
//! The structure contains a functor which returns true if a character is a valid delimiter //! The structure contains a functor which returns true if a character is a valid delimiter
SettingsRegistryInterface::CommandLineArgumentSettings m_commandLineSettings; SettingsRegistryInterface::CommandLineArgumentSettings m_commandLineSettings;
//! enumeration to indicate if AZ::IO::FileIOBase should be used to open the config file over AZ::IO::SystemFile
enum class FileReaderClass
{
UseFileIOIfAvailableFallbackToSystemFile,
UseSystemFileOnly,
UseFileIOOnly
};
FileReaderClass m_fileReaderClass = FileReaderClass::UseFileIOIfAvailableFallbackToSystemFile;
}; };
//! Loads basic configuration files which have structures similar to Windows INI files //! Loads basic configuration files which have structures similar to Windows INI files
//! It is inspired by the Python configparser module: https://docs.python.org/3.10/library/configparser.html //! It is inspired by the Python configparser module: https://docs.python.org/3.10/library/configparser.html

@ -13,6 +13,7 @@
#include <AzCore/Component/ComponentApplicationBus.h> #include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Debug/Profiler.h> #include <AzCore/Debug/Profiler.h>
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Component/TransformBus.h> #include <AzCore/Component/TransformBus.h>
#include <AzCore/RTTI/BehaviorContext.h> #include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/std/algorithm.h> #include <AzCore/std/algorithm.h>

@ -10,6 +10,7 @@
#include <AzCore/EBus/BusImpl.h> //Just to get AZ::NullMutex #include <AzCore/EBus/BusImpl.h> //Just to get AZ::NullMutex
#include <AzCore/std/chrono/types.h> #include <AzCore/std/chrono/types.h>
#include <AzCore/Statistics/StatisticsManager.h> #include <AzCore/Statistics/StatisticsManager.h>
#include <AzCore/std/chrono/chrono.h>
#include <AzCore/std/parallel/scoped_lock.h> #include <AzCore/std/parallel/scoped_lock.h>
namespace AZ namespace AZ
@ -243,7 +244,7 @@ namespace AZ
//! This one is needed because running statistics are collected many times across //! This one is needed because running statistics are collected many times across
//! several frames. This value is used to calculate a per frame sample for @m_totalTimePerFrameStat, //! several frames. This value is used to calculate a per frame sample for @m_totalTimePerFrameStat,
//! by subtracting @m_prevAccumulatedSums from the accumulated sum in @m_statisticsManager. //! by subtracting @m_prevAccumulatedSums from the accumulated sum in @m_statisticsManager.
double m_prevAccumulatedSums; double m_prevAccumulatedSums;
}; };

@ -166,6 +166,8 @@ set(FILES
IO/FileIO.cpp IO/FileIO.cpp
IO/FileIO.h IO/FileIO.h
IO/FileIOEventBus.h IO/FileIOEventBus.h
IO/FileReader.cpp
IO/FileReader.h
IO/IOUtils.h IO/IOUtils.h
IO/IOUtils.cpp IO/IOUtils.cpp
IO/IStreamer.h IO/IStreamer.h

@ -8,6 +8,7 @@
#include <SerializeContextFixture.h> #include <SerializeContextFixture.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/std/any.h> #include <AzCore/std/any.h>
#include <AzCore/std/containers/variant.h> #include <AzCore/std/containers/variant.h>
#include <AzCore/Component/Entity.h> #include <AzCore/Component/Entity.h>

@ -6,6 +6,7 @@
* *
*/ */
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Console/IConsole.h> #include <AzCore/Console/IConsole.h>
#include <AzCore/Console/Console.h> #include <AzCore/Console/Console.h>
#include <AzCore/Interface/Interface.h> #include <AzCore/Interface/Interface.h>
@ -365,6 +366,42 @@ namespace UnitTest
}; };
static constexpr AZStd::chrono::seconds MaxDispatchTimeoutSeconds = BaseAssetManagerTest::DefaultTimeoutSeconds * 12;
template <typename Pred>
bool DispatchEventsUntilCondition(AZ::Data::AssetManager& assetManager, Pred&& conditionPredicate,
AZStd::chrono::seconds logIntervalSeconds = BaseAssetManagerTest::DefaultTimeoutSeconds,
AZStd::chrono::seconds maxTimeoutSeconds = MaxDispatchTimeoutSeconds)
{
// If the Max Timeout is hit the test will be marked as a failure
AZStd::chrono::time_point dispatchEventTimeStart = AZStd::chrono::system_clock::now();
AZStd::chrono::seconds dispatchEventNextLogTime = logIntervalSeconds;
while (!conditionPredicate())
{
AZStd::chrono::time_point currentTime = AZStd::chrono::system_clock::now();
if (AZStd::chrono::seconds elapsedTime{ currentTime - dispatchEventTimeStart };
elapsedTime >= dispatchEventNextLogTime)
{
const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info();
AZ_Printf("AssetManagerLoadingTest", "The DispatchEventsUntiTimeout function has been waiting for %llu seconds"
" in test %s.%s", elapsedTime.count(), test_info->test_case_name(), test_info->name());
// Update the next log time to be the next multiple of DefaultTimeout Seconds
// after current elapsed time
dispatchEventNextLogTime = elapsedTime + logIntervalSeconds - ((elapsedTime + logIntervalSeconds) % logIntervalSeconds);
if (elapsedTime >= maxTimeoutSeconds)
{
return false;
}
}
assetManager.DispatchEvents();
AZStd::this_thread::yield();
}
return true;
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_ASSET_MANAGER_FLOOD_TEST #if AZ_TRAIT_DISABLE_FAILED_ASSET_MANAGER_TESTS || AZ_TRAIT_DISABLE_ASSET_MANAGER_FLOOD_TEST
TEST_F(AssetJobsFloodTest, DISABLED_FloodTest) TEST_F(AssetJobsFloodTest, DISABLED_FloodTest)
#else #else
@ -1357,42 +1394,74 @@ namespace UnitTest
m_assetHandlerAndCatalog->m_numCreations = 0; m_assetHandlerAndCatalog->m_numCreations = 0;
m_assetHandlerAndCatalog->m_numDestructions = 0; m_assetHandlerAndCatalog->m_numDestructions = 0;
{ {
ContainerReadyListener containerLoadingCompleteListener(NoLoadAssetId);
OnAssetReadyListener readyListener(NoLoadAssetId, azrtti_typeid<AssetWithAssetReference>()); OnAssetReadyListener readyListener(NoLoadAssetId, azrtti_typeid<AssetWithAssetReference>());
OnAssetReadyListener depenencyListener(MyAsset2Id, azrtti_typeid<AssetWithAssetReference>()); OnAssetReadyListener dependencyListener(MyAsset2Id, azrtti_typeid<AssetWithAssetReference>());
SCOPED_TRACE("LoadDependencies_BehaviorObeyed");
auto AssetOnlyReady = [&readyListener]() -> bool
{
return readyListener.m_ready;
};
auto AssetAndDependencyReady = [&readyListener, &dependencyListener]() -> bool
{
return readyListener.m_ready && dependencyListener.m_ready;
};
auto AssetContainerReady = [&containerLoadingCompleteListener]() -> bool
{
return containerLoadingCompleteListener.m_ready;
};
auto noLoadRef = m_testAssetManager->GetAsset(NoLoadAssetId, azrtti_typeid<AssetWithAssetReference>(), auto noLoadRef = m_testAssetManager->GetAsset(NoLoadAssetId, azrtti_typeid<AssetWithAssetReference>(),
AZ::Data::AssetLoadBehavior::Default); AZ::Data::AssetLoadBehavior::Default);
auto maxTimeout = AZStd::chrono::system_clock::now() + DefaultTimeoutSeconds; // Dispatch AssetBus events until the NoLoadAssetId has signaled an OnAssetReady
// event or the timeout has been reached
EXPECT_TRUE(DispatchEventsUntilCondition(*m_testAssetManager, AssetOnlyReady))
<< "The DispatchEventsUntiTimeout function has not completed in "
<< MaxDispatchTimeoutSeconds.count() << " seconds. The test will be marked as a failure\n";
// Dispatch AssetBus events until the asset container used to load
// NoLoadAssetId has signaled an OnAssetContainerReady event
// or the timeout has been reached
// Wait until the current asset container has finished loading the NoLoadAssetId
// before trigger another load
// If the wait does not occur here, most likely what would occur is
// the AssetManager::m_ownedAssetContainers object is still loading the NoLoadAssetId
// using the default AssetLoadParameters
// If a call to GetAsset occurs at this point while the Asset is still loading
// it will ignore the new loadParams below and instead just re-use the existing
// AssetContainerReader instance, resulting in the dependent MyAsset2Id not
// being loaded
// The function that can return an existing AssetContainer instance is the
// AssetManager::GetAssetContainer. Since it can be in the middle of a load,
// updating the AssetLoadParams would have an effect on the current in progress
// load
EXPECT_TRUE(DispatchEventsUntilCondition(*m_testAssetManager, AssetContainerReady))
<< "The DispatchEventsUntiTimeout function has not completed in "
<< MaxDispatchTimeoutSeconds.count() << " seconds. The test will be marked as a failure\n";
// Reset the ContainerLoadingComplete ready status back to 0
containerLoadingCompleteListener.m_ready = 0;
while (!readyListener.m_ready)
{
m_testAssetManager->DispatchEvents();
if (AZStd::chrono::system_clock::now() > maxTimeout)
{
break;
}
AZStd::this_thread::yield();
}
EXPECT_EQ(readyListener.m_ready, 1);
EXPECT_EQ(depenencyListener.m_ready, 0);
AZ::Data::AssetLoadParameters loadParams(nullptr, AZ::Data::AssetDependencyLoadRules::LoadAll); AZ::Data::AssetLoadParameters loadParams(nullptr, AZ::Data::AssetDependencyLoadRules::LoadAll);
loadParams.m_reloadMissingDependencies = true; loadParams.m_reloadMissingDependencies = true;
auto loadDependencyRef = m_testAssetManager->GetAsset(NoLoadAssetId, azrtti_typeid<AssetWithAssetReference>(), auto loadDependencyRef = m_testAssetManager->GetAsset(NoLoadAssetId, azrtti_typeid<AssetWithAssetReference>(),
AZ::Data::AssetLoadBehavior::Default, loadParams); AZ::Data::AssetLoadBehavior::Default, loadParams);
while (!depenencyListener.m_ready || !readyListener.m_ready) // Dispatch AssetBus events until the NoLoadAssetId and the MyAsset2Id has signaled
{ // an OnAssetReady event or the timeout has been reached
m_testAssetManager->DispatchEvents(); EXPECT_TRUE(DispatchEventsUntilCondition(*m_testAssetManager, AssetAndDependencyReady))
if (AZStd::chrono::system_clock::now() > maxTimeout) << "The DispatchEventsUntiTimeout function has not completed in "
{ << MaxDispatchTimeoutSeconds.count() << " seconds. The test will be marked as a failure\n";
break;
}
AZStd::this_thread::yield();
}
EXPECT_EQ(readyListener.m_ready, 1); EXPECT_EQ(readyListener.m_ready, 1);
EXPECT_EQ(depenencyListener.m_ready, 1); EXPECT_EQ(dependencyListener.m_ready, 1);
EXPECT_TRUE(DispatchEventsUntilCondition(*m_testAssetManager, AssetContainerReady))
<< "The DispatchEventsUntiTimeout function has not completed in "
<< MaxDispatchTimeoutSeconds.count() << " seconds. The test will be marked as a failure\n";
} }
CheckFinishedCreationsAndDestructions(); CheckFinishedCreationsAndDestructions();

@ -6,6 +6,7 @@
* *
*/ */
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Console/IConsole.h> #include <AzCore/Console/IConsole.h>
#include <AzCore/Interface/Interface.h> #include <AzCore/Interface/Interface.h>
#include <AzCore/IO/SystemFile.h> #include <AzCore/IO/SystemFile.h>

@ -7,6 +7,7 @@
*/ */
#include <Tests/Asset/BaseAssetManagerTest.h> #include <Tests/Asset/BaseAssetManagerTest.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Console/IConsole.h> #include <AzCore/Console/IConsole.h>
#include <AzCore/Interface/Interface.h> #include <AzCore/Interface/Interface.h>
#include <AzCore/IO/SystemFile.h> #include <AzCore/IO/SystemFile.h>

@ -10,6 +10,7 @@
#include <AzCore/Asset/AssetJsonSerializer.h> #include <AzCore/Asset/AssetJsonSerializer.h>
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetManagerComponent.h> #include <AzCore/Asset/AssetManagerComponent.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/IO/Streamer/StreamerComponent.h> #include <AzCore/IO/Streamer/StreamerComponent.h>
#include <AzCore/Jobs/JobManagerComponent.h> #include <AzCore/Jobs/JobManagerComponent.h>
#include <AzCore/Jobs/JobManager.h> #include <AzCore/Jobs/JobManager.h>

@ -6,6 +6,7 @@
* *
*/ */
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Console/IConsole.h> #include <AzCore/Console/IConsole.h>
#include <AzCore/Interface/Interface.h> #include <AzCore/Interface/Interface.h>
#include <AzCore/IO/SystemFile.h> #include <AzCore/IO/SystemFile.h>

@ -0,0 +1,72 @@
/*
* 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
*
*/
#include <AzCore/IO/FileReader.h>
#include <FileIOBaseTestTypes.h>
#include <AzCore/UnitTest/TestTypes.h>
namespace UnitTest
{
template <typename FileIOType>
class FileReaderTestFixture
: public ScopedAllocatorSetupFixture
{
public:
void SetUp() override
{
if constexpr (AZStd::is_same_v<FileIOType, TestFileIOBase>)
{
m_fileIo = AZStd::make_unique<TestFileIOBase>();
}
}
void TearDown() override
{
m_fileIo.reset();
}
protected:
AZStd::unique_ptr<AZ::IO::FileIOBase> m_fileIo{};
};
using FileIOTypes = ::testing::Types<void, TestFileIOBase>;
TYPED_TEST_CASE(FileReaderTestFixture, FileIOTypes);
TYPED_TEST(FileReaderTestFixture, ConstructorWithFilePath_OpensFileSuccessfully)
{
AZ::IO::FileReader fileReader(this->m_fileIo.get(), AZ::IO::SystemFile::GetNullFilename());
EXPECT_TRUE(fileReader.IsOpen());
}
TYPED_TEST(FileReaderTestFixture, Open_OpensFileSucessfully)
{
AZ::IO::FileReader fileReader;
fileReader.Open(this->m_fileIo.get(), AZ::IO::SystemFile::GetNullFilename());
EXPECT_TRUE(fileReader.IsOpen());
}
TYPED_TEST(FileReaderTestFixture, Eof_OnNULDeviceFile_Succeeds)
{
AZ::IO::FileReader fileReader(this->m_fileIo.get(), AZ::IO::SystemFile::GetNullFilename());
EXPECT_TRUE(fileReader.Eof());
}
TYPED_TEST(FileReaderTestFixture, GetFilePath_ReturnsNULDeviceFilename_Succeeds)
{
AZ::IO::FileReader fileReader(this->m_fileIo.get(), AZ::IO::SystemFile::GetNullFilename());
AZ::IO::FixedMaxPath filePath;
EXPECT_TRUE(fileReader.GetFilePath(filePath));
AZ::IO::FixedMaxPath nulFilename{ AZ::IO::SystemFile::GetNullFilename() };
if (this->m_fileIo)
{
EXPECT_TRUE(this->m_fileIo->ResolvePath(nulFilename, nulFilename));
}
EXPECT_EQ(nulFilename, filePath);
}
} // namespace UnitTest

@ -9,6 +9,7 @@
#include "FileIOBaseTestTypes.h" #include "FileIOBaseTestTypes.h"
#include <AzCore/Asset/AssetManager.h> #include <AzCore/Asset/AssetManager.h>
#include <AzCore/Asset/AssetSerializer.h>
#include <AzCore/Component/ComponentApplicationBus.h> #include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Serialization/SerializeContext.h>

@ -7,6 +7,7 @@
*/ */
#include <AzCore/UnitTest/TestTypes.h> #include <AzCore/UnitTest/TestTypes.h>
#include <AzCore/Math/Uuid.h> #include <AzCore/Math/Uuid.h>
#include <AzCore/std/containers/unordered_set.h>
using namespace AZ; using namespace AZ;

@ -37,6 +37,7 @@ set(FILES
FileIOBaseTestTypes.h FileIOBaseTestTypes.h
Geometry2DUtils.cpp Geometry2DUtils.cpp
Interface.cpp Interface.cpp
IO/FileReaderTests.cpp
IO/Path/PathTests.cpp IO/Path/PathTests.cpp
IPC.cpp IPC.cpp
Jobs.cpp Jobs.cpp

@ -18,6 +18,7 @@
#include <AzCore/IO/FileIO.h> #include <AzCore/IO/FileIO.h>
#include <AzCore/IO/Path/Path.h> #include <AzCore/IO/Path/Path.h>
#include <AzCore/Memory/PoolAllocator.h> #include <AzCore/Memory/PoolAllocator.h>
#include <AzCore/std/containers/unordered_set.h>
#include <AzCore/std/smart_ptr/intrusive_base.h> #include <AzCore/std/smart_ptr/intrusive_base.h>
#include <AzFramework/Archive/Codec.h> #include <AzFramework/Archive/Codec.h>
#include <AzFramework/Archive/ZipDirStructures.h> #include <AzFramework/Archive/ZipDirStructures.h>

@ -8,7 +8,10 @@
#pragma once #pragma once
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/RTTI/TypeInfo.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/containers/vector.h>
namespace AZ namespace AZ
{ {

@ -8,6 +8,7 @@
*/ */
#include <AzFramework/Asset/AssetSeedList.h> #include <AzFramework/Asset/AssetSeedList.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AzFramework namespace AzFramework
{ {

@ -8,7 +8,6 @@
*/ */
#pragma once #pragma once
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/containers/vector.h> #include <AzCore/std/containers/vector.h>
#include <AzCore/Asset/AssetCommon.h> #include <AzCore/Asset/AssetCommon.h>
#include <AzFramework/Platform/PlatformDefaults.h> #include <AzFramework/Platform/PlatformDefaults.h>

@ -7,6 +7,7 @@
*/ */
#include <AzFramework/Asset/Benchmark/BenchmarkAsset.h> #include <AzFramework/Asset/Benchmark/BenchmarkAsset.h>
#include <AzCore/Asset/AssetSerializer.h>
namespace AzFramework namespace AzFramework
{ {

@ -7,6 +7,7 @@
*/ */
#include <AzCore/Serialization/EditContext.h> #include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzFramework/Asset/SimpleAsset.h> #include <AzFramework/Asset/SimpleAsset.h>
namespace AzFramework namespace AzFramework
@ -36,4 +37,36 @@ namespace AzFramework
return ""; return "";
} }
void SimpleAssetReferenceBase::Reflect(AZ::ReflectContext *context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<SimpleAssetReferenceBase>()
->Version(1)
->Field("AssetPath", &SimpleAssetReferenceBase::m_assetPath);
AZ::EditContext* edit = serializeContext->GetEditContext();
if (edit)
{
edit->Class<SimpleAssetReferenceBase>("Asset path", "Asset reference as a project-relative path")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide)
;
}
}
if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<SimpleAssetReferenceBase>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Category, "Asset")
->Attribute(AZ::Script::Attributes::Module, "asset")
->Property("assetPath", &SimpleAssetReferenceBase::GetAssetPath, nullptr)
->Property("assetType", &SimpleAssetReferenceBase::GetAssetType, nullptr)
->Property("fileFilter", &SimpleAssetReferenceBase::GetFileFilter, nullptr)
->Method("SetAssetPath", &SimpleAssetReferenceBase::SetAssetPath)
->Attribute(AZ::Script::Attributes::Alias, "set_asset_path")
;
}
}
} // namespace AzFramework } // namespace AzFramework

@ -42,7 +42,6 @@
*/ */
#include <AzCore/std/string/string.h> #include <AzCore/std/string/string.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h> #include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/BehaviorContext.h> #include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Component/Component.h> #include <AzCore/Component/Component.h>
@ -74,38 +73,7 @@ namespace AzFramework
virtual AZ::Data::AssetType GetAssetType() const = 0; virtual AZ::Data::AssetType GetAssetType() const = 0;
virtual const char* GetFileFilter() const = 0; virtual const char* GetFileFilter() const = 0;
static void Reflect(AZ::ReflectContext* context) static void Reflect(AZ::ReflectContext* context);
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<SimpleAssetReferenceBase>()
->Version(1)
->Field("AssetPath", &SimpleAssetReferenceBase::m_assetPath);
AZ::EditContext* edit = serializeContext->GetEditContext();
if (edit)
{
edit->Class<SimpleAssetReferenceBase>("Asset path", "Asset reference as a project-relative path")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide)
;
}
}
if (auto behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
{
behaviorContext->Class<SimpleAssetReferenceBase>()
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Category, "Asset")
->Attribute(AZ::Script::Attributes::Module, "asset")
->Property("assetPath", &SimpleAssetReferenceBase::GetAssetPath, nullptr)
->Property("assetType", &SimpleAssetReferenceBase::GetAssetType, nullptr)
->Property("fileFilter", &SimpleAssetReferenceBase::GetFileFilter, nullptr)
->Method("SetAssetPath", &SimpleAssetReferenceBase::SetAssetPath)
->Attribute(AZ::Script::Attributes::Alias, "set_asset_path")
;
}
}
protected: protected:

@ -9,6 +9,7 @@
#pragma once #pragma once
#include <AzCore/std/containers/vector.h> #include <AzCore/std/containers/vector.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/RTTI/BehaviorContext.h> #include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/RTTI/ReflectContext.h> #include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Serialization/EditContext.h> #include <AzCore/Serialization/EditContext.h>

@ -10,6 +10,11 @@
#include <AzCore/EBus/EBus.h> #include <AzCore/EBus/EBus.h>
namespace AZ
{
class Entity;
}
namespace AzFramework namespace AzFramework
{ {
using EntityContextId = AZ::Uuid; using EntityContextId = AZ::Uuid;

@ -91,15 +91,6 @@ namespace AzFramework
*/ */
virtual void DestroyGameEntity(const AZ::EntityId& /*id*/) = 0; virtual void DestroyGameEntity(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity only in slice mode (when prefabs are disabled). This request is only added as a stop-gap solution
* to prevent the editor from crashing when prefabs are enabled and must only be called through the BehaviorContext binding
* for 'DestroyGameEntity'. No code should be written to directly call this method. This will be removed soon.
*
* @param id The ID of the entity to destroy.
*/
virtual void DestroyGameEntityOnlyInSliceMode(const AZ::EntityId& /*id*/) = 0;
/** /**
* Destroys an entity and all of its descendants. * Destroys an entity and all of its descendants.
* The entity and its descendants are immediately deactivated and will be * The entity and its descendants are immediately deactivated and will be
@ -108,15 +99,6 @@ namespace AzFramework
*/ */
virtual void DestroyGameEntityAndDescendants(const AZ::EntityId& /*id*/) = 0; virtual void DestroyGameEntityAndDescendants(const AZ::EntityId& /*id*/) = 0;
/**
* Destroys an entity and its descendants only in slice mode (when prefabs are disabled). This request is only added as a stop-gap
* solution to prevent the editor from crashing when prefabs are enabled and must only be called through the BehaviorContext
* binding for 'DestroyGameEntityAndDescendants'.No code should be written to directly call this method. This will be removed soon.
*
* @param id The ID of the entity to destroy.
*/
virtual void DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId& /*id*/) = 0;
/** /**
* Activates the game entity. * Activates the game entity.
* @param id The ID of the entity to activate. * @param id The ID of the entity to activate.

@ -11,9 +11,10 @@
#include <AzCore/Serialization/SerializeContext.h> #include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h> #include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/BehaviorContext.h> #include <AzCore/RTTI/BehaviorContext.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/Entity/EntityContext.h> #include <AzFramework/Entity/EntityContext.h>
#include <AzFramework/Components/TransformComponent.h> #include <AzFramework/Components/TransformComponent.h>
#include <AzFramework/API/ApplicationAPI.h> #include <AzFramework/Spawnable/SpawnableEntitiesInterface.h>
#include "GameEntityContextComponent.h" #include "GameEntityContextComponent.h"
@ -47,9 +48,9 @@ namespace AzFramework
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Event("CreateGameEntity", &GameEntityContextRequestBus::Events::CreateGameEntityForBehaviorContext) ->Event("CreateGameEntity", &GameEntityContextRequestBus::Events::CreateGameEntityForBehaviorContext)
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
->Event("DestroyGameEntity", &GameEntityContextRequestBus::Events::DestroyGameEntityOnlyInSliceMode) ->Event("DestroyGameEntity", &GameEntityContextRequestBus::Events::DestroyGameEntity)
->Event( ->Event(
"DestroyGameEntityAndDescendants", &GameEntityContextRequestBus::Events::DestroyGameEntityAndDescendantsOnlyInSliceMode) "DestroyGameEntityAndDescendants", &GameEntityContextRequestBus::Events::DestroyGameEntityAndDescendants)
->Event("ActivateGameEntity", &GameEntityContextRequestBus::Events::ActivateGameEntity) ->Event("ActivateGameEntity", &GameEntityContextRequestBus::Events::ActivateGameEntity)
->Event("DeactivateGameEntity", &GameEntityContextRequestBus::Events::DeactivateGameEntity) ->Event("DeactivateGameEntity", &GameEntityContextRequestBus::Events::DeactivateGameEntity)
->Attribute(AZ::ScriptCanvasAttributes::DeactivatesInputEntity, true) ->Attribute(AZ::ScriptCanvasAttributes::DeactivatesInputEntity, true)
@ -249,23 +250,6 @@ namespace AzFramework
DestroyGameEntityInternal(id, false); DestroyGameEntityInternal(id, false);
} }
void GameEntityContextComponent::DestroyGameEntityOnlyInSliceMode(const AZ::EntityId& id)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (!isPrefabSystemEnabled)
{
DestroyGameEntityInternal(id, false);
}
else
{
AZ_Error(
"GameEntityContextComponent", false,
"Destroying a game entity is temporarily disabled until the Spawnable system can support this.");
}
}
//========================================================================= //=========================================================================
// GameEntityContextComponent::DestroyGameEntityAndDescendantsById // GameEntityContextComponent::DestroyGameEntityAndDescendantsById
//========================================================================= //=========================================================================
@ -274,24 +258,6 @@ namespace AzFramework
DestroyGameEntityInternal(id, true); DestroyGameEntityInternal(id, true);
} }
void GameEntityContextComponent::DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId& id)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (!isPrefabSystemEnabled)
{
DestroyGameEntityInternal(id, true);
}
else
{
AZ_Error(
"GameEntityContextComponent", false,
"Destroying a game entity and its descendants is temporarily disabled until the Spawnable system can support this.");
}
}
//========================================================================= //=========================================================================
// GameEntityContextComponent::DestroyGameEntityInternal // GameEntityContextComponent::DestroyGameEntityInternal
//========================================================================= //=========================================================================
@ -319,6 +285,28 @@ namespace AzFramework
EBUS_EVENT_RESULT(currentEntity, AZ::ComponentApplicationBus, FindEntity, *entityIdIter); EBUS_EVENT_RESULT(currentEntity, AZ::ComponentApplicationBus, FindEntity, *entityIdIter);
if (currentEntity) if (currentEntity)
{ {
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (isPrefabSystemEnabled)
{
if (currentEntity->GetSpawnTicketId() > 0)
{
SpawnableEntitiesDefinition* spawnableEntitiesInterface = SpawnableEntitiesInterface::Get();
AZ_Assert(spawnableEntitiesInterface != nullptr, "SpawnableEntitiesInterface is not found.");
spawnableEntitiesInterface->RetrieveEntitySpawnTicket(
currentEntity->GetSpawnTicketId(),
[spawnableEntitiesInterface, currentEntity](EntitySpawnTicket* entitySpawnTicket)
{
if (entitySpawnTicket != nullptr)
{
spawnableEntitiesInterface->DespawnEntity(currentEntity->GetId(), *entitySpawnTicket);
}
});
return;
}
}
if (currentEntity->GetState() == AZ::Entity::State::Active) if (currentEntity->GetState() == AZ::Entity::State::Active)
{ {
// Deactivate the entity, we'll destroy it as soon as it is safe. // Deactivate the entity, we'll destroy it as soon as it is safe.

@ -90,11 +90,6 @@ namespace AzFramework
} }
private: private:
//////////////////////////////////////////////////////////////////////////
// GameEntityContextRequestBus
void DestroyGameEntityOnlyInSliceMode(const AZ::EntityId&) override;
void DestroyGameEntityAndDescendantsOnlyInSliceMode(const AZ::EntityId&) override;
/////////////////////////////////////////////////////////////////////////
AzFramework::EntityVisibilityBoundsUnionSystem m_entityVisibilityBoundsUnionSystem; AzFramework::EntityVisibilityBoundsUnionSystem m_entityVisibilityBoundsUnionSystem;
}; };

@ -28,34 +28,10 @@ namespace AzFramework
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////
InputChannelId::InputChannelId(const char* name)
: m_crc32(name)
{
memset(m_name, 0, AZ_ARRAY_SIZE(m_name));
azstrncpy(m_name, NAME_BUFFER_SIZE, name, MAX_NAME_LENGTH);
}
////////////////////////////////////////////////////////////////////////////////////////////////
InputChannelId::InputChannelId(const InputChannelId& other)
: m_crc32(other.m_crc32)
{
memset(m_name, 0, AZ_ARRAY_SIZE(m_name));
azstrcpy(m_name, NAME_BUFFER_SIZE, other.m_name);
}
////////////////////////////////////////////////////////////////////////////////////////////////
InputChannelId& InputChannelId::operator=(const InputChannelId& other)
{
azstrcpy(m_name, NAME_BUFFER_SIZE, other.m_name);
m_crc32 = other.m_crc32;
return *this;
}
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
const char* InputChannelId::GetName() const const char* InputChannelId::GetName() const
{ {
return m_name; return m_name.c_str();
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////

@ -11,6 +11,7 @@
#include <AzCore/Math/Crc.h> #include <AzCore/Math/Crc.h>
#include <AzCore/RTTI/ReflectContext.h> #include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/std/hash.h> #include <AzCore/std/hash.h>
#include <AzCore/std/string/fixed_string.h>
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
namespace AzFramework namespace AzFramework
@ -22,8 +23,7 @@ namespace AzFramework
public: public:
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Constants // Constants
static const int NAME_BUFFER_SIZE = 64; static constexpr int MAX_NAME_LENGTH = 64;
static const int MAX_NAME_LENGTH = NAME_BUFFER_SIZE - 1;
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Allocator // Allocator
@ -39,21 +39,28 @@ namespace AzFramework
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
//! Constructor //! Constructor
//! \param[in] name Name of the input channel (will be truncated if exceeds MAX_NAME_LENGTH) //! \param[in] name Name of the input channel (will be ignored if exceeds MAX_NAME_LENGTH)
explicit InputChannelId(const char* name = ""); explicit constexpr InputChannelId(AZStd::string_view name = "")
: m_name(name)
//////////////////////////////////////////////////////////////////////////////////////////// , m_crc32(name)
//! Copy constructor {
//! \param[in] other Another instance of the class to copy from }
InputChannelId(const InputChannelId& other);
////////////////////////////////////////////////////////////////////////////////////////////
//! Copy assignment operator
//! \param[in] other Another instance of the class to copy from
InputChannelId& operator=(const InputChannelId& other);
//////////////////////////////////////////////////////////////////////////////////////////// constexpr InputChannelId(const InputChannelId& other) = default;
//! Default destructor constexpr InputChannelId(InputChannelId&& other) = default;
constexpr InputChannelId& operator=(const InputChannelId& other)
{
m_name = other.m_name;
m_crc32 = other.m_crc32;
return *this;
}
constexpr InputChannelId& operator=(InputChannelId&& other)
{
m_name = AZStd::move(other.m_name);
m_crc32 = AZStd::move(other.m_crc32);
other.m_crc32 = 0;
return *this;
}
~InputChannelId() = default; ~InputChannelId() = default;
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
@ -77,7 +84,7 @@ namespace AzFramework
private: private:
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// Variables // Variables
char m_name[NAME_BUFFER_SIZE]; //!< Name of the input channel AZStd::fixed_string<MAX_NAME_LENGTH> m_name; //!< Name of the input channel
AZ::Crc32 m_crc32; //!< Crc32 of the input channel AZ::Crc32 m_crc32; //!< Crc32 of the input channel
}; };
} // namespace AzFramework } // namespace AzFramework

@ -28,91 +28,6 @@ namespace AzFramework
return (inputDeviceId.GetNameCrc32() == IdForIndex0.GetNameCrc32()); return (inputDeviceId.GetNameCrc32() == IdForIndex0.GetNameCrc32());
} }
////////////////////////////////////////////////////////////////////////////////////////////////
const InputChannelId InputDeviceGamepad::Button::A("gamepad_button_a");
const InputChannelId InputDeviceGamepad::Button::B("gamepad_button_b");
const InputChannelId InputDeviceGamepad::Button::X("gamepad_button_x");
const InputChannelId InputDeviceGamepad::Button::Y("gamepad_button_y");
const InputChannelId InputDeviceGamepad::Button::L1("gamepad_button_l1");
const InputChannelId InputDeviceGamepad::Button::R1("gamepad_button_r1");
const InputChannelId InputDeviceGamepad::Button::L3("gamepad_button_l3");
const InputChannelId InputDeviceGamepad::Button::R3("gamepad_button_r3");
const InputChannelId InputDeviceGamepad::Button::DU("gamepad_button_d_up");
const InputChannelId InputDeviceGamepad::Button::DD("gamepad_button_d_down");
const InputChannelId InputDeviceGamepad::Button::DL("gamepad_button_d_left");
const InputChannelId InputDeviceGamepad::Button::DR("gamepad_button_d_right");
const InputChannelId InputDeviceGamepad::Button::Start("gamepad_button_start");
const InputChannelId InputDeviceGamepad::Button::Select("gamepad_button_select");
const AZStd::array<InputChannelId, 14> InputDeviceGamepad::Button::All =
{{
A,
B,
X,
Y,
L1,
R1,
L3,
R3,
DU,
DD,
DL,
DR,
Start,
Select
}};
////////////////////////////////////////////////////////////////////////////////////////////////
const InputChannelId InputDeviceGamepad::Trigger::L2("gamepad_trigger_l2");
const InputChannelId InputDeviceGamepad::Trigger::R2("gamepad_trigger_r2");
const AZStd::array<InputChannelId, 2> InputDeviceGamepad::Trigger::All =
{{
L2,
R2
}};
////////////////////////////////////////////////////////////////////////////////////////////////
const InputChannelId InputDeviceGamepad::ThumbStickAxis2D::L("gamepad_thumbstick_l");
const InputChannelId InputDeviceGamepad::ThumbStickAxis2D::R("gamepad_thumbstick_r");
const AZStd::array<InputChannelId, 2> InputDeviceGamepad::ThumbStickAxis2D::All =
{{
L,
R
}};
////////////////////////////////////////////////////////////////////////////////////////////////
const InputChannelId InputDeviceGamepad::ThumbStickAxis1D::LX("gamepad_thumbstick_l_x");
const InputChannelId InputDeviceGamepad::ThumbStickAxis1D::LY("gamepad_thumbstick_l_y");
const InputChannelId InputDeviceGamepad::ThumbStickAxis1D::RX("gamepad_thumbstick_r_x");
const InputChannelId InputDeviceGamepad::ThumbStickAxis1D::RY("gamepad_thumbstick_r_y");
const AZStd::array<InputChannelId, 4> InputDeviceGamepad::ThumbStickAxis1D::All =
{{
LX,
LY,
RX,
RY
}};
////////////////////////////////////////////////////////////////////////////////////////////////
const InputChannelId InputDeviceGamepad::ThumbStickDirection::LU("gamepad_thumbstick_l_up");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::LD("gamepad_thumbstick_l_down");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::LL("gamepad_thumbstick_l_left");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::LR("gamepad_thumbstick_l_right");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::RU("gamepad_thumbstick_r_up");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::RD("gamepad_thumbstick_r_down");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::RL("gamepad_thumbstick_r_left");
const InputChannelId InputDeviceGamepad::ThumbStickDirection::RR("gamepad_thumbstick_r_right");
const AZStd::array<InputChannelId, 8> InputDeviceGamepad::ThumbStickDirection::All =
{{
LU,
LD,
LL,
LR,
RU,
RD,
RL,
RR
}};
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
void InputDeviceGamepad::Reflect(AZ::ReflectContext* context) void InputDeviceGamepad::Reflect(AZ::ReflectContext* context)
{ {

@ -59,75 +59,115 @@ namespace AzFramework
//! All the input channel ids that identify game-pad digital button input //! All the input channel ids that identify game-pad digital button input
struct Button struct Button
{ {
static const InputChannelId A; //!< The bottom diamond face button static constexpr inline InputChannelId A{"gamepad_button_a"}; //!< The bottom diamond face button
static const InputChannelId B; //!< The right diamond face button static constexpr inline InputChannelId B{"gamepad_button_b"}; //!< The right diamond face button
static const InputChannelId X; //!< The left diamond face button static constexpr inline InputChannelId X{"gamepad_button_x"}; //!< The left diamond face button
static const InputChannelId Y; //!< The top diamond face button static constexpr inline InputChannelId Y{"gamepad_button_y"}; //!< The top diamond face button
static const InputChannelId L1; //!< The top-left shoulder bumper button static constexpr inline InputChannelId L1{"gamepad_button_l1"}; //!< The top-left shoulder bumper button
static const InputChannelId R1; //!< The top-right shoulder bumper button static constexpr inline InputChannelId R1{"gamepad_button_r1"}; //!< The top-right shoulder bumper button
static const InputChannelId L3; //!< The left thumb-stick click button static constexpr inline InputChannelId L3{"gamepad_button_l3"}; //!< The left thumb-stick click button
static const InputChannelId R3; //!< The right thumb-stick click button static constexpr inline InputChannelId R3{"gamepad_button_r3"}; //!< The right thumb-stick click button
static const InputChannelId DU; //!< The up directional pad button static constexpr inline InputChannelId DU{"gamepad_button_d_up"}; //!< The up directional pad button
static const InputChannelId DD; //!< The down directional pad button static constexpr inline InputChannelId DD{"gamepad_button_d_down"}; //!< The down directional pad button
static const InputChannelId DL; //!< The left directional pad button static constexpr inline InputChannelId DL{"gamepad_button_d_left"}; //!< The left directional pad button
static const InputChannelId DR; //!< The right directional pad button static constexpr inline InputChannelId DR{"gamepad_button_d_right"}; //!< The right directional pad button
static const InputChannelId Start; //!< The start/pause/options button static constexpr inline InputChannelId Start{"gamepad_button_start"}; //!< The start/pause/options button
static const InputChannelId Select; //!< The select/back button static constexpr inline InputChannelId Select{"gamepad_button_select"}; //!< The select/back button
//!< All digital game-pad button ids //!< All digital game-pad button ids
static const AZStd::array<InputChannelId, 14> All; static constexpr inline AZStd::array All
{
A,
B,
X,
Y,
L1,
R1,
L3,
R3,
DU,
DD,
DL,
DR,
Start,
Select
};
}; };
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
//! All the input channel ids that identify game-pad analog trigger input //! All the input channel ids that identify game-pad analog trigger input
struct Trigger struct Trigger
{ {
static const InputChannelId L2; //!< The bottom-left shoulder trigger static constexpr inline InputChannelId L2{"gamepad_trigger_l2"}; //!< The bottom-left shoulder trigger
static const InputChannelId R2; //!< The bottom-right shoulder trigger static constexpr inline InputChannelId R2{"gamepad_trigger_r2"}; //!< The bottom-right shoulder trigger
//!< All analog game-pad trigger ids //!< All analog game-pad trigger ids
static const AZStd::array<InputChannelId, 2> All; static constexpr inline AZStd::array All
{
L2,
R2
};
}; };
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
//! All the input channel ids that identify game-pad thumb-stick 2D axis input //! All the input channel ids that identify game-pad thumb-stick 2D axis input
struct ThumbStickAxis2D struct ThumbStickAxis2D
{ {
static const InputChannelId L; //!< The left-hand thumb-stick static constexpr inline InputChannelId L{"gamepad_thumbstick_l"}; //!< The left-hand thumb-stick
static const InputChannelId R; //!< The right-hand thumb-stick static constexpr inline InputChannelId R{"gamepad_thumbstick_r"}; //!< The right-hand thumb-stick
//!< All game-pad thumb-stick 2D axis input channel ids //!< All game-pad thumb-stick 2D axis input channel ids
static const AZStd::array<InputChannelId, 2> All; static constexpr inline AZStd::array All
{
L,
R
};
}; };
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
//! All the input channel ids that identify game-pad thumb-stick 1D axis input //! All the input channel ids that identify game-pad thumb-stick 1D axis input
struct ThumbStickAxis1D struct ThumbStickAxis1D
{ {
static const InputChannelId LX; //!< X-axis of the left-hand thumb-stick static constexpr inline InputChannelId LX{"gamepad_thumbstick_l_x"}; //!< X-axis of the left-hand thumb-stick
static const InputChannelId LY; //!< Y-axis of the left-hand thumb-stick static constexpr inline InputChannelId LY{"gamepad_thumbstick_l_y"}; //!< Y-axis of the left-hand thumb-stick
static const InputChannelId RX; //!< X-axis of the right-hand thumb-stick static constexpr inline InputChannelId RX{"gamepad_thumbstick_r_x"}; //!< X-axis of the right-hand thumb-stick
static const InputChannelId RY; //!< Y-axis of the right-hand thumb-stick static constexpr inline InputChannelId RY{"gamepad_thumbstick_r_y"}; //!< Y-axis of the right-hand thumb-stick
//!< All game-pad thumb-stick 1D axis input channel ids //!< All game-pad thumb-stick 1D axis input channel ids
static const AZStd::array<InputChannelId, 4> All; static constexpr inline AZStd::array All
{
LX,
LY,
RX,
RY
};
}; };
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
//! All the input channel ids that identify game-pad thumb-stick directional input //! All the input channel ids that identify game-pad thumb-stick directional input
struct ThumbStickDirection struct ThumbStickDirection
{ {
static const InputChannelId LU; //!< Up on the left-hand thumb-stick static constexpr inline InputChannelId LU{"gamepad_thumbstick_l_up"}; //!< Up on the left-hand thumb-stick
static const InputChannelId LD; //!< Down on the left-hand thumb-stick static constexpr inline InputChannelId LD{"gamepad_thumbstick_l_down"}; //!< Down on the left-hand thumb-stick
static const InputChannelId LL; //!< Left on the left-hand thumb-stick static constexpr inline InputChannelId LL{"gamepad_thumbstick_l_left"}; //!< Left on the left-hand thumb-stick
static const InputChannelId LR; //!< Right on the left-hand thumb-stick static constexpr inline InputChannelId LR{"gamepad_thumbstick_l_right"}; //!< Right on the left-hand thumb-stick
static const InputChannelId RU; //!< Up on the left-hand thumb-stick static constexpr inline InputChannelId RU{"gamepad_thumbstick_r_up"}; //!< Up on the left-hand thumb-stick
static const InputChannelId RD; //!< Down on the left-hand thumb-stick static constexpr inline InputChannelId RD{"gamepad_thumbstick_r_down"}; //!< Down on the left-hand thumb-stick
static const InputChannelId RL; //!< Left on the left-hand thumb-stick static constexpr inline InputChannelId RL{"gamepad_thumbstick_r_left"}; //!< Left on the left-hand thumb-stick
static const InputChannelId RR; //!< Right on the left-hand thumb-stick static constexpr inline InputChannelId RR{"gamepad_thumbstick_r_right"}; //!< Right on the left-hand thumb-stick
//!< All game-pad thumb-stick directional input channel ids //!< All game-pad thumb-stick directional input channel ids
static const AZStd::array<InputChannelId, 8> All; static constexpr inline AZStd::array All
{
LU,
LD,
LL,
LR,
RU,
RD,
RL,
RR
};
}; };
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////

@ -24,279 +24,6 @@ namespace AzFramework
return (inputDeviceId.GetNameCrc32() == Id.GetNameCrc32()); return (inputDeviceId.GetNameCrc32() == Id.GetNameCrc32());
} }
////////////////////////////////////////////////////////////////////////////////////////////////
// Alphanumeric Keys
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric0("keyboard_key_alphanumeric_0");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric1("keyboard_key_alphanumeric_1");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric2("keyboard_key_alphanumeric_2");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric3("keyboard_key_alphanumeric_3");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric4("keyboard_key_alphanumeric_4");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric5("keyboard_key_alphanumeric_5");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric6("keyboard_key_alphanumeric_6");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric7("keyboard_key_alphanumeric_7");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric8("keyboard_key_alphanumeric_8");
const InputChannelId InputDeviceKeyboard::Key::Alphanumeric9("keyboard_key_alphanumeric_9");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericA("keyboard_key_alphanumeric_A");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericB("keyboard_key_alphanumeric_B");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericC("keyboard_key_alphanumeric_C");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericD("keyboard_key_alphanumeric_D");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericE("keyboard_key_alphanumeric_E");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericF("keyboard_key_alphanumeric_F");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericG("keyboard_key_alphanumeric_G");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericH("keyboard_key_alphanumeric_H");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericI("keyboard_key_alphanumeric_I");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericJ("keyboard_key_alphanumeric_J");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericK("keyboard_key_alphanumeric_K");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericL("keyboard_key_alphanumeric_L");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericM("keyboard_key_alphanumeric_M");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericN("keyboard_key_alphanumeric_N");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericO("keyboard_key_alphanumeric_O");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericP("keyboard_key_alphanumeric_P");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericQ("keyboard_key_alphanumeric_Q");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericR("keyboard_key_alphanumeric_R");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericS("keyboard_key_alphanumeric_S");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericT("keyboard_key_alphanumeric_T");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericU("keyboard_key_alphanumeric_U");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericV("keyboard_key_alphanumeric_V");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericW("keyboard_key_alphanumeric_W");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericX("keyboard_key_alphanumeric_X");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericY("keyboard_key_alphanumeric_Y");
const InputChannelId InputDeviceKeyboard::Key::AlphanumericZ("keyboard_key_alphanumeric_Z");
////////////////////////////////////////////////////////////////////////////////////////////////
// Edit (and escape) Keys
const InputChannelId InputDeviceKeyboard::Key::EditBackspace("keyboard_key_edit_backspace");
const InputChannelId InputDeviceKeyboard::Key::EditCapsLock("keyboard_key_edit_capslock");
const InputChannelId InputDeviceKeyboard::Key::EditEnter("keyboard_key_edit_enter");
const InputChannelId InputDeviceKeyboard::Key::EditSpace("keyboard_key_edit_space");
const InputChannelId InputDeviceKeyboard::Key::EditTab("keyboard_key_edit_tab");
const InputChannelId InputDeviceKeyboard::Key::Escape("keyboard_key_escape");
////////////////////////////////////////////////////////////////////////////////////////////////
// Function Keys
const InputChannelId InputDeviceKeyboard::Key::Function01("keyboard_key_function_F01");
const InputChannelId InputDeviceKeyboard::Key::Function02("keyboard_key_function_F02");
const InputChannelId InputDeviceKeyboard::Key::Function03("keyboard_key_function_F03");
const InputChannelId InputDeviceKeyboard::Key::Function04("keyboard_key_function_F04");
const InputChannelId InputDeviceKeyboard::Key::Function05("keyboard_key_function_F05");
const InputChannelId InputDeviceKeyboard::Key::Function06("keyboard_key_function_F06");
const InputChannelId InputDeviceKeyboard::Key::Function07("keyboard_key_function_F07");
const InputChannelId InputDeviceKeyboard::Key::Function08("keyboard_key_function_F08");
const InputChannelId InputDeviceKeyboard::Key::Function09("keyboard_key_function_F09");
const InputChannelId InputDeviceKeyboard::Key::Function10("keyboard_key_function_F10");
const InputChannelId InputDeviceKeyboard::Key::Function11("keyboard_key_function_F11");
const InputChannelId InputDeviceKeyboard::Key::Function12("keyboard_key_function_F12");
const InputChannelId InputDeviceKeyboard::Key::Function13("keyboard_key_function_F13");
const InputChannelId InputDeviceKeyboard::Key::Function14("keyboard_key_function_F14");
const InputChannelId InputDeviceKeyboard::Key::Function15("keyboard_key_function_F15");
const InputChannelId InputDeviceKeyboard::Key::Function16("keyboard_key_function_F16");
const InputChannelId InputDeviceKeyboard::Key::Function17("keyboard_key_function_F17");
const InputChannelId InputDeviceKeyboard::Key::Function18("keyboard_key_function_F18");
const InputChannelId InputDeviceKeyboard::Key::Function19("keyboard_key_function_F19");
const InputChannelId InputDeviceKeyboard::Key::Function20("keyboard_key_function_F20");
////////////////////////////////////////////////////////////////////////////////////////////////
// Modifier Keys
const InputChannelId InputDeviceKeyboard::Key::ModifierAltL("keyboard_key_modifier_alt_l");
const InputChannelId InputDeviceKeyboard::Key::ModifierAltR("keyboard_key_modifier_alt_r");
const InputChannelId InputDeviceKeyboard::Key::ModifierCtrlL("keyboard_key_modifier_ctrl_l");
const InputChannelId InputDeviceKeyboard::Key::ModifierCtrlR("keyboard_key_modifier_ctrl_r");
const InputChannelId InputDeviceKeyboard::Key::ModifierShiftL("keyboard_key_modifier_shift_l");
const InputChannelId InputDeviceKeyboard::Key::ModifierShiftR("keyboard_key_modifier_shift_r");
const InputChannelId InputDeviceKeyboard::Key::ModifierSuperL("keyboard_key_modifier_super_l");
const InputChannelId InputDeviceKeyboard::Key::ModifierSuperR("keyboard_key_modifier_super_r");
////////////////////////////////////////////////////////////////////////////////////////////////
// Navigation Keys
const InputChannelId InputDeviceKeyboard::Key::NavigationArrowDown("keyboard_key_navigation_arrow_down");
const InputChannelId InputDeviceKeyboard::Key::NavigationArrowLeft("keyboard_key_navigation_arrow_left");
const InputChannelId InputDeviceKeyboard::Key::NavigationArrowRight("keyboard_key_navigation_arrow_right");
const InputChannelId InputDeviceKeyboard::Key::NavigationArrowUp("keyboard_key_navigation_arrow_up");
const InputChannelId InputDeviceKeyboard::Key::NavigationDelete("keyboard_key_navigation_delete");
const InputChannelId InputDeviceKeyboard::Key::NavigationEnd("keyboard_key_navigation_end");
const InputChannelId InputDeviceKeyboard::Key::NavigationHome("keyboard_key_navigation_home");
const InputChannelId InputDeviceKeyboard::Key::NavigationInsert("keyboard_key_navigation_insert");
const InputChannelId InputDeviceKeyboard::Key::NavigationPageDown("keyboard_key_navigation_page_down");
const InputChannelId InputDeviceKeyboard::Key::NavigationPageUp("keyboard_key_navigation_page_up");
////////////////////////////////////////////////////////////////////////////////////////////////
// Numpad Keys
const InputChannelId InputDeviceKeyboard::Key::NumLock("keyboard_key_num_lock");
const InputChannelId InputDeviceKeyboard::Key::NumPad0("keyboard_key_numpad_0");
const InputChannelId InputDeviceKeyboard::Key::NumPad1("keyboard_key_numpad_1");
const InputChannelId InputDeviceKeyboard::Key::NumPad2("keyboard_key_numpad_2");
const InputChannelId InputDeviceKeyboard::Key::NumPad3("keyboard_key_numpad_3");
const InputChannelId InputDeviceKeyboard::Key::NumPad4("keyboard_key_numpad_4");
const InputChannelId InputDeviceKeyboard::Key::NumPad5("keyboard_key_numpad_5");
const InputChannelId InputDeviceKeyboard::Key::NumPad6("keyboard_key_numpad_6");
const InputChannelId InputDeviceKeyboard::Key::NumPad7("keyboard_key_numpad_7");
const InputChannelId InputDeviceKeyboard::Key::NumPad8("keyboard_key_numpad_8");
const InputChannelId InputDeviceKeyboard::Key::NumPad9("keyboard_key_numpad_9");
const InputChannelId InputDeviceKeyboard::Key::NumPadAdd("keyboard_key_numpad_add");
const InputChannelId InputDeviceKeyboard::Key::NumPadDecimal("keyboard_key_numpad_decimal");
const InputChannelId InputDeviceKeyboard::Key::NumPadDivide("keyboard_key_numpad_divide");
const InputChannelId InputDeviceKeyboard::Key::NumPadEnter("keyboard_key_numpad_enter");
const InputChannelId InputDeviceKeyboard::Key::NumPadMultiply("keyboard_key_numpad_multiply");
const InputChannelId InputDeviceKeyboard::Key::NumPadSubtract("keyboard_key_numpad_subtract");
////////////////////////////////////////////////////////////////////////////////////////////////
// Punctuation Keys
const InputChannelId InputDeviceKeyboard::Key::PunctuationApostrophe("keyboard_key_punctuation_apostrophe");
const InputChannelId InputDeviceKeyboard::Key::PunctuationBackslash("keyboard_key_punctuation_backslash");
const InputChannelId InputDeviceKeyboard::Key::PunctuationBracketL("keyboard_key_punctuation_bracket_l");
const InputChannelId InputDeviceKeyboard::Key::PunctuationBracketR("keyboard_key_punctuation_bracket_r");
const InputChannelId InputDeviceKeyboard::Key::PunctuationComma("keyboard_key_punctuation_comma");
const InputChannelId InputDeviceKeyboard::Key::PunctuationEquals("keyboard_key_punctuation_equals");
const InputChannelId InputDeviceKeyboard::Key::PunctuationHyphen("keyboard_key_punctuation_hyphen");
const InputChannelId InputDeviceKeyboard::Key::PunctuationPeriod("keyboard_key_punctuation_period");
const InputChannelId InputDeviceKeyboard::Key::PunctuationSemicolon("keyboard_key_punctuation_semicolon");
const InputChannelId InputDeviceKeyboard::Key::PunctuationSlash("keyboard_key_punctuation_slash");
const InputChannelId InputDeviceKeyboard::Key::PunctuationTilde("keyboard_key_punctuation_tilde");
////////////////////////////////////////////////////////////////////////////////////////////////
// Supplementary ISO Key
const InputChannelId InputDeviceKeyboard::Key::SupplementaryISO("keyboard_key_supplementary_iso");
////////////////////////////////////////////////////////////////////////////////////////////////
// Windows System Keys
const InputChannelId InputDeviceKeyboard::Key::WindowsSystemPause("keyboard_key_windows_system_pause");
const InputChannelId InputDeviceKeyboard::Key::WindowsSystemPrint("keyboard_key_windows_system_print");
const InputChannelId InputDeviceKeyboard::Key::WindowsSystemScrollLock("keyboard_key_windows_system_scroll_lock");
////////////////////////////////////////////////////////////////////////////////////////////////
const AZStd::array<InputChannelId, 112> InputDeviceKeyboard::Key::All =
{{
// Alphanumeric Keys
Alphanumeric0,
Alphanumeric1,
Alphanumeric2,
Alphanumeric3,
Alphanumeric4,
Alphanumeric5,
Alphanumeric6,
Alphanumeric7,
Alphanumeric8,
Alphanumeric9,
AlphanumericA,
AlphanumericB,
AlphanumericC,
AlphanumericD,
AlphanumericE,
AlphanumericF,
AlphanumericG,
AlphanumericH,
AlphanumericI,
AlphanumericJ,
AlphanumericK,
AlphanumericL,
AlphanumericM,
AlphanumericN,
AlphanumericO,
AlphanumericP,
AlphanumericQ,
AlphanumericR,
AlphanumericS,
AlphanumericT,
AlphanumericU,
AlphanumericV,
AlphanumericW,
AlphanumericX,
AlphanumericY,
AlphanumericZ,
// Edit (and escape) Keys
EditBackspace,
EditCapsLock,
EditEnter,
EditSpace,
EditTab,
Escape,
// Function Keys
Function01,
Function02,
Function03,
Function04,
Function05,
Function06,
Function07,
Function08,
Function09,
Function10,
Function11,
Function12,
Function13,
Function14,
Function15,
Function16,
Function17,
Function18,
Function19,
Function20,
// Modifier Keys
ModifierAltL,
ModifierAltR,
ModifierCtrlL,
ModifierCtrlR,
ModifierShiftL,
ModifierShiftR,
ModifierSuperL,
ModifierSuperR,
// Navigation Keys
NavigationArrowDown,
NavigationArrowLeft,
NavigationArrowRight,
NavigationArrowUp,
NavigationDelete,
NavigationEnd,
NavigationHome,
NavigationInsert,
NavigationPageDown,
NavigationPageUp,
// Numpad Keys
NumLock,
NumPad0,
NumPad1,
NumPad2,
NumPad3,
NumPad4,
NumPad5,
NumPad6,
NumPad7,
NumPad8,
NumPad9,
NumPadAdd,
NumPadDecimal,
NumPadDivide,
NumPadEnter,
NumPadMultiply,
NumPadSubtract,
// Punctuation Keys
PunctuationApostrophe,
PunctuationBackslash,
PunctuationBracketL,
PunctuationBracketR,
PunctuationComma,
PunctuationEquals,
PunctuationHyphen,
PunctuationPeriod,
PunctuationSemicolon,
PunctuationSlash,
PunctuationTilde,
// Supplementary ISO Key
SupplementaryISO,
// Windows System Keys
WindowsSystemPause,
WindowsSystemPrint,
WindowsSystemScrollLock
}};
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
ModifierKeyMask GetCorrespondingModifierKeyMask(const InputChannelId& channelId) ModifierKeyMask GetCorrespondingModifierKeyMask(const InputChannelId& channelId)
{ {

@ -94,137 +94,268 @@ namespace AzFramework
struct Key struct Key
{ {
// Alphanumeric Keys // Alphanumeric Keys
static const InputChannelId Alphanumeric0; //!< The 0 key static constexpr inline InputChannelId Alphanumeric0{"keyboard_key_alphanumeric_0"}; //!< The 0 key
static const InputChannelId Alphanumeric1; //!< The 1 key static constexpr inline InputChannelId Alphanumeric1{"keyboard_key_alphanumeric_1"}; //!< The 1 key
static const InputChannelId Alphanumeric2; //!< The 2 key static constexpr inline InputChannelId Alphanumeric2{"keyboard_key_alphanumeric_2"}; //!< The 2 key
static const InputChannelId Alphanumeric3; //!< The 3 key static constexpr inline InputChannelId Alphanumeric3{"keyboard_key_alphanumeric_3"}; //!< The 3 key
static const InputChannelId Alphanumeric4; //!< The 4 key static constexpr inline InputChannelId Alphanumeric4{"keyboard_key_alphanumeric_4"}; //!< The 4 key
static const InputChannelId Alphanumeric5; //!< The 5 key static constexpr inline InputChannelId Alphanumeric5{"keyboard_key_alphanumeric_5"}; //!< The 5 key
static const InputChannelId Alphanumeric6; //!< The 6 key static constexpr inline InputChannelId Alphanumeric6{"keyboard_key_alphanumeric_6"}; //!< The 6 key
static const InputChannelId Alphanumeric7; //!< The 7 key static constexpr inline InputChannelId Alphanumeric7{"keyboard_key_alphanumeric_7"}; //!< The 7 key
static const InputChannelId Alphanumeric8; //!< The 8 key static constexpr inline InputChannelId Alphanumeric8{"keyboard_key_alphanumeric_8"}; //!< The 8 key
static const InputChannelId Alphanumeric9; //!< The 9 key static constexpr inline InputChannelId Alphanumeric9{"keyboard_key_alphanumeric_9"}; //!< The 9 key
static const InputChannelId AlphanumericA; //!< The A key static constexpr inline InputChannelId AlphanumericA{"keyboard_key_alphanumeric_A"}; //!< The A key
static const InputChannelId AlphanumericB; //!< The B key static constexpr inline InputChannelId AlphanumericB{"keyboard_key_alphanumeric_B"}; //!< The B key
static const InputChannelId AlphanumericC; //!< The C key static constexpr inline InputChannelId AlphanumericC{"keyboard_key_alphanumeric_C"}; //!< The C key
static const InputChannelId AlphanumericD; //!< The D key static constexpr inline InputChannelId AlphanumericD{"keyboard_key_alphanumeric_D"}; //!< The D key
static const InputChannelId AlphanumericE; //!< The E key static constexpr inline InputChannelId AlphanumericE{"keyboard_key_alphanumeric_E"}; //!< The E key
static const InputChannelId AlphanumericF; //!< The F key static constexpr inline InputChannelId AlphanumericF{"keyboard_key_alphanumeric_F"}; //!< The F key
static const InputChannelId AlphanumericG; //!< The G key static constexpr inline InputChannelId AlphanumericG{"keyboard_key_alphanumeric_G"}; //!< The G key
static const InputChannelId AlphanumericH; //!< The H key static constexpr inline InputChannelId AlphanumericH{"keyboard_key_alphanumeric_H"}; //!< The H key
static const InputChannelId AlphanumericI; //!< The I key static constexpr inline InputChannelId AlphanumericI{"keyboard_key_alphanumeric_I"}; //!< The I key
static const InputChannelId AlphanumericJ; //!< The J key static constexpr inline InputChannelId AlphanumericJ{"keyboard_key_alphanumeric_J"}; //!< The J key
static const InputChannelId AlphanumericK; //!< The K key static constexpr inline InputChannelId AlphanumericK{"keyboard_key_alphanumeric_K"}; //!< The K key
static const InputChannelId AlphanumericL; //!< The L key static constexpr inline InputChannelId AlphanumericL{"keyboard_key_alphanumeric_L"}; //!< The L key
static const InputChannelId AlphanumericM; //!< The M key static constexpr inline InputChannelId AlphanumericM{"keyboard_key_alphanumeric_M"}; //!< The M key
static const InputChannelId AlphanumericN; //!< The N key static constexpr inline InputChannelId AlphanumericN{"keyboard_key_alphanumeric_N"}; //!< The N key
static const InputChannelId AlphanumericO; //!< The O key static constexpr inline InputChannelId AlphanumericO{"keyboard_key_alphanumeric_O"}; //!< The O key
static const InputChannelId AlphanumericP; //!< The P key static constexpr inline InputChannelId AlphanumericP{"keyboard_key_alphanumeric_P"}; //!< The P key
static const InputChannelId AlphanumericQ; //!< The Q key static constexpr inline InputChannelId AlphanumericQ{"keyboard_key_alphanumeric_Q"}; //!< The Q key
static const InputChannelId AlphanumericR; //!< The R key static constexpr inline InputChannelId AlphanumericR{"keyboard_key_alphanumeric_R"}; //!< The R key
static const InputChannelId AlphanumericS; //!< The S key static constexpr inline InputChannelId AlphanumericS{"keyboard_key_alphanumeric_S"}; //!< The S key
static const InputChannelId AlphanumericT; //!< The T key static constexpr inline InputChannelId AlphanumericT{"keyboard_key_alphanumeric_T"}; //!< The T key
static const InputChannelId AlphanumericU; //!< The U key static constexpr inline InputChannelId AlphanumericU{"keyboard_key_alphanumeric_U"}; //!< The U key
static const InputChannelId AlphanumericV; //!< The V key static constexpr inline InputChannelId AlphanumericV{"keyboard_key_alphanumeric_V"}; //!< The V key
static const InputChannelId AlphanumericW; //!< The W key static constexpr inline InputChannelId AlphanumericW{"keyboard_key_alphanumeric_W"}; //!< The W key
static const InputChannelId AlphanumericX; //!< The X key static constexpr inline InputChannelId AlphanumericX{"keyboard_key_alphanumeric_X"}; //!< The X key
static const InputChannelId AlphanumericY; //!< The Y key static constexpr inline InputChannelId AlphanumericY{"keyboard_key_alphanumeric_Y"}; //!< The Y key
static const InputChannelId AlphanumericZ; //!< The Z key static constexpr inline InputChannelId AlphanumericZ{"keyboard_key_alphanumeric_Z"}; //!< The Z key
// Edit (and escape) Keys // Edit {and escape} Keys
static const InputChannelId EditBackspace; //!< The backspace key static constexpr inline InputChannelId EditBackspace{"keyboard_key_edit_backspace"}; //!< The backspace key
static const InputChannelId EditCapsLock; //!< The caps lock key static constexpr inline InputChannelId EditCapsLock{"keyboard_key_edit_capslock"}; //!< The caps lock key
static const InputChannelId EditEnter; //!< The enter/return key static constexpr inline InputChannelId EditEnter{"keyboard_key_edit_enter"}; //!< The enter/return key
static const InputChannelId EditSpace; //!< The spacebar key static constexpr inline InputChannelId EditSpace{"keyboard_key_edit_space"}; //!< The spacebar key
static const InputChannelId EditTab; //!< The tab key static constexpr inline InputChannelId EditTab{"keyboard_key_edit_tab"}; //!< The tab key
static const InputChannelId Escape; //!< The escape key static constexpr inline InputChannelId Escape{"keyboard_key_escape"}; //!< The escape key
// Function Keys // Function Keys
static const InputChannelId Function01; //!< The F1 key static constexpr inline InputChannelId Function01{"keyboard_key_function_F01"}; //!< The F1 key
static const InputChannelId Function02; //!< The F2 key static constexpr inline InputChannelId Function02{"keyboard_key_function_F02"}; //!< The F2 key
static const InputChannelId Function03; //!< The F3 key static constexpr inline InputChannelId Function03{"keyboard_key_function_F03"}; //!< The F3 key
static const InputChannelId Function04; //!< The F4 key static constexpr inline InputChannelId Function04{"keyboard_key_function_F04"}; //!< The F4 key
static const InputChannelId Function05; //!< The F5 key static constexpr inline InputChannelId Function05{"keyboard_key_function_F05"}; //!< The F5 key
static const InputChannelId Function06; //!< The F6 key static constexpr inline InputChannelId Function06{"keyboard_key_function_F06"}; //!< The F6 key
static const InputChannelId Function07; //!< The F7 key static constexpr inline InputChannelId Function07{"keyboard_key_function_F07"}; //!< The F7 key
static const InputChannelId Function08; //!< The F8 key static constexpr inline InputChannelId Function08{"keyboard_key_function_F08"}; //!< The F8 key
static const InputChannelId Function09; //!< The F9 key static constexpr inline InputChannelId Function09{"keyboard_key_function_F09"}; //!< The F9 key
static const InputChannelId Function10; //!< The F10 key static constexpr inline InputChannelId Function10{"keyboard_key_function_F10"}; //!< The F10 key
static const InputChannelId Function11; //!< The F11 key static constexpr inline InputChannelId Function11{"keyboard_key_function_F11"}; //!< The F11 key
static const InputChannelId Function12; //!< The F12 key static constexpr inline InputChannelId Function12{"keyboard_key_function_F12"}; //!< The F12 key
static const InputChannelId Function13; //!< The F13 key static constexpr inline InputChannelId Function13{"keyboard_key_function_F13"}; //!< The F13 key
static const InputChannelId Function14; //!< The F14 key static constexpr inline InputChannelId Function14{"keyboard_key_function_F14"}; //!< The F14 key
static const InputChannelId Function15; //!< The F15 key static constexpr inline InputChannelId Function15{"keyboard_key_function_F15"}; //!< The F15 key
static const InputChannelId Function16; //!< The F16 key static constexpr inline InputChannelId Function16{"keyboard_key_function_F16"}; //!< The F16 key
static const InputChannelId Function17; //!< The F17 key static constexpr inline InputChannelId Function17{"keyboard_key_function_F17"}; //!< The F17 key
static const InputChannelId Function18; //!< The F18 key static constexpr inline InputChannelId Function18{"keyboard_key_function_F18"}; //!< The F18 key
static const InputChannelId Function19; //!< The F19 key static constexpr inline InputChannelId Function19{"keyboard_key_function_F19"}; //!< The F19 key
static const InputChannelId Function20; //!< The F20 key static constexpr inline InputChannelId Function20{"keyboard_key_function_F20"}; //!< The F20 key
// Modifier Keys // Modifier Keys
static const InputChannelId ModifierAltL; //!< The left alt/option key static constexpr inline InputChannelId ModifierAltL{"keyboard_key_modifier_alt_l"}; //!< The left alt/option key
static const InputChannelId ModifierAltR; //!< The right alt/option key static constexpr inline InputChannelId ModifierAltR{"keyboard_key_modifier_alt_r"}; //!< The right alt/option key
static const InputChannelId ModifierCtrlL; //!< The left control key static constexpr inline InputChannelId ModifierCtrlL{"keyboard_key_modifier_ctrl_l"}; //!< The left control key
static const InputChannelId ModifierCtrlR; //!< The right control key static constexpr inline InputChannelId ModifierCtrlR{"keyboard_key_modifier_ctrl_r"}; //!< The right control key
static const InputChannelId ModifierShiftL; //!< The left shift key static constexpr inline InputChannelId ModifierShiftL{"keyboard_key_modifier_shift_l"}; //!< The left shift key
static const InputChannelId ModifierShiftR; //!< The right shift key static constexpr inline InputChannelId ModifierShiftR{"keyboard_key_modifier_shift_r"}; //!< The right shift key
static const InputChannelId ModifierSuperL; //!< The left super (windows or apple) key static constexpr inline InputChannelId ModifierSuperL{"keyboard_key_modifier_super_l"}; //!< The left super {windows or apple} key
static const InputChannelId ModifierSuperR; //!< The right super (windows or apple) key static constexpr inline InputChannelId ModifierSuperR{"keyboard_key_modifier_super_r"}; //!< The right super {windows or apple} key
// Navigation Keys // Navigation Keys
static const InputChannelId NavigationArrowDown; //!< The down arrow key static constexpr inline InputChannelId NavigationArrowDown{"keyboard_key_navigation_arrow_down"}; //!< The down arrow key
static const InputChannelId NavigationArrowLeft; //!< The left arrow key static constexpr inline InputChannelId NavigationArrowLeft{"keyboard_key_navigation_arrow_left"}; //!< The left arrow key
static const InputChannelId NavigationArrowRight; //!< The right arrow key static constexpr inline InputChannelId NavigationArrowRight{"keyboard_key_navigation_arrow_right"}; //!< The right arrow key
static const InputChannelId NavigationArrowUp; //!< The up arrow key static constexpr inline InputChannelId NavigationArrowUp{"keyboard_key_navigation_arrow_up"}; //!< The up arrow key
static const InputChannelId NavigationDelete; //!< The delete key static constexpr inline InputChannelId NavigationDelete{"keyboard_key_navigation_delete"}; //!< The delete key
static const InputChannelId NavigationEnd; //!< The end key static constexpr inline InputChannelId NavigationEnd{"keyboard_key_navigation_end"}; //!< The end key
static const InputChannelId NavigationHome; //!< The home key static constexpr inline InputChannelId NavigationHome{"keyboard_key_navigation_home"}; //!< The home key
static const InputChannelId NavigationInsert; //!< The insert key static constexpr inline InputChannelId NavigationInsert{"keyboard_key_navigation_insert"}; //!< The insert key
static const InputChannelId NavigationPageDown; //!< The page down key static constexpr inline InputChannelId NavigationPageDown{"keyboard_key_navigation_page_down"}; //!< The page down key
static const InputChannelId NavigationPageUp; //!< The page up key static constexpr inline InputChannelId NavigationPageUp{"keyboard_key_navigation_page_up"}; //!< The page up key
// Numpad Keys // Numpad Keys
static const InputChannelId NumLock; //!< The num lock key (the clear key on apple keyboards) static constexpr inline InputChannelId NumLock{"keyboard_key_num_lock"}; //!< The num lock key {the clear key on apple keyboards}
static const InputChannelId NumPad0; //!< The numpad 0 key static constexpr inline InputChannelId NumPad0{"keyboard_key_numpad_0"}; //!< The numpad 0 key
static const InputChannelId NumPad1; //!< The numpad 1 key static constexpr inline InputChannelId NumPad1{"keyboard_key_numpad_1"}; //!< The numpad 1 key
static const InputChannelId NumPad2; //!< The numpad 2 key static constexpr inline InputChannelId NumPad2{"keyboard_key_numpad_2"}; //!< The numpad 2 key
static const InputChannelId NumPad3; //!< The numpad 3 key static constexpr inline InputChannelId NumPad3{"keyboard_key_numpad_3"}; //!< The numpad 3 key
static const InputChannelId NumPad4; //!< The numpad 4 key static constexpr inline InputChannelId NumPad4{"keyboard_key_numpad_4"}; //!< The numpad 4 key
static const InputChannelId NumPad5; //!< The numpad 5 key static constexpr inline InputChannelId NumPad5{"keyboard_key_numpad_5"}; //!< The numpad 5 key
static const InputChannelId NumPad6; //!< The numpad 6 key static constexpr inline InputChannelId NumPad6{"keyboard_key_numpad_6"}; //!< The numpad 6 key
static const InputChannelId NumPad7; //!< The numpad 7 key static constexpr inline InputChannelId NumPad7{"keyboard_key_numpad_7"}; //!< The numpad 7 key
static const InputChannelId NumPad8; //!< The numpad 8 key static constexpr inline InputChannelId NumPad8{"keyboard_key_numpad_8"}; //!< The numpad 8 key
static const InputChannelId NumPad9; //!< The numpad 9 key static constexpr inline InputChannelId NumPad9{"keyboard_key_numpad_9"}; //!< The numpad 9 key
static const InputChannelId NumPadAdd; //!< The numpad add key static constexpr inline InputChannelId NumPadAdd{"keyboard_key_numpad_add"}; //!< The numpad add key
static const InputChannelId NumPadDecimal; //!< The numpad decimal key static constexpr inline InputChannelId NumPadDecimal{"keyboard_key_numpad_decimal"}; //!< The numpad decimal key
static const InputChannelId NumPadDivide; //!< The numpad divide key static constexpr inline InputChannelId NumPadDivide{"keyboard_key_numpad_divide"}; //!< The numpad divide key
static const InputChannelId NumPadEnter; //!< The numpad enter key static constexpr inline InputChannelId NumPadEnter{"keyboard_key_numpad_enter"}; //!< The numpad enter key
static const InputChannelId NumPadMultiply; //!< The numpad multiply key static constexpr inline InputChannelId NumPadMultiply{"keyboard_key_numpad_multiply"}; //!< The numpad multiply key
static const InputChannelId NumPadSubtract; //!< The numpad subtract key static constexpr inline InputChannelId NumPadSubtract{"keyboard_key_numpad_subtract"}; //!< The numpad subtract key
// Punctuation Keys // Punctuation Keys
static const InputChannelId PunctuationApostrophe; //!< The apostrophe key static constexpr inline InputChannelId PunctuationApostrophe{"keyboard_key_punctuation_apostrophe"}; //!< The apostrophe key
static const InputChannelId PunctuationBackslash; //!< The backslash key static constexpr inline InputChannelId PunctuationBackslash{"keyboard_key_punctuation_backslash"}; //!< The backslash key
static const InputChannelId PunctuationBracketL; //!< The left bracket key static constexpr inline InputChannelId PunctuationBracketL{"keyboard_key_punctuation_bracket_l"}; //!< The left bracket key
static const InputChannelId PunctuationBracketR; //!< The right bracket key static constexpr inline InputChannelId PunctuationBracketR{"keyboard_key_punctuation_bracket_r"}; //!< The right bracket key
static const InputChannelId PunctuationComma; //!< The comma key static constexpr inline InputChannelId PunctuationComma{"keyboard_key_punctuation_comma"}; //!< The comma key
static const InputChannelId PunctuationEquals; //!< The equals key static constexpr inline InputChannelId PunctuationEquals{"keyboard_key_punctuation_equals"}; //!< The equals key
static const InputChannelId PunctuationHyphen; //!< The hyphen/underscore key static constexpr inline InputChannelId PunctuationHyphen{"keyboard_key_punctuation_hyphen"}; //!< The hyphen/underscore key
static const InputChannelId PunctuationPeriod; //!< The period key static constexpr inline InputChannelId PunctuationPeriod{"keyboard_key_punctuation_period"}; //!< The period key
static const InputChannelId PunctuationSemicolon; //!< The semicolon key static constexpr inline InputChannelId PunctuationSemicolon{"keyboard_key_punctuation_semicolon"}; //!< The semicolon key
static const InputChannelId PunctuationSlash; //!< The (forward) slash key static constexpr inline InputChannelId PunctuationSlash{"keyboard_key_punctuation_slash"}; //!< The {forward} slash key
static const InputChannelId PunctuationTilde; //!< The tilde/grave key static constexpr inline InputChannelId PunctuationTilde{"keyboard_key_punctuation_tilde"}; //!< The tilde/grave key
// Supplementary ISO Key // Supplementary ISO Key
static const InputChannelId SupplementaryISO; //!< The supplementary ISO layout key static constexpr inline InputChannelId SupplementaryISO{"keyboard_key_supplementary_iso"}; //!< The supplementary ISO layout key
// Windows System Keys // Windows System Keys
static const InputChannelId WindowsSystemPause; //!< The windows pause key static constexpr inline InputChannelId WindowsSystemPause{"keyboard_key_windows_system_pause"}; //!< The windows pause key
static const InputChannelId WindowsSystemPrint; //!< The windows print key static constexpr inline InputChannelId WindowsSystemPrint{"keyboard_key_windows_system_print"}; //!< The windows print key
static const InputChannelId WindowsSystemScrollLock; //!< The windows scroll lock key static constexpr inline InputChannelId WindowsSystemScrollLock{"keyboard_key_windows_system_scroll_lock"}; //!< The windows scroll lock key
//!< All keyboard key ids //!< All keyboard key ids
static const AZStd::array<InputChannelId, 112> All; static constexpr inline AZStd::array All
{
// Alphanumeric Keys
Alphanumeric0,
Alphanumeric1,
Alphanumeric2,
Alphanumeric3,
Alphanumeric4,
Alphanumeric5,
Alphanumeric6,
Alphanumeric7,
Alphanumeric8,
Alphanumeric9,
AlphanumericA,
AlphanumericB,
AlphanumericC,
AlphanumericD,
AlphanumericE,
AlphanumericF,
AlphanumericG,
AlphanumericH,
AlphanumericI,
AlphanumericJ,
AlphanumericK,
AlphanumericL,
AlphanumericM,
AlphanumericN,
AlphanumericO,
AlphanumericP,
AlphanumericQ,
AlphanumericR,
AlphanumericS,
AlphanumericT,
AlphanumericU,
AlphanumericV,
AlphanumericW,
AlphanumericX,
AlphanumericY,
AlphanumericZ,
// Edit (and escape) Keys
EditBackspace,
EditCapsLock,
EditEnter,
EditSpace,
EditTab,
Escape,
// Function Keys
Function01,
Function02,
Function03,
Function04,
Function05,
Function06,
Function07,
Function08,
Function09,
Function10,
Function11,
Function12,
Function13,
Function14,
Function15,
Function16,
Function17,
Function18,
Function19,
Function20,
// Modifier Keys
ModifierAltL,
ModifierAltR,
ModifierCtrlL,
ModifierCtrlR,
ModifierShiftL,
ModifierShiftR,
ModifierSuperL,
ModifierSuperR,
// Navigation Keys
NavigationArrowDown,
NavigationArrowLeft,
NavigationArrowRight,
NavigationArrowUp,
NavigationDelete,
NavigationEnd,
NavigationHome,
NavigationInsert,
NavigationPageDown,
NavigationPageUp,
// Numpad Keys
NumLock,
NumPad0,
NumPad1,
NumPad2,
NumPad3,
NumPad4,
NumPad5,
NumPad6,
NumPad7,
NumPad8,
NumPad9,
NumPadAdd,
NumPadDecimal,
NumPadDivide,
NumPadEnter,
NumPadMultiply,
NumPadSubtract,
// Punctuation Keys
PunctuationApostrophe,
PunctuationBackslash,
PunctuationBracketL,
PunctuationBracketR,
PunctuationComma,
PunctuationEquals,
PunctuationHyphen,
PunctuationPeriod,
PunctuationSemicolon,
PunctuationSlash,
PunctuationTilde,
// Supplementary ISO Key
SupplementaryISO,
// Windows System Keys
WindowsSystemPause,
WindowsSystemPrint,
WindowsSystemScrollLock
};
}; };
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save