diff --git a/Assets/Editor/Icons/AssetBrowser/TreeBranch_First.svg b/Assets/Editor/Icons/AssetBrowser/TreeBranch_First.svg
new file mode 100644
index 0000000000..f1d36d3e41
--- /dev/null
+++ b/Assets/Editor/Icons/AssetBrowser/TreeBranch_First.svg
@@ -0,0 +1,7 @@
+
diff --git a/Assets/Editor/Icons/AssetBrowser/TreeBranch_Last.svg b/Assets/Editor/Icons/AssetBrowser/TreeBranch_Last.svg
new file mode 100644
index 0000000000..9fc9fe52c2
--- /dev/null
+++ b/Assets/Editor/Icons/AssetBrowser/TreeBranch_Last.svg
@@ -0,0 +1,5 @@
+
diff --git a/Assets/Editor/Icons/AssetBrowser/TreeBranch_Middle.svg b/Assets/Editor/Icons/AssetBrowser/TreeBranch_Middle.svg
new file mode 100644
index 0000000000..7a61db38e0
--- /dev/null
+++ b/Assets/Editor/Icons/AssetBrowser/TreeBranch_Middle.svg
@@ -0,0 +1,6 @@
+
diff --git a/Assets/Editor/Icons/AssetBrowser/TreeBranch_OneChild.svg b/Assets/Editor/Icons/AssetBrowser/TreeBranch_OneChild.svg
new file mode 100644
index 0000000000..c6fb977c52
--- /dev/null
+++ b/Assets/Editor/Icons/AssetBrowser/TreeBranch_OneChild.svg
@@ -0,0 +1,6 @@
+
diff --git a/Assets/Editor/Translation/scriptcanvas_en_us.ts b/Assets/Editor/Translation/scriptcanvas_en_us.ts
index 937f6a4d96..7b8361c879 100644
--- a/Assets/Editor/Translation/scriptcanvas_en_us.ts
+++ b/Assets/Editor/Translation/scriptcanvas_en_us.ts
@@ -8098,7 +8098,7 @@
COLOR_FROMVALUES_PARAM0_TOOLTIP
- The Red value of hte Color [0, 255]
+ The Red value of the Color [0.0-1.0]
COLOR_FROMVALUES_PARAM1_NAME
@@ -8107,7 +8107,7 @@
COLOR_FROMVALUES_PARAM1_TOOLTIP
- The Green value of the Color [0, 255]
+ The Green value of the Color [0.0-1.0]
COLOR_FROMVALUES_PARAM2_NAME
@@ -8116,7 +8116,7 @@
COLOR_FROMVALUES_PARAM2_TOOLTIP
- The Blue value of the Color [0, 255]
+ The Blue value of the Color [0.0-1.0]
COLOR_FROMVALUES_PARAM3_NAME
@@ -8125,7 +8125,7 @@
COLOR_FROMVALUES_PARAM3_TOOLTIP
- The Alpha value of the Color [0, 255]
+ The Alpha value of the Color [0.0-1.0]
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt
index 4a26500ee2..52682e70bb 100644
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/CMakeLists.txt
@@ -17,5 +17,14 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
AZ::AssetProcessorBatch
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()
diff --git a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/fbx_tests.py b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/fbx_tests.py
index 2b90f53fc3..5cb61da68e 100755
--- a/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/fbx_tests.py
+++ b/AutomatedTesting/Gem/PythonTests/assetpipeline/fbx_tests/fbx_tests.py
@@ -34,11 +34,13 @@ logger = logging.getLogger(__name__)
targetProjects = ["AutomatedTesting"]
@pytest.fixture
+@pytest.mark.SUITE_sandbox
def local_resources(request, workspace, ap_setup_fixture):
ap_setup_fixture["tests_dir"] = os.path.dirname(os.path.realpath(__file__))
@dataclass
+@pytest.mark.SUITE_sandbox
class BlackboxAssetTest:
test_name: str
asset_folder: str
@@ -338,9 +340,11 @@ blackbox_fbx_special_tests = [
@pytest.mark.usefixtures("local_resources")
@pytest.mark.parametrize("project", targetProjects)
@pytest.mark.assetpipeline
+@pytest.mark.SUITE_sandbox
class TestsFBX_AllPlatforms(object):
@pytest.mark.BAT
+ @pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("blackbox_param", blackbox_fbx_tests)
def test_FBXBlackboxTest_SourceFiles_Processed_ResultInExpectedProducts(self, workspace,
ap_setup_fixture, asset_processor, project,
@@ -359,6 +363,7 @@ class TestsFBX_AllPlatforms(object):
asset_processor, project, blackbox_param)
@pytest.mark.BAT
+ @pytest.mark.SUITE_sandbox
@pytest.mark.parametrize("blackbox_param", blackbox_fbx_special_tests)
def test_FBXBlackboxTest_AssetInfoModified_AssetReprocessed_ResultInExpectedProducts(self,
workspace, ap_setup_fixture,
diff --git a/Code/Editor/AssetEditor/AssetEditorRequestsHandler.h b/Code/Editor/AssetEditor/AssetEditorRequestsHandler.h
index ebfa84249d..bbe55e216a 100644
--- a/Code/Editor/AssetEditor/AssetEditorRequestsHandler.h
+++ b/Code/Editor/AssetEditor/AssetEditorRequestsHandler.h
@@ -7,7 +7,6 @@
*/
#pragma once
-#include
#include
#include
diff --git a/Code/Editor/AssetEditor/AssetEditorWindow.h b/Code/Editor/AssetEditor/AssetEditorWindow.h
index 2cf73ac282..63347d6ff3 100644
--- a/Code/Editor/AssetEditor/AssetEditorWindow.h
+++ b/Code/Editor/AssetEditor/AssetEditorWindow.h
@@ -9,7 +9,6 @@
#if !defined(Q_MOC_RUN)
#include
-#include
#include
#include
#include
diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
index 18946c7874..9fe4cfd0d2 100644
--- a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
+++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.cpp
@@ -141,6 +141,10 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_ui->m_assetBrowserTreeViewWidget, &AzAssetBrowser::AssetBrowserTreeView::ClearTypeFilter, m_ui->m_searchWidget,
&AzAssetBrowser::SearchWidget::ClearTypeFilter);
+ connect(
+ this, &AzAssetBrowserWindow::SizeChangedSignal, m_ui->m_assetBrowserTableViewWidget,
+ &AzAssetBrowser::AssetBrowserTableView::UpdateSizeSlot);
+
m_ui->m_assetBrowserTreeViewWidget->SetName("AssetBrowserTreeView_main");
}
@@ -164,6 +168,25 @@ QObject* AzAssetBrowserWindow::createListenerForShowAssetEditorEvent(QObject* pa
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(leftLayout->geometry().width());
+ const float oldWidth = aznumeric_cast(leftLayout->geometry().width() + rightLayout->geometry().width());
+
+ const float newWidth = oldLeftLayoutWidth * aznumeric_cast(resizeEvent->size().width()) / oldWidth;
+
+ emit SizeChangedSignal(aznumeric_cast(newWidth));
+ QWidget::resizeEvent(resizeEvent);
+}
+
void AzAssetBrowserWindow::OnInitViewToggleButton()
{
CreateSwitchViewMenu();
diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.h b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.h
index bf742b0cf2..753f000300 100644
--- a/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.h
+++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserWindow.h
@@ -53,9 +53,17 @@ public:
static QObject* createListenerForShowAssetEditorEvent(QObject* parent);
+
+Q_SIGNALS:
+ void SizeChangedSignal(int newWidth);
+
+protected:
+ void resizeEvent(QResizeEvent* resizeEvent) override;
+
private:
void OnInitViewToggleButton();
void UpdateDisplayInfo();
+
protected slots:
void CreateSwitchViewMenu();
void SetExpandedAssetBrowserMode();
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
index 40ea71f577..1151137bfc 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.cpp
@@ -26,6 +26,9 @@
#include
#include
+//AzCore
+#include
+
// Editor
#include "Clipboard.h"
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h
index 64a4341096..ed5d1915ac 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h
@@ -12,7 +12,6 @@
#if !defined(Q_MOC_RUN)
#include
-#include
#include
#include "Include/EditorCoreAPI.h"
#include "ReflectedPropertyItem.h"
diff --git a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVar.h b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVar.h
index a15f8326d1..7c38465c5e 100644
--- a/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVar.h
+++ b/Code/Editor/Controls/ReflectedPropertyControl/ReflectedVar.h
@@ -10,10 +10,10 @@
#define CRYINCLUDE_EDITOR_UTILS_REFLECTEDVAR_H
#pragma once
-#include
#include
#include
#include "Util/VariablePropertyType.h"
+#include
#include
#include
#include
diff --git a/Code/Editor/Core/QtEditorApplication.cpp b/Code/Editor/Core/QtEditorApplication.cpp
index 66ed42af8f..a4aab24be4 100644
--- a/Code/Editor/Core/QtEditorApplication.cpp
+++ b/Code/Editor/Core/QtEditorApplication.cpp
@@ -44,7 +44,7 @@ enum
{
// in milliseconds
GameModeIdleFrequency = 0,
- EditorModeIdleFrequency = 0,
+ EditorModeIdleFrequency = 1,
InactiveModeFrequency = 10,
UninitializedFrequency = 9999,
};
diff --git a/Code/Editor/Core/QtEditorApplication_linux.cpp b/Code/Editor/Core/QtEditorApplication_linux.cpp
index 175bef0238..2fd4ef629e 100644
--- a/Code/Editor/Core/QtEditorApplication_linux.cpp
+++ b/Code/Editor/Core/QtEditorApplication_linux.cpp
@@ -9,7 +9,7 @@
#include "QtEditorApplication.h"
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
-#include
+#include
#endif
namespace Editor
@@ -19,7 +19,7 @@ namespace Editor
if (GetIEditor()->IsInGameMode())
{
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
- AzFramework::LinuxXcbEventHandlerBus::Broadcast(&AzFramework::LinuxXcbEventHandler::HandleXcbEvent, static_cast(message));
+ AzFramework::XcbEventHandlerBus::Broadcast(&AzFramework::XcbEventHandler::HandleXcbEvent, static_cast(message));
#endif
return true;
}
diff --git a/Code/Editor/EditorModularViewportCameraComposer.cpp b/Code/Editor/EditorModularViewportCameraComposer.cpp
index e375e98fb6..29cf348ab5 100644
--- a/Code/Editor/EditorModularViewportCameraComposer.cpp
+++ b/Code/Editor/EditorModularViewportCameraComposer.cpp
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
#include
namespace SandboxEditor
@@ -94,7 +95,7 @@ namespace SandboxEditor
cameras.AddCamera(m_firstPersonPanCamera);
cameras.AddCamera(m_firstPersonTranslateCamera);
cameras.AddCamera(m_firstPersonScrollCamera);
- cameras.AddCamera(m_orbitCamera);
+ cameras.AddCamera(m_pivotCamera);
});
return controller;
@@ -131,8 +132,8 @@ namespace SandboxEditor
m_firstPersonRotateCamera->SetActivationBeganFn(hideCursor);
m_firstPersonRotateCamera->SetActivationEndedFn(showCursor);
- m_firstPersonPanCamera =
- AZStd::make_shared(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan);
+ m_firstPersonPanCamera = AZStd::make_shared(
+ SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan, AzFramework::TranslatePivot);
m_firstPersonPanCamera->m_panSpeedFn = []
{
@@ -151,8 +152,8 @@ namespace SandboxEditor
const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds();
- m_firstPersonTranslateCamera =
- AZStd::make_shared(AzFramework::LookTranslation, translateCameraInputChannelIds);
+ m_firstPersonTranslateCamera = AZStd::make_shared(
+ translateCameraInputChannelIds, AzFramework::LookTranslation, AzFramework::TranslatePivot);
m_firstPersonTranslateCamera->m_translateSpeedFn = []
{
@@ -171,120 +172,97 @@ namespace SandboxEditor
return SandboxEditor::CameraScrollSpeed();
};
- m_orbitCamera = AZStd::make_shared(SandboxEditor::CameraOrbitChannelId());
+ m_pivotCamera = AZStd::make_shared(SandboxEditor::CameraPivotChannelId());
- m_orbitCamera->SetLookAtFn(
- [viewportId = m_viewportId](const AZ::Vector3& position, const AZ::Vector3& direction) -> AZStd::optional
+ m_pivotCamera->SetPivotFn(
+ []([[maybe_unused]] const AZ::Vector3& position, [[maybe_unused]] const AZ::Vector3& direction)
{
- AZStd::optional lookAtAfterInterpolation;
- AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
- lookAtAfterInterpolation, viewportId,
- &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::LookAtAfterInterpolation);
-
- // initially attempt to use the last set look at point after an interpolation has finished
- if (lookAtAfterInterpolation.has_value())
- {
- 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 {};
+ // use the manipulator transform as the pivot point
+ AZStd::optional entityPivot;
+ AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
+ entityPivot, AzToolsFramework::GetEntityContextId(),
+ &AzToolsFramework::EditorTransformComponentSelectionRequestBus::Events::GetManipulatorTransform);
+
+ // otherwise just use the identity
+ return entityPivot.value_or(AZ::Transform::CreateIdentity()).GetTranslation();
});
- m_orbitRotateCamera = AZStd::make_shared(SandboxEditor::CameraOrbitLookChannelId());
+ m_pivotRotateCamera = AZStd::make_shared(SandboxEditor::CameraPivotLookChannelId());
- m_orbitRotateCamera->m_rotateSpeedFn = []
+ m_pivotRotateCamera->m_rotateSpeedFn = []
{
return SandboxEditor::CameraRotateSpeed();
};
- m_orbitRotateCamera->m_invertYawFn = []
+ m_pivotRotateCamera->m_invertYawFn = []
{
- return SandboxEditor::CameraOrbitYawRotationInverted();
+ return SandboxEditor::CameraPivotYawRotationInverted();
};
- m_orbitTranslateCamera =
- AZStd::make_shared(AzFramework::OrbitTranslation, translateCameraInputChannelIds);
+ m_pivotTranslateCamera = AZStd::make_shared(
+ translateCameraInputChannelIds, AzFramework::LookTranslation, AzFramework::TranslateOffset);
- m_orbitTranslateCamera->m_translateSpeedFn = []
+ m_pivotTranslateCamera->m_translateSpeedFn = []
{
return SandboxEditor::CameraTranslateSpeed();
};
- m_orbitTranslateCamera->m_boostMultiplierFn = []
+ m_pivotTranslateCamera->m_boostMultiplierFn = []
{
return SandboxEditor::CameraBoostMultiplier();
};
- m_orbitDollyScrollCamera = AZStd::make_shared();
+ m_pivotDollyScrollCamera = AZStd::make_shared();
- m_orbitDollyScrollCamera->m_scrollSpeedFn = []
+ m_pivotDollyScrollCamera->m_scrollSpeedFn = []
{
return SandboxEditor::CameraScrollSpeed();
};
- m_orbitDollyMoveCamera =
- AZStd::make_shared(SandboxEditor::CameraOrbitDollyChannelId());
+ m_pivotDollyMoveCamera = AZStd::make_shared(SandboxEditor::CameraPivotDollyChannelId());
- m_orbitDollyMoveCamera->m_cursorSpeedFn = []
+ m_pivotDollyMoveCamera->m_motionSpeedFn = []
{
return SandboxEditor::CameraDollyMotionSpeed();
};
- m_orbitPanCamera = AZStd::make_shared(SandboxEditor::CameraOrbitPanChannelId(), AzFramework::OrbitPan);
+ m_pivotPanCamera = AZStd::make_shared(
+ SandboxEditor::CameraPivotPanChannelId(), AzFramework::LookPan, AzFramework::TranslateOffset);
- m_orbitPanCamera->m_panSpeedFn = []
+ m_pivotPanCamera->m_panSpeedFn = []
{
return SandboxEditor::CameraPanSpeed();
};
- m_orbitPanCamera->m_invertPanXFn = []
+ m_pivotPanCamera->m_invertPanXFn = []
{
return SandboxEditor::CameraPanInvertedX();
};
- m_orbitPanCamera->m_invertPanYFn = []
+ m_pivotPanCamera->m_invertPanYFn = []
{
return SandboxEditor::CameraPanInvertedY();
};
- m_orbitCamera->m_orbitCameras.AddCamera(m_orbitRotateCamera);
- m_orbitCamera->m_orbitCameras.AddCamera(m_orbitTranslateCamera);
- m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyScrollCamera);
- m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyMoveCamera);
- m_orbitCamera->m_orbitCameras.AddCamera(m_orbitPanCamera);
+ m_pivotCamera->m_pivotCameras.AddCamera(m_pivotRotateCamera);
+ m_pivotCamera->m_pivotCameras.AddCamera(m_pivotTranslateCamera);
+ m_pivotCamera->m_pivotCameras.AddCamera(m_pivotDollyScrollCamera);
+ m_pivotCamera->m_pivotCameras.AddCamera(m_pivotDollyMoveCamera);
+ m_pivotCamera->m_pivotCameras.AddCamera(m_pivotPanCamera);
}
void EditorModularViewportCameraComposer::OnEditorModularViewportCameraComposerSettingsChanged()
{
const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds();
m_firstPersonTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
- m_orbitTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
-
m_firstPersonPanCamera->SetPanInputChannelId(SandboxEditor::CameraFreePanChannelId());
- m_orbitPanCamera->SetPanInputChannelId(SandboxEditor::CameraOrbitPanChannelId());
m_firstPersonRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraFreeLookChannelId());
- m_orbitRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraOrbitLookChannelId());
- m_orbitCamera->SetOrbitInputChannelId(SandboxEditor::CameraOrbitChannelId());
- m_orbitDollyMoveCamera->SetDollyInputChannelId(SandboxEditor::CameraOrbitDollyChannelId());
+
+ m_pivotCamera->SetPivotInputChannelId(SandboxEditor::CameraPivotChannelId());
+ 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)
@@ -295,8 +273,7 @@ namespace SandboxEditor
AZ::TransformBus::EventResult(worldFromLocal, viewEntityId, &AZ::TransformBus::Events::GetWorldTM);
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
- m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame,
- worldFromLocal);
+ m_viewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::SetReferenceFrame, worldFromLocal);
}
else
{
diff --git a/Code/Editor/EditorModularViewportCameraComposer.h b/Code/Editor/EditorModularViewportCameraComposer.h
index e6e71c976c..e691ca1c89 100644
--- a/Code/Editor/EditorModularViewportCameraComposer.h
+++ b/Code/Editor/EditorModularViewportCameraComposer.h
@@ -42,12 +42,12 @@ namespace SandboxEditor
AZStd::shared_ptr m_firstPersonPanCamera;
AZStd::shared_ptr m_firstPersonTranslateCamera;
AZStd::shared_ptr m_firstPersonScrollCamera;
- AZStd::shared_ptr m_orbitCamera;
- AZStd::shared_ptr m_orbitRotateCamera;
- AZStd::shared_ptr m_orbitTranslateCamera;
- AZStd::shared_ptr m_orbitDollyScrollCamera;
- AZStd::shared_ptr m_orbitDollyMoveCamera;
- AZStd::shared_ptr m_orbitPanCamera;
+ AZStd::shared_ptr m_pivotCamera;
+ AZStd::shared_ptr m_pivotRotateCamera;
+ AZStd::shared_ptr m_pivotTranslateCamera;
+ AZStd::shared_ptr m_pivotDollyScrollCamera;
+ AZStd::shared_ptr m_pivotDollyMoveCamera;
+ AZStd::shared_ptr m_pivotPanCamera;
AzFramework::ViewportId m_viewportId;
};
diff --git a/Code/Editor/EditorPreferencesPageViewportCamera.cpp b/Code/Editor/EditorPreferencesPageViewportCamera.cpp
index 368d2769f8..55b631e1f6 100644
--- a/Code/Editor/EditorPreferencesPageViewportCamera.cpp
+++ b/Code/Editor/EditorPreferencesPageViewportCamera.cpp
@@ -61,7 +61,7 @@ static AZStd::vector GetEditorInputNames()
void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serialize)
{
serialize.Class()
- ->Version(2)
+ ->Version(3)
->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed)
->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed)
->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier)
@@ -73,12 +73,12 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Field("TranslateSmoothing", &CameraMovementSettings::m_translateSmoothing)
->Field("TranslateSmoothness", &CameraMovementSettings::m_translateSmoothness)
->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook)
- ->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted)
+ ->Field("PivotYawRotationInverted", &CameraMovementSettings::m_pivotYawRotationInverted)
->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX)
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY);
serialize.Class()
- ->Version(1)
+ ->Version(2)
->Field("TranslateForward", &CameraInputSettings::m_translateForwardChannelId)
->Field("TranslateBackward", &CameraInputSettings::m_translateBackwardChannelId)
->Field("TranslateLeft", &CameraInputSettings::m_translateLeftChannelId)
@@ -86,12 +86,12 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Field("TranslateUp", &CameraInputSettings::m_translateUpChannelId)
->Field("TranslateDown", &CameraInputSettings::m_translateDownChannelId)
->Field("Boost", &CameraInputSettings::m_boostChannelId)
- ->Field("Orbit", &CameraInputSettings::m_orbitChannelId)
+ ->Field("Pivot", &CameraInputSettings::m_pivotChannelId)
->Field("FreeLook", &CameraInputSettings::m_freeLookChannelId)
->Field("FreePan", &CameraInputSettings::m_freePanChannelId)
- ->Field("OrbitLook", &CameraInputSettings::m_orbitLookChannelId)
- ->Field("OrbitDolly", &CameraInputSettings::m_orbitDollyChannelId)
- ->Field("OrbitPan", &CameraInputSettings::m_orbitPanChannelId);
+ ->Field("PivotLook", &CameraInputSettings::m_pivotLookChannelId)
+ ->Field("PivotDolly", &CameraInputSettings::m_pivotDollyChannelId)
+ ->Field("PivotPan", &CameraInputSettings::m_pivotPanChannelId);
serialize.Class()
->Version(1)
@@ -143,8 +143,8 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Attribute(AZ::Edit::Attributes::Min, minValue)
->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::TranslateSmoothingVisibility)
->DataElement(
- AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_orbitYawRotationInverted, "Camera Orbit Yaw Inverted",
- "Inverted yaw rotation while orbiting")
+ AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_pivotYawRotationInverted, "Camera Pivot Yaw Inverted",
+ "Inverted yaw rotation while pivoting")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedX, "Invert Pan X",
"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")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
- AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitChannelId, "Orbit",
- "Key/button to begin the camera orbit behavior")
+ AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotChannelId, "Pivot",
+ "Key/button to begin the camera pivot behavior")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
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")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
- AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitLookChannelId, "Orbit Look",
- "Key/button to begin camera orbit look")
+ AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotLookChannelId, "Pivot Look",
+ "Key/button to begin camera pivot look")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
- AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitDollyChannelId, "Orbit Dolly",
- "Key/button to begin camera orbit dolly")
+ AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotDollyChannelId, "Pivot Dolly",
+ "Key/button to begin camera pivot dolly")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
- AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitPanChannelId, "Orbit Pan",
- "Key/button to begin camera orbit pan")
+ AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_pivotPanChannelId, "Pivot Pan",
+ "Key/button to begin camera pivot pan")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames);
editContext->Class("Viewport Preferences", "Viewport Preferences")
@@ -264,7 +264,7 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
SandboxEditor::SetCameraTranslateSmoothness(m_cameraMovementSettings.m_translateSmoothness);
SandboxEditor::SetCameraTranslateSmoothingEnabled(m_cameraMovementSettings.m_translateSmoothing);
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::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY);
@@ -275,12 +275,12 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
SandboxEditor::SetCameraTranslateUpChannelId(m_cameraInputSettings.m_translateUpChannelId);
SandboxEditor::SetCameraTranslateDownChannelId(m_cameraInputSettings.m_translateDownChannelId);
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::SetCameraFreePanChannelId(m_cameraInputSettings.m_freePanChannelId);
- SandboxEditor::SetCameraOrbitLookChannelId(m_cameraInputSettings.m_orbitLookChannelId);
- SandboxEditor::SetCameraOrbitDollyChannelId(m_cameraInputSettings.m_orbitDollyChannelId);
- SandboxEditor::SetCameraOrbitPanChannelId(m_cameraInputSettings.m_orbitPanChannelId);
+ SandboxEditor::SetCameraPivotLookChannelId(m_cameraInputSettings.m_pivotLookChannelId);
+ SandboxEditor::SetCameraPivotDollyChannelId(m_cameraInputSettings.m_pivotDollyChannelId);
+ SandboxEditor::SetCameraPivotPanChannelId(m_cameraInputSettings.m_pivotPanChannelId);
SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Broadcast(
&SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Events::OnEditorModularViewportCameraComposerSettingsChanged);
@@ -299,7 +299,7 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
m_cameraMovementSettings.m_translateSmoothness = SandboxEditor::CameraTranslateSmoothness();
m_cameraMovementSettings.m_translateSmoothing = SandboxEditor::CameraTranslateSmoothingEnabled();
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_panInvertedY = SandboxEditor::CameraPanInvertedY();
@@ -310,10 +310,10 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
m_cameraInputSettings.m_translateUpChannelId = SandboxEditor::CameraTranslateUpChannelId().GetName();
m_cameraInputSettings.m_translateDownChannelId = SandboxEditor::CameraTranslateDownChannelId().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_freePanChannelId = SandboxEditor::CameraFreePanChannelId().GetName();
- m_cameraInputSettings.m_orbitLookChannelId = SandboxEditor::CameraOrbitLookChannelId().GetName();
- m_cameraInputSettings.m_orbitDollyChannelId = SandboxEditor::CameraOrbitDollyChannelId().GetName();
- m_cameraInputSettings.m_orbitPanChannelId = SandboxEditor::CameraOrbitPanChannelId().GetName();
+ m_cameraInputSettings.m_pivotLookChannelId = SandboxEditor::CameraPivotLookChannelId().GetName();
+ m_cameraInputSettings.m_pivotDollyChannelId = SandboxEditor::CameraPivotDollyChannelId().GetName();
+ m_cameraInputSettings.m_pivotPanChannelId = SandboxEditor::CameraPivotPanChannelId().GetName();
}
diff --git a/Code/Editor/EditorPreferencesPageViewportCamera.h b/Code/Editor/EditorPreferencesPageViewportCamera.h
index 31a728599f..01dc4664f6 100644
--- a/Code/Editor/EditorPreferencesPageViewportCamera.h
+++ b/Code/Editor/EditorPreferencesPageViewportCamera.h
@@ -54,7 +54,7 @@ private:
float m_translateSmoothness;
bool m_translateSmoothing;
bool m_captureCursorLook;
- bool m_orbitYawRotationInverted;
+ bool m_pivotYawRotationInverted;
bool m_panInvertedX;
bool m_panInvertedY;
@@ -80,12 +80,12 @@ private:
AZStd::string m_translateUpChannelId;
AZStd::string m_translateDownChannelId;
AZStd::string m_boostChannelId;
- AZStd::string m_orbitChannelId;
+ AZStd::string m_pivotChannelId;
AZStd::string m_freeLookChannelId;
AZStd::string m_freePanChannelId;
- AZStd::string m_orbitLookChannelId;
- AZStd::string m_orbitDollyChannelId;
- AZStd::string m_orbitPanChannelId;
+ AZStd::string m_pivotLookChannelId;
+ AZStd::string m_pivotDollyChannelId;
+ AZStd::string m_pivotPanChannelId;
};
CameraMovementSettings m_cameraMovementSettings;
diff --git a/Code/Editor/EditorPreferencesTreeWidgetItem.cpp b/Code/Editor/EditorPreferencesTreeWidgetItem.cpp
index 7adc298c2c..09578e72ee 100644
--- a/Code/Editor/EditorPreferencesTreeWidgetItem.cpp
+++ b/Code/Editor/EditorPreferencesTreeWidgetItem.cpp
@@ -9,6 +9,9 @@
#include "EditorPreferencesTreeWidgetItem.h"
+// AzCore
+#include
+
// AzToolsFramework
#include
diff --git a/Code/Editor/EditorViewportCamera.cpp b/Code/Editor/EditorViewportCamera.cpp
index 0c7a1559d1..b25e7072ff 100644
--- a/Code/Editor/EditorViewportCamera.cpp
+++ b/Code/Editor/EditorViewportCamera.cpp
@@ -48,7 +48,7 @@ namespace SandboxEditor
{
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
viewportContext->GetId(), &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
- AZ::Transform::CreateFromQuaternionAndTranslation(CameraRotation(pitch, yaw), position), 0.0f);
+ AZ::Transform::CreateFromQuaternionAndTranslation(CameraRotation(pitch, yaw), position));
}
}
diff --git a/Code/Editor/EditorViewportSettings.cpp b/Code/Editor/EditorViewportSettings.cpp
index 063ec125ba..fe8efecd17 100644
--- a/Code/Editor/EditorViewportSettings.cpp
+++ b/Code/Editor/EditorViewportSettings.cpp
@@ -28,7 +28,7 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraRotateSpeedSetting = "/Amazon/Preferences/Editor/Camera/RotateSpeed";
constexpr AZStd::string_view CameraScrollSpeedSetting = "/Amazon/Preferences/Editor/Camera/DollyScrollSpeed";
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 CameraPanInvertedYSetting = "/Amazon/Preferences/Editor/Camera/PanInvertedY";
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 CameraTranslateDownIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateUpDownId";
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 CameraFreePanIdSetting = "/Amazon/Preferences/Editor/Camera/FreePanId";
- constexpr AZStd::string_view CameraOrbitLookIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitLookId";
- constexpr AZStd::string_view CameraOrbitDollyIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitDollyId";
- constexpr AZStd::string_view CameraOrbitPanIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitPanId";
+ constexpr AZStd::string_view CameraPivotLookIdSetting = "/Amazon/Preferences/Editor/Camera/PivotLookId";
+ constexpr AZStd::string_view CameraPivotDollyIdSetting = "/Amazon/Preferences/Editor/Camera/PivotDollyId";
+ constexpr AZStd::string_view CameraPivotPanIdSetting = "/Amazon/Preferences/Editor/Camera/PivotPanId";
template
void SetRegistry(const AZStd::string_view setting, T&& value)
@@ -239,14 +239,14 @@ namespace SandboxEditor
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()
@@ -403,14 +403,14 @@ namespace SandboxEditor
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()
@@ -433,33 +433,33 @@ namespace SandboxEditor
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
diff --git a/Code/Editor/EditorViewportSettings.h b/Code/Editor/EditorViewportSettings.h
index 20d397a29e..d1271017c6 100644
--- a/Code/Editor/EditorViewportSettings.h
+++ b/Code/Editor/EditorViewportSettings.h
@@ -71,8 +71,8 @@ namespace SandboxEditor
SANDBOX_API float CameraDollyMotionSpeed();
SANDBOX_API void SetCameraDollyMotionSpeed(float speed);
- SANDBOX_API bool CameraOrbitYawRotationInverted();
- SANDBOX_API void SetCameraOrbitYawRotationInverted(bool inverted);
+ SANDBOX_API bool CameraPivotYawRotationInverted();
+ SANDBOX_API void SetCameraPivotYawRotationInverted(bool inverted);
SANDBOX_API bool CameraPanInvertedX();
SANDBOX_API void SetCameraPanInvertedX(bool inverted);
@@ -119,8 +119,8 @@ namespace SandboxEditor
SANDBOX_API AzFramework::InputChannelId CameraTranslateBoostChannelId();
SANDBOX_API void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId);
- SANDBOX_API AzFramework::InputChannelId CameraOrbitChannelId();
- SANDBOX_API void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId);
+ SANDBOX_API AzFramework::InputChannelId CameraPivotChannelId();
+ SANDBOX_API void SetCameraPivotChannelId(AZStd::string_view cameraPivotId);
SANDBOX_API AzFramework::InputChannelId CameraFreeLookChannelId();
SANDBOX_API void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId);
@@ -128,12 +128,12 @@ namespace SandboxEditor
SANDBOX_API AzFramework::InputChannelId CameraFreePanChannelId();
SANDBOX_API void SetCameraFreePanChannelId(AZStd::string_view cameraFreePanId);
- SANDBOX_API AzFramework::InputChannelId CameraOrbitLookChannelId();
- SANDBOX_API void SetCameraOrbitLookChannelId(AZStd::string_view cameraOrbitLookId);
+ SANDBOX_API AzFramework::InputChannelId CameraPivotLookChannelId();
+ SANDBOX_API void SetCameraPivotLookChannelId(AZStd::string_view cameraPivotLookId);
- SANDBOX_API AzFramework::InputChannelId CameraOrbitDollyChannelId();
- SANDBOX_API void SetCameraOrbitDollyChannelId(AZStd::string_view cameraOrbitDollyId);
+ SANDBOX_API AzFramework::InputChannelId CameraPivotDollyChannelId();
+ SANDBOX_API void SetCameraPivotDollyChannelId(AZStd::string_view cameraPivotDollyId);
- SANDBOX_API AzFramework::InputChannelId CameraOrbitPanChannelId();
- SANDBOX_API void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId);
+ SANDBOX_API AzFramework::InputChannelId CameraPivotPanChannelId();
+ SANDBOX_API void SetCameraPivotPanChannelId(AZStd::string_view cameraPivotPanId);
} // namespace SandboxEditor
diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp
index 5b5b52d28f..dad6734428 100644
--- a/Code/Editor/EditorViewportWidget.cpp
+++ b/Code/Editor/EditorViewportWidget.cpp
@@ -2428,7 +2428,7 @@ void EditorViewportWidget::RestoreViewportAfterGameMode()
}
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);
}
}
diff --git a/Code/Editor/Lib/Tests/Camera/test_EditorCamera.cpp b/Code/Editor/Lib/Tests/Camera/test_EditorCamera.cpp
index affe5794cc..1a44d43370 100644
--- a/Code/Editor/Lib/Tests/Camera/test_EditorCamera.cpp
+++ b/Code/Editor/Lib/Tests/Camera/test_EditorCamera.cpp
@@ -167,7 +167,7 @@ namespace UnitTest
AZ::Quaternion::CreateRotationZ(AZ::DegToRad(90.0f)), AZ::Vector3(20.0f, 40.0f, 60.0f));
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
- transformToInterpolateTo, 0.0f);
+ transformToInterpolateTo);
// simulate interpolation
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
@@ -193,7 +193,7 @@ namespace UnitTest
// When
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
TestViewportId, &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform,
- transformToInterpolateTo, 0.0f);
+ transformToInterpolateTo);
// simulate interpolation
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(0.5f), AZ::ScriptTimePoint() });
diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp
index beb338b732..05477bb0c7 100644
--- a/Code/Editor/MainWindow.cpp
+++ b/Code/Editor/MainWindow.cpp
@@ -27,10 +27,11 @@ AZ_POP_DISABLE_WARNING
#endif
// AzCore
-#include
#include
-#include
#include
+#include
+#include
+#include
#include
// AzFramework
diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
index 47bd214b8d..666700a874 100644
--- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
+++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp
@@ -1739,8 +1739,7 @@ void SandboxIntegrationManager::GoToEntitiesInViewports(const AzToolsFramework::
AtomToolsFramework::ModularViewportCameraControllerRequestBus::Event(
viewportContext->GetId(),
- &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, nextCameraTransform,
- distanceToLookAt);
+ &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::InterpolateToTransform, nextCameraTransform);
}
}
}
diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp
index 455cdfa17d..1b731a3d5f 100644
--- a/Code/Editor/PythonEditorFuncs.cpp
+++ b/Code/Editor/PythonEditorFuncs.cpp
@@ -18,6 +18,7 @@
#include
// AzToolsFramework
+#include
#include
#include
diff --git a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp
index 6b3f1c2633..b510315995 100644
--- a/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp
+++ b/Code/Editor/TrackView/SequenceBatchRenderDialog.cpp
@@ -36,9 +36,6 @@
#include "CryEdit.h"
#include "Viewport.h"
-// Atom Renderer
-#include
-
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
@@ -1237,13 +1234,6 @@ void CSequenceBatchRenderDialog::OnKickIdleTimout()
{
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();
- }
}
}
diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp
index 72da1e0b18..dc55411f80 100644
--- a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp
+++ b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp
@@ -19,6 +19,7 @@
// Editor
#include "AnimationContext.h"
+#include
namespace
{
diff --git a/Code/Editor/ViewportTitleDlg.cpp b/Code/Editor/ViewportTitleDlg.cpp
index 65d6de8944..75d16e9a40 100644
--- a/Code/Editor/ViewportTitleDlg.cpp
+++ b/Code/Editor/ViewportTitleDlg.cpp
@@ -15,6 +15,7 @@
#include "ViewportTitleDlg.h"
// Qt
+#include
#include
#include
@@ -36,8 +37,10 @@
#include "MathConversion.h"
#include "EditorViewportSettings.h"
-#include
+#include
#include
+#include
+#include
#include
#include
@@ -145,6 +148,11 @@ CViewportTitleDlg::~CViewportTitleDlg()
AZ::VR::VREventBus::Handler::BusDisconnect();
GetISystem()->GetISystemEventDispatcher()->RemoveListener(this);
GetIEditor()->UnregisterNotifyListener(this);
+
+ if (m_prefabViewportFocusPathHandler)
+ {
+ delete m_prefabViewportFocusPathHandler;
+ }
}
void CViewportTitleDlg::SetupCameraDropdownMenu()
@@ -292,8 +300,6 @@ void CViewportTitleDlg::SetViewPane(CLayoutViewPane* pViewPane)
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnInitDialog()
{
- m_ui->m_titleBtn->setText(m_title);
-
// Add a child parented to us that listens for r_displayInfo changes.
auto displayInfoHelper = new CViewportTitleDlgDisplayInfoHelper(this);
connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo);
@@ -314,13 +320,28 @@ void CViewportTitleDlg::OnInitDialog()
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)
{
m_title = title;
- m_ui->m_titleBtn->setText(m_title);
}
//////////////////////////////////////////////////////////////////////////
diff --git a/Code/Editor/ViewportTitleDlg.h b/Code/Editor/ViewportTitleDlg.h
index 4a2a454907..6996fe7750 100644
--- a/Code/Editor/ViewportTitleDlg.h
+++ b/Code/Editor/ViewportTitleDlg.h
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
@@ -176,6 +177,8 @@ protected:
QWidgetAction* m_gridSizeActionWidget = nullptr;
QWidgetAction* m_angleSizeActionWidget = nullptr;
+ AzToolsFramework::Prefab::PrefabViewportFocusPathHandler* m_prefabViewportFocusPathHandler = nullptr;
+
QScopedPointer m_ui;
};
diff --git a/Code/Editor/ViewportTitleDlg.ui b/Code/Editor/ViewportTitleDlg.ui
index f0679dd2a1..7ba6361cf9 100644
--- a/Code/Editor/ViewportTitleDlg.ui
+++ b/Code/Editor/ViewportTitleDlg.ui
@@ -28,7 +28,7 @@
29
-
+
10
@@ -42,102 +42,112 @@
0
-
-
+
+
+ Up one level
+
+
+
+ :/Breadcrumb/img/UI20/Breadcrumb/arrow_left-default.svg:/Breadcrumb/img/UI20/Breadcrumb/arrow_left-default.svg
+
+
+
+ -
+
0
0
-
- Qt::NoContextMenu
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
-
- Static
+
+
+ -
+
+
+ Camera settings
-
- 11
+
+
+ :/Menu/camera.svg:/Menu/camera.svg
-
-
-
-
- :/Menu/camera.svg:/Menu/camera.svg
-
-
-
- Camera settings
-
-
-
- -
-
-
- Debug information
-
-
-
- :/Menu/debug.svg:/Menu/debug.svg
-
-
-
- true
-
-
-
+
+
+ Debug information
+
+
+
+ :/Menu/debug.svg:/Menu/debug.svg
+
+
+ true
+
+
+
-
-
-
- Toggle viewport helpers
-
-
-
- :/Menu/helpers.svg:/Menu/helpers.svg
-
-
-
- true
-
-
-
+
+
+ Toggle viewport helpers
+
+
+
+ :/Menu/helpers.svg:/Menu/helpers.svg
+
+
+ true
+
+
+
-
-
-
- Viewport resolution
-
-
-
- :/Menu/resolution.svg:/Menu/resolution.svg
-
-
-
+
+
+ Viewport resolution
+
+
+
+ :/Menu/resolution.svg:/Menu/resolution.svg
+
+
-
-
-
- Other settings
-
-
-
- :/Menu/menu.svg:/Menu/menu.svg
-
-
-
+
+
+ Other settings
+
+
+
+ :/Menu/menu.svg:/Menu/menu.svg
+
+
- AzQtComponents::ButtonDivider
+ AzQtComponents::BreadCrumbs
QWidget
- AzQtComponents/Components/ButtonDivider.h
+ AzQtComponents/Components/Widgets/BreadCrumbs.h
1
-
-
-
-
+
+
+
+
diff --git a/Code/Framework/AtomCore/AtomCore/Instance/InstanceData.h b/Code/Framework/AtomCore/AtomCore/Instance/InstanceData.h
index 33fc93c0f5..6b07d12e9c 100644
--- a/Code/Framework/AtomCore/AtomCore/Instance/InstanceData.h
+++ b/Code/Framework/AtomCore/AtomCore/Instance/InstanceData.h
@@ -89,6 +89,9 @@ namespace AZ
// Tracks the asset type used to create the instance.
AssetType m_assetType;
+
+ // Boolean to indicate if the instance has been orphaned from the instance database
+ bool m_isOrphaned = false;
};
/// @cond EXCLUDE_DOCS
diff --git a/Code/Framework/AtomCore/AtomCore/Instance/InstanceDatabase.h b/Code/Framework/AtomCore/AtomCore/Instance/InstanceDatabase.h
index ac97af3629..4b4ad572c2 100644
--- a/Code/Framework/AtomCore/AtomCore/Instance/InstanceDatabase.h
+++ b/Code/Framework/AtomCore/AtomCore/Instance/InstanceDatabase.h
@@ -203,6 +203,16 @@ namespace AZ
//! Calls FindOrCreate using a random InstanceId
Data::Instance Create(const Asset& 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:
InstanceDatabase(const AssetType& assetType);
~InstanceDatabase();
@@ -356,6 +366,20 @@ namespace AZ
return FindOrCreate(Data::InstanceId::CreateRandom(), asset, param);
}
+ template
+ void InstanceDatabase::TEMPOrphan(const InstanceId& id)
+ {
+ AZStd::scoped_lock 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
void InstanceDatabase::ReleaseInstance(InstanceData* instance, const InstanceId& instanceId)
{
@@ -374,6 +398,12 @@ namespace AZ
m_database.erase(instance->GetId());
m_instanceHandler.m_deleteFunction(static_cast(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(instance));
+ }
}
template
diff --git a/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp b/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp
index 5d1edc5a09..6a5c65ac7a 100644
--- a/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp
+++ b/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp
@@ -181,7 +181,76 @@ namespace UnitTest
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::Instance();
+
+ Asset someAsset = assetManager.CreateAsset(s_assetId0, AZ::Data::AssetLoadBehavior::Default);
+
+ Instance 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 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);
@@ -192,6 +261,7 @@ namespace UnitTest
auto& instanceManager = InstanceDatabase::Instance();
AZStd::vector guids;
+ AZStd::vector> instances;
AZStd::vector> assets;
for (size_t i = 0; i < assetIdCount; ++i)
@@ -199,6 +269,7 @@ namespace UnitTest
Uuid guid = Uuid::CreateRandom();
guids.emplace_back(guid);
+ instances.emplace_back(nullptr);
// Pre-create asset so we don't attempt to load it from the catalog.
assets.emplace_back(assetManager.CreateAsset(guid, AZ::Data::AssetLoadBehavior::Default));
@@ -206,6 +277,7 @@ namespace UnitTest
AZStd::vector threads;
AZStd::mutex mutex;
+ AZStd::mutex referenceTableMutex;
AZStd::atomic threadCount((int)threadCountMax);
AZStd::condition_variable cv;
AZStd::atomic_bool keepDispatching(true);
@@ -225,11 +297,15 @@ namespace UnitTest
for (size_t i = 0; i < threadCountMax; ++i)
{
threads.emplace_back(
- [&instanceManager, &threadCount, &cv, &guids, &assets, &durationSeconds]()
+ [&instanceManager, &threadCount, &cv, &guids, &instances, &assets, &durationSeconds, &testCase, &referenceTableMutex]()
{
AZ::Debug::Timer timer;
timer.Stamp();
+ bool deferRemoval = testCase == ParallelInstanceTestCases::CreateAndDeferRemoval ||
+ testCase == ParallelInstanceTestCases::CreateDeferRemovalAndOrphan
+ ? true : false;
+
while (timer.GetDeltaTimeInSeconds() < durationSeconds)
{
const size_t index = rand() % guids.size();
@@ -237,11 +313,36 @@ namespace UnitTest
const InstanceId instanceId{ uuid };
const AssetId assetId{ uuid };
- Instance instance =
- instanceManager.FindOrCreate(instanceId, Asset(assetId, azrtti_typeid()));
- EXPECT_NE(instance, nullptr);
- EXPECT_EQ(instance->GetId(), instanceId);
- EXPECT_EQ(instance->m_asset, assets[index]);
+ ParralleInstanceCurrentAction currentAction = ParallelInstanceGetCurrentAction(testCase);
+
+ if (currentAction == ParralleInstanceCurrentAction::Orphan)
+ {
+ // 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 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--;
@@ -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
while (threadCount > 0 && !timedOut)
{
+ size_t durationSecondsRoundedUp = static_cast(std::ceil(durationSeconds));
+
AZStd::unique_lock lock(mutex);
timedOut =
(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";
@@ -273,11 +376,11 @@ namespace UnitTest
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
// 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.
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
// create or release that instance at the same time.
// 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
- ParallelInstanceCreateHelper(2, 1, duration);
- ParallelInstanceCreateHelper(4, 1, duration);
- ParallelInstanceCreateHelper(8, 1, duration);
+ ParallelInstanceCreateHelper(2, 1, duration, testCase);
+ ParallelInstanceCreateHelper(4, 1, duration, testCase);
+ ParallelInstanceCreateHelper(8, 1, duration, testCase);
}
for (size_t i = 0; i < attempts; ++i)
@@ -301,19 +404,39 @@ namespace UnitTest
printf("Attempt %zu of %zu... \n", i, attempts);
// 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
- ParallelInstanceCreateHelper(2, 1, duration);
- ParallelInstanceCreateHelper(4, 1, duration);
- ParallelInstanceCreateHelper(4, 2, duration);
- ParallelInstanceCreateHelper(4, 4, duration);
- ParallelInstanceCreateHelper(8, 1, duration);
- ParallelInstanceCreateHelper(8, 2, duration);
- ParallelInstanceCreateHelper(8, 3, duration);
- ParallelInstanceCreateHelper(8, 4, duration);
+ ParallelInstanceCreateHelper(2, 1, duration, testCase);
+ ParallelInstanceCreateHelper(4, 1, duration, testCase);
+ ParallelInstanceCreateHelper(4, 2, duration, testCase);
+ ParallelInstanceCreateHelper(4, 4, duration, testCase);
+ ParallelInstanceCreateHelper(8, 1, duration, testCase);
+ ParallelInstanceCreateHelper(8, 2, duration, testCase);
+ ParallelInstanceCreateHelper(8, 3, duration, testCase);
+ 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)
{
bool m_deleted = false;
diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp
index 98182a9568..8eb620f69e 100644
--- a/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp
+++ b/Code/Framework/AzCore/AzCore/Asset/AssetManager.cpp
@@ -340,6 +340,14 @@ namespace AZ
// (Load jobs will attempt to reuse blocked threads before spinning off new job threads)
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()
diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetManagerComponent.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetManagerComponent.cpp
index 93315c9c81..b40c36bc6b 100644
--- a/Code/Framework/AzCore/AzCore/Asset/AssetManagerComponent.cpp
+++ b/Code/Framework/AzCore/AzCore/Asset/AssetManagerComponent.cpp
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Asset/AssetSerializer.cpp b/Code/Framework/AzCore/AzCore/Asset/AssetSerializer.cpp
index ee594c585b..b5cc6c5df4 100644
--- a/Code/Framework/AzCore/AzCore/Asset/AssetSerializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Asset/AssetSerializer.cpp
@@ -8,6 +8,7 @@
#include
#include
+#include
#include
namespace AZ {
diff --git a/Code/Framework/AzCore/AzCore/Component/Component.h b/Code/Framework/AzCore/AzCore/Component/Component.h
index 3cbb9b5a86..677517d896 100644
--- a/Code/Framework/AzCore/AzCore/Component/Component.h
+++ b/Code/Framework/AzCore/AzCore/Component/Component.h
@@ -22,6 +22,7 @@
#include
#include // Used as the allocator for most components.
#include
+#include
namespace AZ
{
diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp
index a13f11c007..168807cd97 100644
--- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp
+++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp
@@ -74,8 +74,6 @@
#include
#include
-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)
{
if (arguments.empty())
@@ -1396,23 +1394,6 @@ namespace AZ
AZ_PROFILE_SCOPE(AzCore, "ComponentApplication::Tick:OnTick");
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(microsecondsPerSecond / g_simulation_tick_rate));
- AZStd::chrono::microseconds timeUntilNextTick = m_currentTime + timeBudgetPerTick - now;
-
- if (timeUntilNextTick.count() > 0)
- {
- AZStd::this_thread::sleep_for(timeUntilNextTick);
- }
- }
}
}
diff --git a/Code/Framework/AzCore/AzCore/Component/Entity.cpp b/Code/Framework/AzCore/AzCore/Component/Entity.cpp
index 2e92873238..0fe201d448 100644
--- a/Code/Framework/AzCore/AzCore/Component/Entity.cpp
+++ b/Code/Framework/AzCore/AzCore/Component/Entity.cpp
@@ -649,6 +649,16 @@ namespace AZ
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
{
EBUS_EVENT_ID(GetId(), EntityBus, OnEntityNameChanged, m_name);
diff --git a/Code/Framework/AzCore/AzCore/Component/Entity.h b/Code/Framework/AzCore/AzCore/Component/Entity.h
index 356533f268..c2bde375bb 100644
--- a/Code/Framework/AzCore/AzCore/Component/Entity.h
+++ b/Code/Framework/AzCore/AzCore/Component/Entity.h
@@ -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.
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.
//! All state changes will be signaled through this 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.
AZStd::string m_name;
+ u32 m_spawnTicketId = 0;
+
//! The state of the entity.
State m_state;
diff --git a/Code/Framework/AzCore/AzCore/Component/EntityUtils.h b/Code/Framework/AzCore/AzCore/Component/EntityUtils.h
index ce258bc637..5c02a3fe74 100644
--- a/Code/Framework/AzCore/AzCore/Component/EntityUtils.h
+++ b/Code/Framework/AzCore/AzCore/Component/EntityUtils.h
@@ -5,8 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
-#ifndef AZCORE_ENTITY_UTILS_H
-#define AZCORE_ENTITY_UTILS_H
+#pragma once
#include
#include
@@ -217,6 +216,3 @@ namespace AZ
} // namespace EntityUtils
} // namespace AZ
-
-#endif // AZCORE_ENTITY_UTILS_H
-#pragma once
diff --git a/Code/Framework/AzCore/AzCore/Component/TickBus.h b/Code/Framework/AzCore/AzCore/Component/TickBus.h
index 966a3c303e..e65efb93f2 100644
--- a/Code/Framework/AzCore/AzCore/Component/TickBus.h
+++ b/Code/Framework/AzCore/AzCore/Component/TickBus.h
@@ -46,8 +46,6 @@ namespace AZ
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_UI = 2000, ///< Suggested tick handler position for UI components.
diff --git a/Code/Framework/AzCore/AzCore/Debug/AssetTracking.h b/Code/Framework/AzCore/AzCore/Debug/AssetTracking.h
index 5c3c835271..615634c05a 100644
--- a/Code/Framework/AzCore/AzCore/Debug/AssetTracking.h
+++ b/Code/Framework/AzCore/AzCore/Debug/AssetTracking.h
@@ -8,6 +8,7 @@
#pragma once
+#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/EBus/EBus.h b/Code/Framework/AzCore/AzCore/EBus/EBus.h
index 58754ff9b8..ff8966e8e0 100644
--- a/Code/Framework/AzCore/AzCore/EBus/EBus.h
+++ b/Code/Framework/AzCore/AzCore/EBus/EBus.h
@@ -19,14 +19,11 @@
#pragma once
#include
+#include
#include
#include
- // Included for backwards compatibility purposes
-#include
-#include
#include
-// End backwards compat
#include
#include
@@ -90,14 +87,14 @@ namespace AZ
* For available settings, see AZ::EBusHandlerPolicy.
* 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.
* For available settings, see AZ::EBusAddressPolicy.
* 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.
@@ -152,14 +149,14 @@ namespace AZ
* `::ExecuteQueuedEvents()`.
* 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.
* If set to false, Bus::AllowFunctionQueuing(true) must be called before events are accepted.
* 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
@@ -168,7 +165,7 @@ namespace AZ
* You should only use this if you know that the data being passed as arguments will
* 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
@@ -197,7 +194,7 @@ namespace AZ
* to do.
* 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.
diff --git a/Code/Framework/AzCore/AzCore/EBus/IEventScheduler.h b/Code/Framework/AzCore/AzCore/EBus/IEventScheduler.h
index 5c1bbf6dab..021e8edfab 100644
--- a/Code/Framework/AzCore/AzCore/EBus/IEventScheduler.h
+++ b/Code/Framework/AzCore/AzCore/EBus/IEventScheduler.h
@@ -13,6 +13,7 @@
#include
#include
#include
+#include
namespace AZ
{
diff --git a/Code/Framework/AzCore/AzCore/EBus/Policies.h b/Code/Framework/AzCore/AzCore/EBus/Policies.h
index db11043ef8..86cbe5d02f 100644
--- a/Code/Framework/AzCore/AzCore/EBus/Policies.h
+++ b/Code/Framework/AzCore/AzCore/EBus/Policies.h
@@ -18,9 +18,8 @@
#include
#include
#include
+#include
-#include
-#include
namespace AZ
{
@@ -251,29 +250,21 @@ namespace AZ
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)!");
- 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;
-
- //////////////////////////////////////////////////////////////////////////
- // Pop element from the queue.
- {
- AZStd::lock_guard 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();
+ const BusMessageCall& localMessage = localMessages.front();
+ localMessage();
+ localMessages.pop();
}
}
diff --git a/Code/Framework/AzCore/AzCore/IO/FileReader.cpp b/Code/Framework/AzCore/AzCore/IO/FileReader.cpp
new file mode 100644
index 0000000000..94118cdfe4
--- /dev/null
+++ b/Code/Framework/AzCore/AzCore/IO/FileReader.cpp
@@ -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
+#include
+#include
+
+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(&m_file); fileHandle != nullptr)
+ {
+ return *fileHandle != AZ::IO::InvalidHandle;
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ return systemFile->IsOpen();
+ }
+
+ return false;
+ }
+
+ void FileReader::Close()
+ {
+ if (auto fileHandle = AZStd::get_if(&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(&m_file); fileHandle != nullptr)
+ {
+ if (SizeType fileSize{}; m_fileIoBase->Size(*fileHandle, fileSize))
+ {
+ return fileSize;
+ }
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ return systemFile->Length();
+ }
+
+ return 0;
+ }
+
+ auto FileReader::Read(SizeType byteSize, void* buffer) -> SizeType
+ {
+ if (auto fileHandle = AZStd::get_if(&m_file); fileHandle != nullptr)
+ {
+ if (SizeType bytesRead{}; m_fileIoBase->Read(*fileHandle, buffer, byteSize, false, &bytesRead))
+ {
+ return bytesRead;
+ }
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ return systemFile->Read(byteSize, buffer);
+ }
+
+ return 0;
+ }
+
+ auto FileReader::Tell() const -> SizeType
+ {
+ if (auto fileHandle = AZStd::get_if(&m_file); fileHandle != nullptr)
+ {
+ if (SizeType fileOffset{}; m_fileIoBase->Tell(*fileHandle, fileOffset))
+ {
+ return fileOffset;
+ }
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ return systemFile->Tell();
+ }
+
+ return 0;
+ }
+
+ bool FileReader::Seek(AZ::s64 offset, SeekType type)
+ {
+ if (auto fileHandle = AZStd::get_if(&m_file); fileHandle != nullptr)
+ {
+ return m_fileIoBase->Seek(*fileHandle, offset, type);
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ systemFile->Seek(offset, static_cast(type));
+ return true;
+ }
+
+ return false;
+ }
+
+ bool FileReader::Eof() const
+ {
+ if (auto fileHandle = AZStd::get_if(&m_file); fileHandle != nullptr)
+ {
+ return m_fileIoBase->Eof(*fileHandle);
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ return systemFile->Eof();
+ }
+
+ return false;
+ }
+
+ bool FileReader::GetFilePath(AZ::IO::FixedMaxPath& filePath) const
+ {
+ if (auto fileHandle = AZStd::get_if(&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::length(pathStringRef.data()));
+ return true;
+ }
+ }
+ else if (auto systemFile = AZStd::get_if(&m_file); systemFile != nullptr)
+ {
+ filePath = systemFile->Name();
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/Code/Framework/AzCore/AzCore/IO/FileReader.h b/Code/Framework/AzCore/AzCore/IO/FileReader.h
new file mode 100644
index 0000000000..4fdb18b2b2
--- /dev/null
+++ b/Code/Framework/AzCore/AzCore/IO/FileReader.h
@@ -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
+#include
+#include
+
+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;
+ 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{};
+ };
+}
diff --git a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp
index 5bff79b422..651abb89fe 100644
--- a/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp
+++ b/Code/Framework/AzCore/AzCore/IO/SystemFile.cpp
@@ -160,12 +160,12 @@ void SystemFile::Seek(SeekSizeType offset, SeekMode mode)
Platform::Seek(m_handle, this, offset, mode);
}
-SystemFile::SizeType SystemFile::Tell()
+SystemFile::SizeType SystemFile::Tell() const
{
return Platform::Tell(m_handle, this);
}
-bool SystemFile::Eof()
+bool SystemFile::Eof() const
{
return Platform::Eof(m_handle, this);
}
diff --git a/Code/Framework/AzCore/AzCore/IO/SystemFile.h b/Code/Framework/AzCore/AzCore/IO/SystemFile.h
index 8a5b2b2521..551ce89ce7 100644
--- a/Code/Framework/AzCore/AzCore/IO/SystemFile.h
+++ b/Code/Framework/AzCore/AzCore/IO/SystemFile.h
@@ -72,9 +72,9 @@ namespace AZ
/// Seek in current file.
void Seek(SeekSizeType offset, SeekMode mode);
/// Get the cursor position in the current file.
- SizeType Tell();
+ SizeType Tell() const;
/// Is the cursor at the end of the file?
- bool Eof();
+ bool Eof() const;
/// Get the time the file was last modified.
AZ::u64 ModificationTime();
/// Read data from a file synchronous. Return number of bytes actually read in the buffer.
diff --git a/Code/Framework/AzCore/AzCore/Name/NameSerializer.cpp b/Code/Framework/AzCore/AzCore/Name/NameSerializer.cpp
index bf3cad7178..581e11ff04 100644
--- a/Code/Framework/AzCore/AzCore/Name/NameSerializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Name/NameSerializer.cpp
@@ -7,6 +7,7 @@
*/
#include
+#include
namespace AZ
{
diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h
index 0a1af21213..7f48f301aa 100644
--- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h
+++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptProperty.cpp b/Code/Framework/AzCore/AzCore/Script/ScriptProperty.cpp
index dbccda4de2..578bbcf271 100644
--- a/Code/Framework/AzCore/AzCore/Script/ScriptProperty.cpp
+++ b/Code/Framework/AzCore/AzCore/Script/ScriptProperty.cpp
@@ -5,11 +5,13 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
+#include
#include
#include
#include
#include
#include
+#include
namespace AZ
{
diff --git a/Code/Framework/AzCore/AzCore/Script/ScriptProperty.h b/Code/Framework/AzCore/AzCore/Script/ScriptProperty.h
index f38931127d..6b7275dfeb 100644
--- a/Code/Framework/AzCore/AzCore/Script/ScriptProperty.h
+++ b/Code/Framework/AzCore/AzCore/Script/ScriptProperty.h
@@ -5,8 +5,7 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
-#ifndef AZCORE_SCRIPT_SCRIPTPROPERTY_H
-#define AZCORE_SCRIPT_SCRIPTPROPERTY_H
+#pragma once
#include
#include
@@ -490,5 +489,4 @@ namespace AZ
};
}
-#endif
diff --git a/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp b/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp
index 01a98667fa..6f1635148c 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp
@@ -8,6 +8,7 @@
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp
index 324df7c141..a741294544 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp
@@ -9,6 +9,7 @@
#include "AzCore/RTTI/TypeInfo.h"
#include
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp
index f06fb36be8..8b6c1d154c 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp
@@ -6,7 +6,9 @@
*
*/
+#include
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/MapSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/MapSerializer.cpp
index 7978b8104b..196ce28216 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/Json/MapSerializer.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/Json/MapSerializer.cpp
@@ -7,6 +7,7 @@
*/
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp
index 6251a2e6de..746c80f3ea 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.cpp
@@ -7,6 +7,7 @@
*/
#include
+#include
#include
#include
#include
diff --git a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.h b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.h
index 5d920045f8..9f9b3fc9f0 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.h
+++ b/Code/Framework/AzCore/AzCore/Serialization/ObjectStream.h
@@ -37,7 +37,8 @@ namespace AZ
class GenericStream;
}
- namespace ObjectStreamInternal {
+ namespace ObjectStreamInternal
+ {
class ObjectStreamImpl;
}
diff --git a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp
index b74039c876..81546f4f28 100644
--- a/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp
+++ b/Code/Framework/AzCore/AzCore/Serialization/SerializeContext.cpp
@@ -7,6 +7,8 @@
*/
#include
+
+#include
#include
#include
#include